aphakia/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
aphakia/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
aphakia/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
aphakia/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
aphakia/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
aphakia/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
aphakia/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
aphakia/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
aphakia/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
aphakia/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
aphakia/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
aphakia/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
aphakia/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
aphakia/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
aphakia/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
aphakia/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
aphakia/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
aphakia/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
aphakia/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
aphakia/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
aphakia/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
aphakia/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
aphakia/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
aphakia/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
aphakia/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
aphakia/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
aphakia/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
aphakia/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
aphakia/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
aphakia/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
aphakia/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
ascian/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
ascian/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
ascian/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
ascian/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
ascian/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
ascian/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
ascian/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
ascian/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
ascian/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
ascian/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
ascian/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
ascian/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
ascian/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
ascian/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
ascian/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
ascian/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
ascian/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
ascian/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
ascian/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
ascian/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
ascian/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
ascian/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
ascian/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
ascian/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
ascian/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
ascian/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
ascian/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
ascian/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
ascian/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
ascian/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
ascian/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
ascian/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
ascian/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
bolognese/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
bolognese/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
bolognese/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
bolognese/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
bolognese/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
bolognese/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
bolognese/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
bolognese/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
bolognese/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
bolognese/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
bolognese/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
bolognese/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
bolognese/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
bolognese/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
bolognese/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
bolognese/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
bolognese/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
bolognese/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
bolognese/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
bolognese/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
bolognese/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
bolognese/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
bolognese/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
bolognese/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
bolognese/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
bolognese/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
bolognese/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
bolognese/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
bolognese/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
bolognese/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
bolognese/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
breeze/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
breeze/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
breeze/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
breeze/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
breeze/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
breeze/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
breeze/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
breeze/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
breeze/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
breeze/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
breeze/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
breeze/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
breeze/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
breeze/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
breeze/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
breeze/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
breeze/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
breeze/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
breeze/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
breeze/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
breeze/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
breeze/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
breeze/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
breeze/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
breeze/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
breeze/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
breeze/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
breeze/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
breeze/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
breeze/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
breeze/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
breeze/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
breeze/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
celemin/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
celemin/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
celemin/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
celemin/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
celemin/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
celemin/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
celemin/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
celemin/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
celemin/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
celemin/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
celemin/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
celemin/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
celemin/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
celemin/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
celemin/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
celemin/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
celemin/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
celemin/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
celemin/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
celemin/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
celemin/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
celemin/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
celemin/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
celemin/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
celemin/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
celemin/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
celemin/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
celemin/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
celemin/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
celemin/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
celemin/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
celemin/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
celemin/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
coquilla/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
coquilla/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
coquilla/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
coquilla/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
coquilla/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
coquilla/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
coquilla/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
coquilla/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
coquilla/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
coquilla/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
coquilla/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
coquilla/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
coquilla/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
coquilla/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
coquilla/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
coquilla/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
coquilla/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
coquilla/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
coquilla/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
coquilla/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
coquilla/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
coquilla/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
coquilla/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
coquilla/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
coquilla/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
coquilla/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
coquilla/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
coquilla/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
coquilla/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
coquilla/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
coquilla/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
filasse/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
filasse/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
filasse/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
filasse/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
filasse/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
filasse/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
filasse/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
filasse/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
filasse/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
filasse/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
filasse/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
filasse/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
filasse/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
filasse/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
filasse/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
filasse/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
filasse/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
filasse/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
filasse/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
filasse/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
filasse/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
filasse/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
filasse/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
filasse/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
filasse/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
filasse/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
filasse/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
filasse/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
filasse/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
filasse/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
filasse/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
filasse/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
filasse/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
gradable/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
gradable/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
gradable/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
gradable/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
gradable/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
gradable/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
gradable/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
gradable/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
gradable/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
gradable/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
gradable/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
gradable/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
gradable/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
gradable/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
gradable/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
gradable/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
gradable/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
gradable/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
gradable/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
gradable/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
gradable/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
gradable/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
gradable/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
gradable/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
gradable/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
gradable/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
gradable/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
gradable/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
gradable/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
gradable/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
gradable/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
gradable/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
gradable/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
harbinger/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
harbinger/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
harbinger/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
harbinger/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
harbinger/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
harbinger/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
harbinger/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
harbinger/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
harbinger/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
harbinger/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
harbinger/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
harbinger/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
harbinger/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
harbinger/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
harbinger/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
harbinger/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
harbinger/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
harbinger/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
harbinger/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
harbinger/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
harbinger/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
harbinger/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
harbinger/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
harbinger/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
harbinger/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
harbinger/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
harbinger/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
harbinger/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
harbinger/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
harbinger/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
harbinger/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
kashima/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
kashima/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
kashima/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
kashima/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
kashima/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
kashima/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
kashima/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
kashima/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
kashima/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
kashima/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
kashima/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
kashima/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
kashima/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
kashima/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
kashima/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
kashima/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
kashima/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
kashima/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
kashima/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
kashima/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
kashima/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
kashima/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
kashima/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
kashima/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
kashima/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
kashima/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
kashima/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
kashima/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
kashima/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
kashima/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
kashima/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
kashima/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
kashima/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
knockdown/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
knockdown/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
knockdown/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
knockdown/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
knockdown/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
knockdown/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
knockdown/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
knockdown/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
knockdown/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
knockdown/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
knockdown/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
knockdown/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
knockdown/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
knockdown/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
knockdown/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
knockdown/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
knockdown/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
knockdown/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
knockdown/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
knockdown/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
knockdown/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
knockdown/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
knockdown/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
knockdown/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
knockdown/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
knockdown/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
knockdown/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
knockdown/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
knockdown/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
knockdown/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
knockdown/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
manful/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
manful/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
manful/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
manful/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
manful/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
manful/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
manful/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
manful/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
manful/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
manful/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
manful/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
manful/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
manful/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
manful/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
manful/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
manful/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
manful/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
manful/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
manful/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
manful/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
manful/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
manful/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
manful/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
manful/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
manful/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
manful/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
manful/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
manful/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
manful/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
manful/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
manful/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
manful/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
manful/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
maximal/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
maximal/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
maximal/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
maximal/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
maximal/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
maximal/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
maximal/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
maximal/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
maximal/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
maximal/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
maximal/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
maximal/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
maximal/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
maximal/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
maximal/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
maximal/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
maximal/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
maximal/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
maximal/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
maximal/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
maximal/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
maximal/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
maximal/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
maximal/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
maximal/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
maximal/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
maximal/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
maximal/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
maximal/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
maximal/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
maximal/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
maximal/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
maximal/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
periclase/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
periclase/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
periclase/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
periclase/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
periclase/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
periclase/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
periclase/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
periclase/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
periclase/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
periclase/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
periclase/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
periclase/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
periclase/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
periclase/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
periclase/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
periclase/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
periclase/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
periclase/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
periclase/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
periclase/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
periclase/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
periclase/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
periclase/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
periclase/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
periclase/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
periclase/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
periclase/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
periclase/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
periclase/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
periclase/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
periclase/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
periclase/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
periclase/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
poesis/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
poesis/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
poesis/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
poesis/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
poesis/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
poesis/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
poesis/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
poesis/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
poesis/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
poesis/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
poesis/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
poesis/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
poesis/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
poesis/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
poesis/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
poesis/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
poesis/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
poesis/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
poesis/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
poesis/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
poesis/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
poesis/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
poesis/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
poesis/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
poesis/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
poesis/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
poesis/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
poesis/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
poesis/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
poesis/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
poesis/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
poesis/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
poesis/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
proton/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
proton/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
proton/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
proton/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
proton/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
proton/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
proton/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
proton/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
proton/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
proton/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
proton/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
proton/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
proton/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
proton/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
proton/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
proton/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
proton/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
proton/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
proton/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
proton/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
proton/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
proton/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
proton/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
proton/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
proton/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
proton/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
proton/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
proton/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
proton/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
proton/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
proton/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
proton/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
proton/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
recedence/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
recedence/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
recedence/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
recedence/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
recedence/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
recedence/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
recedence/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
recedence/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
recedence/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
recedence/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
recedence/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
recedence/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
recedence/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
recedence/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
recedence/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
recedence/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
recedence/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
recedence/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
recedence/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
recedence/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
recedence/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
recedence/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
recedence/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
recedence/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
recedence/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
recedence/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
recedence/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
recedence/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
recedence/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
recedence/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
recedence/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
recedence/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
recedence/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
scram/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
scram/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
scram/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
scram/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
scram/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
scram/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
scram/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
scram/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
scram/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
scram/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
scram/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
scram/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
scram/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
scram/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
scram/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
scram/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
scram/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
scram/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
scram/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
scram/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
scram/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
scram/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
scram/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
scram/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
scram/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
scram/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
scram/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
scram/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
scram/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
scram/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
scram/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
scram/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
scram/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
server/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
server/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
server/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
server/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
server/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
server/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
server/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
server/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
server/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
server/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
server/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
server/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
server/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
server/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
server/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
server/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
server/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
server/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
server/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
server/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
server/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
server/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
server/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
server/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
server/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
server/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
server/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
server/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
server/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
server/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
server/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
server/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
server/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
shrubbish/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
shrubbish/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
shrubbish/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
shrubbish/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
shrubbish/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
shrubbish/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
shrubbish/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
shrubbish/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
shrubbish/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
shrubbish/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
shrubbish/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
shrubbish/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
shrubbish/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
shrubbish/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
shrubbish/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
shrubbish/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
shrubbish/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
shrubbish/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
shrubbish/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
shrubbish/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
shrubbish/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
shrubbish/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
shrubbish/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
shrubbish/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
shrubbish/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
shrubbish/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
shrubbish/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
shrubbish/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
shrubbish/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
sultam/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
sultam/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
sultam/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
sultam/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
sultam/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
sultam/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
sultam/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
sultam/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
sultam/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
sultam/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
sultam/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
sultam/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
sultam/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
sultam/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
sultam/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
sultam/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
sultam/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
sultam/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
sultam/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
sultam/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
sultam/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
sultam/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
sultam/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
sultam/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
sultam/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
sultam/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
sultam/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
sultam/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
sultam/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
sultam/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
sultam/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
sultam/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
sultam/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
virtuoso/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
virtuoso/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
virtuoso/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
virtuoso/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
virtuoso/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
virtuoso/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
virtuoso/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
virtuoso/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
virtuoso/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
virtuoso/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
virtuoso/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
virtuoso/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
virtuoso/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
virtuoso/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
virtuoso/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
virtuoso/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
virtuoso/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
virtuoso/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
virtuoso/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
virtuoso/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
virtuoso/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
virtuoso/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
virtuoso/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
virtuoso/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
virtuoso/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
virtuoso/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
virtuoso/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
virtuoso/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
virtuoso/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
wherrit/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
wherrit/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
wherrit/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
wherrit/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
wherrit/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
wherrit/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
wherrit/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
wherrit/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
wherrit/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
wherrit/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
wherrit/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
wherrit/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
wherrit/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
wherrit/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
wherrit/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
wherrit/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
wherrit/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
wherrit/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
wherrit/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
wherrit/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
wherrit/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
wherrit/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
wherrit/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
wherrit/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
wherrit/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
wherrit/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
wherrit/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
wherrit/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
wherrit/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
wherrit/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
wherrit/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
winsome/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
winsome/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
winsome/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
winsome/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
winsome/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
winsome/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
winsome/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
winsome/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
winsome/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
winsome/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
winsome/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
winsome/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
winsome/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
winsome/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
winsome/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
winsome/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
winsome/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
winsome/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
winsome/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
winsome/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
winsome/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
winsome/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
winsome/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
winsome/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
winsome/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
winsome/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
winsome/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
winsome/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
winsome/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
winsome/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
winsome/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
winsome/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
winsome/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
wirelike/dark
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
wirelike/light
https://github.com/ProjectSkyfire/SkyFireEMU/tree/master/dep/g3dlite/source/ReferenceCount.cpp
 1 /**
 2   @file ReferenceCount.cpp
 3 
 4   Reference Counting Garbage Collector for C++
 5 
 6   @maintainer Morgan McGuire, http://graphics.cs.williams.edu
 7   @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
 8   @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
 9 
10   @created 2001-10-23
11   @edited  2009-04-25
12 */
13 #include "G3D/platform.h"
14 #include "G3D/ReferenceCount.h"
15 
16 namespace G3D {
17 ReferenceCountedObject::ReferenceCountedObject() :
18     ReferenceCountedObject_refCount(0),
19     ReferenceCountedObject_weakPointer(0) {
20     debugAssertM(isValidHeapPointer(this),
21         "Reference counted objects must be allocated on the heap.");
22 }
23 
24 void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
25     // Tell all of my weak pointers that I'm gone.
26 
27     _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
28 
29     while (node != NULL) {
30         // Notify the weak pointer that it is going away
31         node->weakPtr->objectCollected();
32 
33         // Free the node and advance
34         _WeakPtrLinkedList* tmp = node;
35         node = node->next;
36         delete tmp;
37     }
38 }
39 
40 ReferenceCountedObject::~ReferenceCountedObject() {}
41 
42 ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
43     ReferenceCountedObject_refCount(0),
44     ReferenceCountedObject_weakPointer(0) {
45     (void)notUsed;
46     debugAssertM(G3D::isValidHeapPointer(this),
47         "Reference counted objects must be allocated on the heap.");
48 }
49 
50 ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
51     (void)other;
52     // Nothing changes when I am assigned; the reference count on
53     // both objects is the same (although my super-class probably
54     // changes).
55     return *this;
56 }
57 // G3D
wirelike/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
wirelike/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lantiq/xway/mach-easy50712.c
 1 /*
 2  *  This program is free software; you can redistribute it and/or modify it
 3  *  under the terms of the GNU General Public License version 2 as published
 4  *  by the Free Software Foundation.
 5  *
 6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 7  */
 8 
 9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 
17 #include <lantiq_soc.h>
18 #include <irq.h>
19 
20 #include "../machtypes.h"
21 #include "devices.h"
22 
23 static struct mtd_partition easy50712_partitions[] = {
24     {
25         .name   = "uboot",
26         .offset = 0x0,
27         .size   = 0x10000,
28     },
29     {
30         .name   = "uboot_env",
31         .offset = 0x10000,
32         .size   = 0x10000,
33     },
34     {
35         .name   = "linux",
36         .offset = 0x20000,
37         .size   = 0xe0000,
38     },
39     {
40         .name   = "rootfs",
41         .offset = 0x100000,
42         .size   = 0x300000,
43     },
44 };
45 
46 static struct physmap_flash_data easy50712_flash_data = {
47     .nr_parts   = ARRAY_SIZE(easy50712_partitions),
48     .parts      = easy50712_partitions,
49 };
50 
51 static struct ltq_pci_data ltq_pci_data = {
52     .clock  = PCI_CLOCK_INT,
53     .gpio   = PCI_GNT1 | PCI_REQ1,
54     .irq    = {
55         [14] = INT_NUM_IM0_IRL0 + 22,
56     },
57 };
58 
59 static struct ltq_eth_data ltq_eth_data = {
60     .mii_mode = PHY_INTERFACE_MODE_MII,
61 };
62 
63 static void __init easy50712_init(void)
64 {
65     ltq_register_gpio_stp();
66     ltq_register_nor(&easy50712_flash_data);
67     ltq_register_pci(&ltq_pci_data);
68     ltq_register_etop(&ltq_eth_data);
69 }
70 
71 MIPS_MACHINE(LTQ_MACH_EASY50712,
72          "EASY50712",
73          "EASY50712 Eval Board",
74           easy50712_init);
wirelike/dark
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
wirelike/light
https://github.com/mono/monodevelop/tree/master/extras/ValaBinding/Project/ProjectPackageEventArgs.cs
 1 //
 2 // ProjectPackageEventArgs.cs
 3 //
 4 // Authors:
 5 //  Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com> 
 6 //
 7 // Copyright (C) 2008 Levi Bard
 8 // Based on CBinding by Marcos David Marin Amador <MarcosMarin@gmail.com>
 9 //
10 // This source code is licenced under The MIT License:
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31 
32 
33 using System;
34 
35 namespace MonoDevelop.ValaBinding
36 {
37     public delegate void ProjectPackageEventHandler (object sender, ProjectPackageEventArgs e);
38     
39     public class ProjectPackageEventArgs
40     {
41         ValaProject project;
42         ProjectPackage package;
43         
44         public ProjectPackageEventArgs(ValaProject project, ProjectPackage package)
45         {
46             this.project = project;
47             this.package = package;
48         }
49         
50         public ValaProject Project {
51             get { return project; }
52         }
53         
54         public ProjectPackage Package {
55             get { return package; }
56         }
57     }
58 }
wirelike/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
wirelike/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/lasat/lasat_models.h
 1 /*
 2  * Model description tables
 3  */
 4 #include <linux/kernel.h>
 5 
 6 struct product_info {
 7     const char     *pi_name;
 8     const char     *pi_type;
 9 };
10 
11 struct vendor_info {
12     const char     *vi_name;
13     const struct product_info *vi_product_info;
14 };
15 
16 /*
17  * Base models
18  */
19 static const char * const txt_base_models[] = {
20     "MQ 2""MQ Pro""SP 25""SP 50""SP 100""SP 5000""SP 7000",
21     "SP 1000""Unknown"
22 };
23 #define N_BASE_MODELS (ARRAY_SIZE(txt_base_models) - 1)
24 
25 /*
26  * Eicon Networks
27  */
28 static const char txt_en_mq[] = "Masquerade";
29 static const char txt_en_sp[] = "Safepipe";
30 
31 static const struct product_info product_info_eicon[] = {
32     { txt_en_mq, "II"   }, /*  0 */
33     { txt_en_mq, "Pro"  }, /*  1 */
34     { txt_en_sp, "25"   }, /*  2 */
35     { txt_en_sp, "50"   }, /*  3 */
36     { txt_en_sp, "100"  }, /*  4 */
37     { txt_en_sp, "5000" }, /*  5 */
38     { txt_en_sp, "7000" }, /*  6 */
39     { txt_en_sp, "30"   }, /*  7 */
40     { txt_en_sp, "5100" }, /*  8 */
41     { txt_en_sp, "7100" }, /*  9 */
42     { txt_en_sp, "1110" }, /* 10 */
43     { txt_en_sp, "3020" }, /* 11 */
44     { txt_en_sp, "3030" }, /* 12 */
45     { txt_en_sp, "5020" }, /* 13 */
46     { txt_en_sp, "5030" }, /* 14 */
47     { txt_en_sp, "1120" }, /* 15 */
48     { txt_en_sp, "1130" }, /* 16 */
49     { txt_en_sp, "6010" }, /* 17 */
50     { txt_en_sp, "6110" }, /* 18 */
51     { txt_en_sp, "6210" }, /* 19 */
52     { txt_en_sp, "1020" }, /* 20 */
53     { txt_en_sp, "1040" }, /* 21 */
54     { txt_en_sp, "1050" }, /* 22 */
55     { txt_en_sp, "1060" }, /* 23 */
56 };
57 
58 #define N_PRIDS ARRAY_SIZE(product_info_eicon)
59 
60 /*
61  * The vendor table
62  */
63 static struct vendor_info const vendor_info_table[] = {
64     { "Eicon Networks", product_info_eicon   },
65 };
66 
67 #define N_VENDORS ARRAY_SIZE(vendor_info_table)
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/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
wirelike/light
https://github.com/technomancy/emacs-starter-kit/tree/master/starter-kit-js.el
 1 ;;; starter-kit-js.el --- Some helpful Javascript helpers
 2 ;;
 3 ;; Part of the Emacs Starter Kit
 4 
 5 ;; NB: js-mode is part of Emacs since version 23.2 (with an alias
 6 ;; javascript-mode). It is derived and updated from Espresso mode.
 7 
 8 (defvar esk-js-mode-hook nil)
 9 (defun run-esk-js-mode-hook ()
10   (run-hooks 'esk-js-mode-hook))
11 
12 (defmacro esk-configure-javascript (name)
13   (let ((sym (intern name))
14         (mode (intern (concat name "-mode")))
15         (hook (intern (concat name "-mode-hook")))
16         (keymap (intern (concat name "-mode-map")))
17         (indent (intern (concat name "-indent-level"))))
18     `(progn
19        (autoload ',mode ,name ,(concat "Start " name "-mode") t)
20        (add-to-list 'auto-mode-alist '("\\.js$" . ,mode))
21        (add-to-list 'auto-mode-alist '("\\.json$" . ,mode))
22        (add-hook ',hook 'moz-minor-mode)
23        (add-hook ',hook 'esk-paredit-nonlisp)
24        (add-hook ',hook 'run-coding-hook)
25        (add-hook ',hook 'run-esk-js-mode-hook)
26        (setq ,indent 2)
27 
28        (eval-after-load ',sym
29          '(progn (define-key ,keymap "{" 'paredit-open-curly)
30                  (define-key ,keymap "}" 'paredit-close-curly-and-newline)
31                  (define-key ,keymap (kbd ",") 'self-insert-command))))))
32 
33 (defun pretty-functions ()
34   (font-lock-add-keywords
35    nil `(("\\(function *\\)("
36           (0 (progn (compose-region (match-beginning 1)
37                                     (match-end 1) "Æ’")
38                     nil))))))
39 (add-hook 'esk-js-mode-hook 'pretty-functions)
40 
41 (if (< (string-to-number emacs-version) 23.2)
42     (esk-configure-javascript "espresso")
43   (esk-configure-javascript "js"))
44 
45 (provide 'starter-kit-js)
46 ;;; starter-kit-js.el ends here
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
wirelike/light
https://github.com/erlang/otp/tree/master/lib/xmerl/src/xmerl_sgml.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2004-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 
20  %% Description  : Callback module for exporting XML to SGML.
21 
22 -module(xmerl_sgml).
23 
24 -export(['#xml-inheritance#'/0]).
25 
26 %% Note: we assume XML data, so all tags are lowercase!
27 
28 -export(['#root#'/4,
29    '#element#'/5,
30    '#text#'/1]).
31 
32 -import(xmerl_lib[markup/3find_attribute/2export_text/1]).
33 
34 -include("xmerl.hrl").
35 
36 
37 '#xml-inheritance#'() -> [].
38 
39 
40 %% The '#text#' function is called for every text segment.
41 
42 '#text#'(Text->
43     export_text(Text).
44 
45 
46 %% The '#root#' tag is called when the entire structure has been
47 %% exported. It does not appear in the structure itself.
48 
49 '#root#'(DataAttrs[]_E-> 
50     case find_attribute(headerAttrsof
51   {valueHdr} ->
52       [HdrData];
53   false ->
54       Data
55     end.
56 
57 
58 %% Note that SGML does not have the <Tag/> empty-element form.
59 %% Furthermore, for some element types, the end tag may be forbidden -
60 %% this can be handled by extending this module - see xmerl_otpsgml.erl
61 %% for an example. (By default, we always generate the end tag, to make
62 %% sure that the scope of a markup is not extended by mistake.)
63 
64 '#element#'(TagDataAttrs_Parents_E->
65     markup(TagAttrsData).
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
wirelike/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/compile/snmpc_lib.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2009-2011. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %% 
19 
20 -ifndef(snmpc_lib).
21 -define(snmpc_libtrue).
22 
23 -define(vwarning(FA),
24   case get(warnings_as_errorsof
25       true -> snmpc_lib:error(FA);
26       _ -> ?verbosity(warningFAignore)
27   end).
28 
29 -define(vwarning2(FAMibLine),
30    case get(warnings_as_errorsof
31        true -> snmpc_lib:error(FAMibLine);
32        _ -> ?verbosity(warningFAMibLine)
33    end).
34 -define(vinfo(FA),              ?verbosity(info,    FAignore)).
35 -define(vinfo2(FAMibLine),    ?verbosity(info,    FAMibLine)).
36 -define(vlog(FA),               ?verbosity(log,     FAignore)).
37 -define(vlog2(FAMibLine),     ?verbosity(log,     FAMibLine)).
38 -define(vdebug(FA),             ?verbosity(debug,   FAignore)).
39 -define(vdebug2(FAMibLine),   ?verbosity(debug,   FAMibLine)).
40 -define(vtrace(FA),             ?verbosity(trace,   FAignore)).
41 -define(vtrace2(FAMibLine),   ?verbosity(trace,   FAMibLine)).
42 
43 -define(verbosity(SeverityFAMibLine), 
44   snmpc_lib:vprint(Severity?MODULE?LINEMibLineFA)).
45 
46 -endif. % -ifndef(snmpc_lib).
wirelike/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
wirelike/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
 1 module Yi.Style.Misc (happyDeluxe,  textExMachina) where
 2 
 3 import Data.Monoid
 4 
 5 -- Have to import global Yi space to get access to Data.Prototype. That should
 6 -- be split into a separate package.
 7 import Yi
 8 
 9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11 
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe :: Theme
15 happyDeluxe = defaultTheme `override` \super _ -> super
16   { modelineAttributes = emptyAttributes
17   , tabBarAttributes   = emptyAttributes { foreground = RGB 255 255 255 }
18   , baseAttributes     = emptyAttributes { foreground = RGB 255 255 255, background = RGB 14 19 30 }
19 
20   , selectedStyle      = withBg (RGB 21 40 90)
21 
22   , commentStyle       = withFg (RGB 53 73 124)
23   , keywordStyle       = withFg (RGB 254 144 6)
24   , numberStyle        = withFg (RGB 20 222 209)
25   , stringStyle        = withFg (RGB 253 102 249)
26   , typeStyle          = mempty
27   , operatorStyle      = mempty
28   , errorStyle         = withFg (RGB 252 45 7)
29   }
30 
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina :: Theme
34 textExMachina = defaultTheme `override` \super _ -> super
35   { modelineAttributes = emptyAttributes { foreground = black }
36   , tabBarAttributes   = emptyAttributes { foreground = black }
37   , baseAttributes     = emptyAttributes { foreground = RGB 230 230 230, background = RGB 21 21 21 }
38 
39   , selectedStyle      = withBg (RGB 102 102 102)
40 
41   , commentStyle       = withFg (RGB 51 51 51)
42   , keywordStyle       = withFg (RGB 119 124 178)
43   , numberStyle        = withFg (RGB 174 129 255)
44   , stringStyle        = withFg (RGB 102 204 255)
45   , typeStyle          = withFg (RGB 174 129 255)
46   , variableStyle      = withFg (RGB 255 255 255)
47   , operatorStyle      = withFg (RGB 151 255 127)
48   }
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/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
wirelike/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-267.js
 1 // Copyright 2009 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 // See http://code.google.com/p/v8/issues/detail?id=267
29 
30 var global = (function(){ return this})();
31 function taint(fn){var v = fn(); eval("taint"); return v; }
32 function getThis(){ return this}
33 var obj = taint(getThis);
34 
35 assertEquals(global, obj, "Should be the global object.");
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/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
wirelike/light
https://github.com/RestKit/RestKit/tree/master/Vendor/SBJSON/NSObject+SBJSON.m
 1 /*
 2  Copyright (C) 2009 Stig Brautaset. All rights reserved.
 3  
 4  Redistribution and use in source and binary forms, with or without
 5  modification, are permitted provided that the following conditions are met:
 6  
 7  * Redistributions of source code must retain the above copyright notice, this
 8    list of conditions and the following disclaimer.
 9  
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  
14  * Neither the name of the author nor the names of its contributors may be used
15    to endorse or promote products derived from this software without specific
16    prior written permission.
17  
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #import "NSObject+SBJSON.h"
31 #import "SBJsonWriter.h"
32 #import "RKFixCategoryBug.h"
33 
34 RK_FIX_CATEGORY_BUG(NSObject_SBJSON)
35 
36 @implementation NSObject (NSObject_SBJSON)
37 
38 (NSString *)JSONRepresentation {
39     SBJsonWriter *jsonWriter = [SBJsonWriter new];    
40     NSString *json = [jsonWriter stringWithObject:self];
41     if (!json)
42         NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]);
43     [jsonWriter release];
44     return json;
45 }
46 
47 @end
wirelike/dark
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
wirelike/light
https://github.com/RestKit/RestKit/tree/master/Code/ObjectMapping/RKParserRegistry.h
 1 //
 2 //  RKParserRegistry.h
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 5/18/11.
 6 //  Copyright 2011 Two Toasters
 7 //  
 8 //  Licensed under the Apache License, Version 2.0 (the "License");
 9 //  you may not use this file except in compliance with the License.
10 //  You may obtain a copy of the License at
11 //  
12 //  http://www.apache.org/licenses/LICENSE-2.0
13 //  
14 //  Unless required by applicable law or agreed to in writing, software
15 //  distributed under the License is distributed on an "AS IS" BASIS,
16 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //  See the License for the specific language governing permissions and
18 //  limitations under the License.
19 //
20 
21 #import "../Support/RKMIMETypes.h"
22 #import "../Support/RKParser.h"
23 
24 /**
25  The Parser Registry provides for the registration of RKParser classes
26  for a particular MIME Type. This enables
27  */
28 @interface RKParserRegistry : NSObject {
29     NSMutableDictionary* _MIMETypeToParserClasses;
30 }
31 
32 /**
33  Return the global shared singleton registry for MIME Type to Parsers
34  */
35 (RKParserRegistry*)sharedRegistry;
36 
37 /**
38  Instantiate and return a Parser for the given MIME Type
39  */
40 (id<RKParser>)parserForMIMEType:(NSString*)MIMEType;
41 
42 /**
43  Return the class registered for handling parser/encoder operations
44  for a given MIME Type
45  */
46 (Class<RKParser>)parserClassForMIMEType:(NSString*)MIMEType;
47 
48 /**
49  Registers an RKParser conformant class as the handler for the specified MIME Type
50  */
51 (void)setParserClass:(Class<RKParser>)parserClass forMIMEType:(NSString*)MIMEType;
52 
53 /**
54  Automatically configure the registry via run-time reflection of the RKParser classes
55  available that ship with RestKit. This happens automatically when the shared registry
56  singleton is initialized and makes configuration transparent to users.
57  */
58 (void)autoconfigure;
59 
60 @end
wirelike/dark
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
wirelike/light
https://github.com/mirrors/perl/tree/master/cpan/Unicode-Collate/Collate/Locale/cs.pl
 1 +{
 2    entry => <<'ENTRY', # for DUCET v6.0.0
 3 010D      ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 4 0063 030C ; [.15D2.0020.0002.010D] # LATIN SMALL LETTER C WITH CARON
 5 010C      ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 6 0043 030C ; [.15D2.0020.0008.010C] # LATIN CAPITAL LETTER C WITH CARON
 7 0063 0068 ; [.1668.0020.0002.0063] # <LATIN SMALL LETTER C, LATIN SMALL LETTER H>
 8 0063 0048 ; [.1668.0020.0007.0063][.0000.0000.0002.0000] # <LATIN SMALL LETTER C, LATIN CAPITAL LETTER H>
 9 0043 0068 ; [.1668.0020.0007.0043][.0000.0000.0008.0000] # <LATIN CAPITAL LETTER C, LATIN SMALL LETTER H>
10 0043 0048 ; [.1668.0020.0008.0043] # <LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER H>
11 0159      ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
12 0072 030C ; [.1771.0020.0002.0159] # LATIN SMALL LETTER R WITH CARON
13 0158      ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
14 0052 030C ; [.1771.0020.0008.0158] # LATIN CAPITAL LETTER R WITH CARON
15 0161      ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
16 0073 030C ; [.17A7.0020.0002.0161] # LATIN SMALL LETTER S WITH CARON
17 0160      ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
18 0053 030C ; [.17A7.0020.0008.0160] # LATIN CAPITAL LETTER S WITH CARON
19 017E      ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
20 007A 030C ; [.1845.0020.0002.017E] # LATIN SMALL LETTER Z WITH CARON
21 017D      ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
22 005A 030C ; [.1845.0020.0008.017D] # LATIN CAPITAL LETTER Z WITH CARON
23 ENTRY
24 };
wirelike/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
wirelike/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Acl/Role/GenericRole.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_Acl
17  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
19  */
20 
21 /**
22  * @namespace
23  */
24 namespace Zend\Acl\Role;
25 
26 use Zend\Acl\Role;
27 
28 /**
29  * @uses       Zend\Acl\Role
30  * @category   Zend
31  * @package    Zend_Acl
32  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
34  */
35 class GenericRole implements Role
36 {
37     /**
38      * Unique id of Role
39      *
40      * @var string
41      */
42     protected $_roleId;
43 
44     /**
45      * Sets the Role identifier
46      *
47      * @param  string $id
48      * @return void
49      */
50     public function __construct($roleId)
51     {
52         $this->_roleId = (string) $roleId;
53     }
54 
55     /**
56      * Defined by Zend\Acl\Role; returns the Role identifier
57      *
58      * @return string
59      */
60     public function getRoleId()
61     {
62         return $this->_roleId;
63     }
64 
65     /**
66      * Defined by Zend\Acl\Role; returns the Role identifier
67      * Proxies to getRoleId()
68      *
69      * @return string
70      */
71     public function __toString()
72     {
73         return $this->getRoleId();
74     }
75 }
wirelike/dark
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
wirelike/light
https://github.com/midgetspy/Sick-Beard/tree/master/lib/hachoir_parser/template.py
 1 """
 2 ====================== 8< ============================
 3 This file is an Hachoir parser template. Make a copy
 4 of it, and adapt it to your needs.
 5 
 6 You have to replace all "TODO" with you code.
 7 ====================== 8< ============================
 8 
 9 TODO parser.
10 
11 Author: TODO TODO
12 Creation date: YYYY-mm-DD
13 """
14 
15 TODO: Just keep what you need
16 from lib.hachoir_parser import Parser
17 from lib.hachoir_core.field import (ParserError,
18     UInt8, UInt16, UInt32, String, RawBytes)
19 from lib.hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
20 
21 class TODOFile(Parser):
22     PARSER_TAGS = {
23         "id""TODO",
24         "category""TODO",    # "archive", "audio", "container", ...
25         "file_ext": ("TODO",), TODO: Example ("bmp",) to parse the file "image.bmp"
26         "mime": (u"TODO"),      TODO: Example: "image/png"
27         "min_size"0,         TODO: Minimum file size (x bits, or x*8 in bytes)
28         "description""TODO"TODO: Example: "A bitmap picture"
29     }
30 
31 #    TODO: Choose between little or big endian
32 #    endian = LITTLE_ENDIAN
33 #    endian = BIG_ENDIAN
34 
35     def validate(self):
36         TODO: Check that file looks like your format
37         # Example: check first two bytes
38         # return (self.stream.readBytes(0, 2) == 'BM')
39         return False
40 
41     def createFields(self):
42         TODO: Write your parser using this model:
43         # yield UInt8(self, "name1", "description1")
44         # yield UInt16(self, "name2", "description2")
45         # yield UInt32(self, "name3", "description3")
46         # yield String(self, "name4", 1, "description4") # TODO: add ", charset="ASCII")"
47         # yield String(self, "name5", 1, "description5", charset="ASCII")
48         # yield String(self, "name6", 1, "description6", charset="ISO-8859-1")
49 
50         # Read rest of the file (if any)
51         TODO: You may remove this code
52         if self.current_size < self._size:
53             yield self.seekBit(self._size, "end")
54 
wirelike/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
wirelike/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/uemacs.rb
 1 require 'formula'
 2 
 3 class Uemacs < Formula
 4   head 'git://git.kernel.org/pub/scm/editors/uemacs/uemacs.git'
 5   homepage 'http://git.kernel.org/?p=editors/uemacs/uemacs.git'
 6 
 7   # two patches to ensure config files are loaded correctly
 8   def patches
 9     DATA
10   end
11 
12   def install
13     cellar_etc = prefix + 'etc'
14 
15     inreplace 'Makefile' do |s|
16       s.change_make_var! 'BINDIR', bin
17       s.change_make_var! 'LIBDIR', cellar_etc
18       s.gsub! ".emacsrc""emacs.rc"
19     end
20 
21     inreplace 'epath.h' do |s|
22       s.gsub! ".emacsrc""emacs.rc"
23       s.gsub! "/usr/local/lib", etc
24     end
25 
26     bin.mkdir
27     cellar_etc.mkdir
28 
29     system "make"
30     system "make install"
31   end
32 
33   def caveats
34     <<-EOS.undent
35       The system-wide configuration file, emacs.rc, has been installed to
36       #{etc}. uemacs will also load ~/.emrc if it exists. You can
37       override this behavior by creating the file ~/.emacsrc.
38     EOS
39   end
40 end
41 
42 __END__
43 diff --git a/emacs.rc b/emacs.rc
44 index 06c0f12..e8e07b7 100644
45 --- a/emacs.rc
46 +++ b/emacs.rc
47 @@ -286,4 +286,7 @@ bind-to-key newline ^J
48         add-global-mode "utf-8"
49  !endif
50 
51 +!force execute-file &cat $HOME "/.emrc"
52 +!force execute-file &cat ".emrc"
53 +
54  set $discmd "TRUE"
55 
56 diff --git a/bind.c b/bind.c
57 index eb28c1f..88911f6 100644
58 --- a/bind.c
59 +++ b/bind.c
60 @@ -490,7 +490,7 @@ char *flook(char *fname, int hflag)
61       /* build home dir file spec */
62       strcpy(fspec, home);
63       strcat(fspec, "/");
64 -     strcat(fspec, fname);
65 +     strcat(fspec, ".emacsrc");
66 
67       /* and try it out */
68       if (ffropen(fspec) == FIOSUC) {
wirelike/dark
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
wirelike/light
https://github.com/harrah/xsbt/tree/master/main/TaskData.scala
 1 /* sbt -- Simple Build Tool
 2  * Copyright 2011 Mark Harrah
 3  */
 4 package sbt
 5 
 6   import Load.BuildStructure
 7   import Project.{Initialize, ScopedKey}
 8   import Keys.{resolvedScoped, streams, TaskStreams}
 9   import std.TaskExtra._
10   import Types.{:+:, idFun}
11 
12   import sbinary.{Format, Operations}
13 
14 object TaskData
15 {
16   val DefaultDataID = "data"
17 
18   def apply[I,O](readFrom: Scoped, id: String = DefaultDataID)(f: (State, I) => O)(default: => I)(implicit fmt: Format[I]): Initialize[State => O] =
19     resolvedScoped { resolved =>
20       s => f(s, readData(Project structure s, resolved, readFrom.key, id) getOrElse default)
21     }
22   
23   def readData[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_], id: String)(implicit f: Format[T]): Option[T] =
24     try {
25       dataStreams(structure, reader, readFrom) { (ts,key) =>
26         Operations.read( ts.readBinary(key, id) )(f)
27       }
28     } catch { case e: Exception => None }
29 
30   def dataStreams[T](structure: BuildStructure, reader: ScopedKey[_], readFrom: AttributeKey[_])(f: (TaskStreams, ScopedKey[_]) => T): Option[T] =
31     structure.data.definingScope(reader.scope, readFrom) map { defined =>
32       val key = ScopedKey(Scope.fillTaskAxis(defined, readFrom), readFrom)
33       structure.streams.use(reader)(ts => f(ts, key))
34     }
35   def write[T](i: Initialize[Task[T]], id: String = DefaultDataID)(implicit f: Format[T]): Initialize[Task[T]] = writeRelated(i, id)(idFun[T])(f)
36 
37   def writeRelated[T, S](i: Initialize[Task[T]], id: String = DefaultDataID)(convert: T => S)(implicit f: Format[S]): Initialize[Task[T]] =
38     (streams.identity zipWith i) { (sTask, iTask) =>
39       (sTask,iTask) map { case s :+: value :+: HNil =>
40         Operations.write( s.binary(id), convert(value) )(f)
41         value
42       }
43     }
44 }
wirelike/dark
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
wirelike/light
https://github.com/higepon/mosh/tree/master/misc/bench/gambit-benchmarks/triangl.scm
 1 ;;; TRIANGL -- Board game benchmark.
 2  
 3 (define *board*
 4   (list->vector '(1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)))
 5 
 6 (define *sequence*
 7   (list->vector '(0 0 0 0 0 0 0 0 0 0 0 0 0 0)))
 8 
 9 (define *a*
10   (list->vector '(1 2 4 3 5 6 1 3 6 2 5 4 11 12
11                   13 7 8 4 4 7 11 8 12 13 6 10
12                   15 9 14 13 13 14 15 9 10
13                   6 6)))
14 
15 (define *b*
16   (list->vector '(2 4 7 5 8 9 3 6 10 5 9 8
17                   12 13 14 8 9 5 2 4 7 5 8
18                   9 3 6 10 5 9 8 12 13 14
19                   8 9 5 5)))
20 
21 (define *c*
22   (list->vector '(4 7 11 8 12 13 6 10 15 9 14 13
23                   13 14 15 9 10 6 1 2 4 3 5 6 1
24                   3 6 2 5 4 11 12 13 7 8 4 4)))
25 
26 (define *answer* '())
27  
28 (define (attempt i depth)
29   (cond ((= depth 14)
30          (set! *answer*
31                (cons (cdr (vector->list *sequence*)) *answer*))
32          #t)
33         ((and (= 1 (vector-ref *board* (vector-ref *a* i)))
34               (= 1 (vector-ref *board* (vector-ref *b* i)))
35               (= 0 (vector-ref *board* (vector-ref *c* i))))
36          (vector-set! *board* (vector-ref *a* i) 0)
37          (vector-set! *board* (vector-ref *b* i) 0)
38          (vector-set! *board* (vector-ref *c* i) 1)
39          (vector-set! *sequence* depth i)
40          (do ((0 (+ j 1))
41               (depth (+ depth 1)))
42              ((or (= j 36) (attempt j depth)) #f))
43          (vector-set! *board* (vector-ref *a* i) 1)
44          (vector-set! *board* (vector-ref *b* i) 1)
45          (vector-set! *board* (vector-ref *c* i) 0) #f)
46         (else #f)))
47 
48 (define (test i depth)
49   (set! *answer* '())
50   (attempt i depth)
51   (car *answer*))
52  
53 (define (main . args)
54   (run-benchmark
55     "triangl"
56     triangl-iters
57     (lambda (result) (equal? result '(22 34 31 15 7 1 20 17 25 6 5 13 32)))
58     (lambda (i depth) (lambda () (test i depth)))
59     22
60     1))
wirelike/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))
wirelike/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/tsrj/silencing-music.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-intermediate-lambda-reader.ss" "lang")((modname silencing-music) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 ;; Plays a song with a decaying volume.
 5 
 6 ;; The world is a volume number between 0 and 70.
 7 
 8 ;; timer and initial volume will be user-inputted parameters later
 9 (define song "file:///android_asset/song.ogg")
10 
11 ;; The world is a number counting the number of seconds until the music turns off
12 (define initial-world 100)
13 
14 
15 ;; update: world -> world
16 ;; Every tick, reduces the volume.
17 (define (tick w)
18   (max 0 (sub1 w)))
19 
20 
21 ;; reset: world -> world
22 ;; Resets the world to the initial value.
23 (define (reset w)
24   initial-world)
25 
26 
27 ;; get-effects: world -> (listof effect)
28 ;; Returns the list of effects that the world should be applying.
29 ;; Ensures the song is playing, at a particular volume,
30 ;; and that the phone doesn't go to sleep prematurely.
31 (define (get-effects w)
32   (list (make-effect:play-sound-url song)
33         (make-effect:set-sound-volume w)))
34 
35 
36 ;; draw: world -> DOM-sexp
37 ;; Draws the current volume on screen.
38 (define (draw w)
39   (list (js-p '(("id" "aPara")))
40         (list (js-text (string-append "volume = " (number->string w))))))
41 
42 
43 ;; draw-css: world -> CSS-sexp
44 ;; The paragraph will have large text.
45 (define (draw-css a-world)
46   '(("aPara" ("font-size" "30px"))))
47 
48 
49 (js-big-bang initial-world
50              '()
51              (on-draw draw draw-css)
52              (on-shake reset)
53              (on-tick* 1/5 tick get-effects))