aphakia/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
aphakia/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
aphakia/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
aphakia/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
aphakia/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
aphakia/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
aphakia/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
aphakia/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
aphakia/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
aphakia/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
aphakia/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
aphakia/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
aphakia/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
aphakia/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
aphakia/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
aphakia/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
aphakia/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
aphakia/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
aphakia/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
aphakia/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
aphakia/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
aphakia/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
aphakia/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
aphakia/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
aphakia/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
aphakia/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
aphakia/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
aphakia/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
aphakia/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
aphakia/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
aphakia/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
aphakia/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
aphakia/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
aphakia/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
aphakia/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
aphakia/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
aphakia/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
aphakia/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
ascian/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
ascian/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
ascian/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
ascian/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
ascian/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
ascian/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
ascian/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
ascian/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
ascian/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
ascian/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
ascian/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
ascian/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
ascian/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
ascian/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
ascian/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
ascian/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
ascian/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
ascian/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
ascian/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
ascian/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
ascian/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
ascian/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
ascian/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
ascian/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
ascian/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
ascian/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
ascian/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
ascian/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
ascian/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
ascian/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
ascian/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
ascian/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
ascian/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
ascian/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
ascian/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
ascian/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
ascian/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
ascian/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
ascian/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
bolognese/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
bolognese/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
bolognese/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
bolognese/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
bolognese/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
bolognese/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
bolognese/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
bolognese/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
bolognese/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
bolognese/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
bolognese/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
bolognese/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
bolognese/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
bolognese/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
bolognese/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
bolognese/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
bolognese/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
bolognese/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
bolognese/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
bolognese/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
bolognese/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
bolognese/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
bolognese/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
bolognese/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
bolognese/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
bolognese/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
bolognese/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
bolognese/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
bolognese/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
bolognese/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
bolognese/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
bolognese/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
bolognese/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
bolognese/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
bolognese/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
bolognese/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
bolognese/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
bolognese/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
breeze/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
breeze/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
breeze/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
breeze/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
breeze/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
breeze/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
breeze/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
breeze/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
breeze/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
breeze/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
breeze/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
breeze/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
breeze/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
breeze/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
breeze/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
breeze/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
breeze/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
breeze/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
breeze/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
breeze/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
breeze/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
breeze/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
breeze/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
breeze/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
breeze/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
breeze/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
breeze/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
breeze/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
breeze/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
breeze/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
breeze/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
breeze/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
breeze/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
breeze/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
breeze/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
breeze/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
breeze/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
breeze/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
breeze/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
celemin/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
celemin/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
celemin/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
celemin/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
celemin/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
celemin/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
celemin/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
celemin/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
celemin/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
celemin/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
celemin/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
celemin/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
celemin/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
celemin/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
celemin/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
celemin/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
celemin/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
celemin/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
celemin/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
celemin/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
celemin/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
celemin/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
celemin/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
celemin/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
celemin/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
celemin/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
celemin/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
celemin/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
celemin/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
celemin/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
celemin/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
celemin/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
celemin/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
celemin/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
celemin/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
celemin/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
celemin/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
celemin/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
celemin/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
coquilla/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
coquilla/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
coquilla/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
coquilla/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
coquilla/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
coquilla/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
coquilla/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
coquilla/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
coquilla/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
coquilla/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
coquilla/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
coquilla/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
coquilla/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
coquilla/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
coquilla/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
coquilla/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
coquilla/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
coquilla/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
coquilla/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
coquilla/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
coquilla/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
coquilla/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
coquilla/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
coquilla/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
coquilla/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
coquilla/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
coquilla/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
coquilla/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
coquilla/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
coquilla/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
coquilla/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
coquilla/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
coquilla/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
coquilla/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
coquilla/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
coquilla/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
coquilla/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
coquilla/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
filasse/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
filasse/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
filasse/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
filasse/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
filasse/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
filasse/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
filasse/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
filasse/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
filasse/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
filasse/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
filasse/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
filasse/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
filasse/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
filasse/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
filasse/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
filasse/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
filasse/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
filasse/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
filasse/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
filasse/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
filasse/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
filasse/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
filasse/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
filasse/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
filasse/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
filasse/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
filasse/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
filasse/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
filasse/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
filasse/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
filasse/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
filasse/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
filasse/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
filasse/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
filasse/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
filasse/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
filasse/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
filasse/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
filasse/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
gradable/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
gradable/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
gradable/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
gradable/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
gradable/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
gradable/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
gradable/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
gradable/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
gradable/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
gradable/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
gradable/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
gradable/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
gradable/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
gradable/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
gradable/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
gradable/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
gradable/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
gradable/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
gradable/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
gradable/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
gradable/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
gradable/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
gradable/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
gradable/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
gradable/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
gradable/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
gradable/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
gradable/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
gradable/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
gradable/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
gradable/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
gradable/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
gradable/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
gradable/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
gradable/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
gradable/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
gradable/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
gradable/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
gradable/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
harbinger/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
harbinger/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
harbinger/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
harbinger/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
harbinger/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
harbinger/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
harbinger/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
harbinger/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
harbinger/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
harbinger/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
harbinger/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
harbinger/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
harbinger/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
harbinger/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
harbinger/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
harbinger/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
harbinger/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
harbinger/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
harbinger/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
harbinger/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
harbinger/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
harbinger/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
harbinger/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
harbinger/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
harbinger/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
harbinger/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
harbinger/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
harbinger/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
harbinger/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
harbinger/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
harbinger/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
harbinger/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
harbinger/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
harbinger/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
harbinger/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
harbinger/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
harbinger/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
harbinger/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
kashima/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
kashima/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
kashima/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
kashima/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
kashima/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
kashima/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
kashima/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
kashima/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
kashima/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
kashima/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
kashima/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
kashima/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
kashima/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
kashima/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
kashima/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
kashima/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
kashima/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
kashima/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
kashima/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
kashima/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
kashima/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
kashima/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
kashima/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
kashima/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
kashima/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
kashima/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
kashima/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
kashima/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
kashima/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
kashima/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
kashima/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
kashima/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
kashima/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
kashima/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
kashima/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
kashima/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
kashima/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
kashima/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
kashima/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
knockdown/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
knockdown/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
knockdown/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
knockdown/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
knockdown/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
knockdown/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
knockdown/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
knockdown/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
knockdown/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
knockdown/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
knockdown/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
knockdown/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
knockdown/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
knockdown/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
knockdown/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
knockdown/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
knockdown/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
knockdown/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
knockdown/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
knockdown/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
knockdown/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
knockdown/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
knockdown/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
knockdown/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
knockdown/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
knockdown/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
knockdown/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
knockdown/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
knockdown/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
knockdown/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
knockdown/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
knockdown/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
knockdown/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
knockdown/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
knockdown/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
knockdown/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
knockdown/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
knockdown/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
manful/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
manful/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
manful/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
manful/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
manful/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
manful/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
manful/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
manful/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
manful/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
manful/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
manful/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
manful/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
manful/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
manful/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
manful/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
manful/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
manful/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
manful/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
manful/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
manful/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
manful/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
manful/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
manful/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
manful/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
manful/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
manful/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
manful/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
manful/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
manful/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
manful/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
manful/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
manful/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
manful/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
manful/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
manful/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
manful/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
manful/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
manful/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
manful/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
maximal/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
maximal/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
maximal/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
maximal/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
maximal/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
maximal/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
maximal/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
maximal/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
maximal/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
maximal/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
maximal/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
maximal/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
maximal/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
maximal/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
maximal/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
maximal/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
maximal/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
maximal/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
maximal/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
maximal/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
maximal/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
maximal/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
maximal/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
maximal/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
maximal/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
maximal/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
maximal/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
maximal/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
maximal/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
maximal/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
maximal/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
maximal/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
maximal/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
maximal/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
maximal/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
maximal/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
maximal/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
maximal/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
maximal/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
periclase/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
periclase/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
periclase/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
periclase/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
periclase/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
periclase/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
periclase/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
periclase/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
periclase/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
periclase/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
periclase/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
periclase/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
periclase/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
periclase/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
periclase/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
periclase/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
periclase/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
periclase/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
periclase/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
periclase/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
periclase/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
periclase/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
periclase/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
periclase/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
periclase/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
periclase/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
periclase/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
periclase/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
periclase/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
periclase/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
periclase/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
periclase/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
periclase/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
periclase/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
periclase/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
periclase/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
periclase/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
periclase/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
periclase/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
poesis/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
poesis/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
poesis/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
poesis/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
poesis/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
poesis/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
poesis/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
poesis/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
poesis/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
poesis/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
poesis/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
poesis/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
poesis/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
poesis/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
poesis/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
poesis/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
poesis/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
poesis/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
poesis/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
poesis/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
poesis/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
poesis/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
poesis/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
poesis/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
poesis/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
poesis/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
poesis/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
poesis/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
poesis/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
poesis/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
poesis/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
poesis/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
poesis/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
poesis/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
poesis/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
poesis/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
poesis/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
poesis/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
poesis/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
proton/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
proton/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
proton/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
proton/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
proton/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
proton/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
proton/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
proton/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
proton/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
proton/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
proton/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
proton/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
proton/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
proton/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
proton/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
proton/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
proton/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
proton/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
proton/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
proton/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
proton/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
proton/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
proton/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
proton/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
proton/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
proton/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
proton/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
proton/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
proton/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
proton/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
proton/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
proton/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
proton/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
proton/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
proton/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
proton/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
proton/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
proton/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
proton/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
recedence/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
recedence/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
recedence/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
recedence/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
recedence/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
recedence/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
recedence/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
recedence/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
recedence/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
recedence/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
recedence/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
recedence/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
recedence/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
recedence/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
recedence/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
recedence/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
recedence/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
recedence/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
recedence/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
recedence/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
recedence/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
recedence/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
recedence/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
recedence/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
recedence/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
recedence/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
recedence/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
recedence/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
recedence/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
recedence/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
recedence/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
recedence/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
recedence/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
recedence/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
recedence/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
recedence/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
recedence/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
recedence/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
recedence/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
scram/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
scram/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
scram/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
scram/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
scram/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
scram/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
scram/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
scram/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
scram/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
scram/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
scram/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
scram/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
scram/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
scram/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
scram/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
scram/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
scram/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
scram/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
scram/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
scram/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
scram/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
scram/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
scram/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
scram/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
scram/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
scram/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
scram/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
scram/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
scram/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
scram/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
scram/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
scram/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
scram/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
scram/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
scram/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
scram/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
scram/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
scram/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
scram/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
server/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
server/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
server/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
server/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
server/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
server/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
server/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
server/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
server/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
server/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
server/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
server/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
server/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
server/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
server/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
server/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
server/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
server/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
server/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
server/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
server/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
server/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
server/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
server/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
server/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
server/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
server/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
server/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
server/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
server/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
server/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
server/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
server/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
server/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
server/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
server/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
server/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
server/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
server/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
shrubbish/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
shrubbish/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
shrubbish/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
shrubbish/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
shrubbish/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
shrubbish/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
shrubbish/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
shrubbish/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
shrubbish/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
shrubbish/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
shrubbish/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
shrubbish/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
shrubbish/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
shrubbish/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
shrubbish/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
shrubbish/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
shrubbish/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
shrubbish/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
shrubbish/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
shrubbish/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
shrubbish/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
shrubbish/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
shrubbish/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
shrubbish/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
shrubbish/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
shrubbish/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
shrubbish/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
shrubbish/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
shrubbish/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
shrubbish/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
shrubbish/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
shrubbish/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
shrubbish/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
shrubbish/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
shrubbish/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
shrubbish/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
sultam/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
sultam/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
sultam/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
sultam/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
sultam/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
sultam/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
sultam/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
sultam/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
sultam/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
sultam/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
sultam/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
sultam/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
sultam/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
sultam/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
sultam/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
sultam/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
sultam/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
sultam/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
sultam/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
sultam/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
sultam/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
sultam/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
sultam/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
sultam/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
sultam/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
sultam/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
sultam/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
sultam/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
sultam/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
sultam/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
sultam/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
sultam/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
sultam/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
sultam/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
sultam/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
sultam/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
sultam/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
sultam/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
sultam/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
virtuoso/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
virtuoso/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
virtuoso/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
virtuoso/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
virtuoso/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
virtuoso/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
virtuoso/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
virtuoso/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
virtuoso/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
virtuoso/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
virtuoso/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
virtuoso/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
virtuoso/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
virtuoso/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
virtuoso/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
virtuoso/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
virtuoso/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
virtuoso/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
virtuoso/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
virtuoso/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
virtuoso/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
virtuoso/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
virtuoso/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
virtuoso/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
virtuoso/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
virtuoso/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
virtuoso/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
virtuoso/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
virtuoso/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
virtuoso/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
virtuoso/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
virtuoso/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
virtuoso/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
virtuoso/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
virtuoso/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
virtuoso/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
wherrit/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
wherrit/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
wherrit/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
wherrit/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
wherrit/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
wherrit/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
wherrit/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
wherrit/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
wherrit/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
wherrit/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
wherrit/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
wherrit/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
wherrit/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
wherrit/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
wherrit/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
wherrit/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
wherrit/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
wherrit/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
wherrit/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
wherrit/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
wherrit/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
wherrit/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
wherrit/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
wherrit/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
wherrit/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wherrit/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wherrit/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
wherrit/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
wherrit/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
wherrit/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
wherrit/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
wherrit/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
wherrit/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
wherrit/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
wherrit/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wherrit/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wherrit/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
wherrit/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
winsome/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
winsome/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
winsome/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
winsome/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
winsome/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
winsome/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
winsome/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
winsome/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
winsome/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
winsome/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
winsome/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
winsome/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
winsome/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
winsome/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
winsome/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
winsome/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
winsome/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
winsome/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
winsome/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
winsome/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
winsome/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
winsome/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
winsome/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
winsome/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
winsome/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
winsome/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
winsome/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
winsome/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
winsome/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
winsome/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
winsome/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
winsome/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
winsome/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
winsome/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
winsome/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
winsome/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
winsome/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
winsome/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
winsome/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
wirelike/dark
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
wirelike/light
https://github.com/TrinityCore/TrinityCore/tree/master/src/tools/map_extractor/dbcfile.cpp
 1 #define _CRT_SECURE_NO_DEPRECATE
 2 
 3 #include "dbcfile.h"
 4 #include "mpq_libmpq04.h"
 5 
 6 DBCFile::DBCFile(const std::string &filename):
 7     filename(filename),
 8     data(0)
 9 {
10 
11 }
12 bool DBCFile::open()
13 {
14     MPQFile f(filename.c_str());
15     char header[4];
16     unsigned int na,nb,es,ss;
17 
18     if(f.read(header,4)!=4)                                 // Number of records
19         return false;
20 
21     if(header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
22         return false;
23 
24     if(f.read(&na,4)!=4)                                    // Number of records
25         return false;
26     if(f.read(&nb,4)!=4)                                    // Number of fields
27         return false;
28     if(f.read(&es,4)!=4)                                    // Size of a record
29         return false;
30     if(f.read(&ss,4)!=4)                                    // String size
31         return false;
32 
33     recordSize = es;
34     recordCount = na;
35     fieldCount = nb;
36     stringSize = ss;
37     if(fieldCount*4 != recordSize)
38         return false;
39 
40     data = new unsigned char[recordSize*recordCount+stringSize];
41     stringTable = data + recordSize*recordCount;
42 
43     size_t data_size = recordSize*recordCount+stringSize;
44     if(f.read(data,data_size)!=data_size)
45         return false;
46     f.close();
47     return true;
48 }
49 DBCFile::~DBCFile()
50 {
51     delete [] data;
52 }
53 
54 DBCFile::Record DBCFile::getRecord(size_t id)
55 {
56     assert(data);
57     return Record(*this, data + id*recordSize);
58 }
59 
60 size_t DBCFile::getMaxId()
61 {
62     assert(data);
63 
64     size_t maxId = 0;
65     for(size_t i = 0; i < getRecordCount(); ++i)
66     {
67         if(maxId < getRecord(i).getUInt(0))
68             maxId = getRecord(i).getUInt(0);
69     }
70     return maxId;
71 }
72 
73 DBCFile::Iterator DBCFile::begin()
74 {
75     assert(data);
76     return Iterator(*this, data);
77 }
78 DBCFile::Iterator DBCFile::end()
79 {
80     assert(data);
81     return Iterator(*this, stringTable);
82 }
83 
wirelike/dark
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
wirelike/light
https://github.com/torvalds/linux/tree/master/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
 1 /*
 2  * Bestcomm GenBD RX task microcode
 3  *
 4  * Copyright (C) 2006 AppSpec Computer Technologies Corp.
 5  *                    Jeff Gibbons <jeff.gibbons@appspec.com>
 6  * Copyright (c) 2004 Freescale Semiconductor, Inc.
 7  *
 8  * This program is free software; you can redistribute  it and/or modify it
 9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation.
11  *
12  * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
13  * on Tue Mar 4 10:14:12 2006 GMT
14  *
15  */
16 
17 #include <asm/types.h>
18 
19 /*
20  * The header consists of the following fields:
21  *  u32 magic;
22  *  u8  desc_size;
23  *  u8  var_size;
24  *  u8  inc_size;
25  *  u8  first_var;
26  *  u8  reserved[8];
27  *
28  * The size fields contain the number of 32-bit words.
29  */
30 
31 u32 bcom_gen_bd_rx_task[] = {
32     /* header */
33     0x4243544b,
34     0x0d020409,
35     0x00000000,
36     0x00000000,
37 
38     /* Task descriptors */
39     0x808220da/* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
40     0x13e01010/*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
41     0xb880025b/*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
42     0x10001308/*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
43     0x60140002/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
44     0x0cccfcca/*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
45     0xd9190240/*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
46     0xb8c5e009/*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
47     0x07fecf80/*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
48     0x99190024/*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
49     0x60000005/*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
50     0x0c4cf889/*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
51     0x000001f8/*   NOP */
52 
53     /* VAR[9]-VAR[10*/
54     0x40000000,
55     0x7fff7fff,
56 
57     /* INC[0]-INC[3*/
58     0x40000000,
59     0xe0000000,
60     0xa0000008,
61     0x20000000,
62 };
63 
wirelike/dark
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
wirelike/light
https://github.com/NancyFx/Nancy/tree/master/src/Nancy/Bootstrapper/TypeRegistration.cs
 1 namespace Nancy.Bootstrapper^M
 2 {^M
 3     using System;^M
 4 ^M
 5     /// <summary>^M
 6     /// Represents a type to be registered into the container^M
 7     /// </summary>^M
 8     public sealed class TypeRegistration^M
 9     {^M
10         /// <summary>^M
11         /// Represents a type to be registered into the container^M
12         /// </summary>^M
13         /// <param name="registrationType">Registration type i.e. IMyInterface</param>^M
14         /// <param name="implementationType">Implementation type i.e. MyClassThatImplementsIMyInterface</param>^M
15         public TypeRegistration(Type registrationType, Type implementationType)^M
16         {^M
17             if (registrationType == null)^M
18             {^M
19                 throw new ArgumentNullException("registrationType");^M
20             }^M
21 ^M
22             if (implementationType == null)^M
23             {^M
24                 throw new ArgumentNullException("implementationType");^M
25             }^M
26     ^M
27             if (!registrationType.IsAssignableFrom(implementationType))^M
28             {^M
29                 throw new ArgumentException("implementationType must implement registrationType""implementationType");    ^M
30             }^M
31 ^M
32             this.RegistrationType = registrationType;^M
33             this.ImplementationType = implementationType;^M
34         }^M
35 ^M
36         /// <summary>^M
37         /// Implementation type i.e. MyClassThatImplementsIMyInterface^M
38         /// </summary>^M
39         public Type ImplementationType { get; private set; }^M
40 ^M
41         /// <summary>^M
42         /// Registration type i.e. IMyInterface^M
43         /// </summary>^M
44         public Type RegistrationType { get; private set; }^M
45     }^M
46 }
wirelike/dark
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
wirelike/light
https://github.com/torvalds/linux/tree/master/drivers/media/dvb/dvb-core/dvb_net.h
 1 /*
 2  * dvb_net.h
 3  *
 4  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
 5  *
 6  * This program is free software; you can redistribute it and/or
 7  * modify it under the terms of the GNU Lesser General Public License
 8  * as published by the Free Software Foundation; either version 2.1
 9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _DVB_NET_H_
23 #define _DVB_NET_H_
24 
25 #include <linux/module.h>
26 #include <linux/netdevice.h>
27 #include <linux/inetdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 
31 #include "dvbdev.h"
32 
33 #define DVB_NET_DEVICES_MAX 10
34 
35 #ifdef CONFIG_DVB_NET
36 
37 struct dvb_net {
38     struct dvb_device *dvbdev;
39     struct net_device *device[DVB_NET_DEVICES_MAX];
40     int state[DVB_NET_DEVICES_MAX];
41     unsigned int exit:1;
42     struct dmx_demux *demux;
43 };
44 
45 void dvb_net_release(struct dvb_net *);
46 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
47 
48 #else
49 
50 struct dvb_net {
51     struct dvb_device *dvbdev;
52 };
53 
54 static inline void dvb_net_release(struct dvb_net *dvbnet)
55 {
56 }
57 
58 static inline int dvb_net_init(struct dvb_adapter *adap,
59                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
60 {
61     return 0;
62 }
63 
64 #endif /* ifdef CONFIG_DVB_NET */
65 
66 #endif
wirelike/dark
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
wirelike/light
https://github.com/sionescu/iolib/tree/master/src/base/pkgdcl.lisp
 1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
 2 ;;;
 3 ;;; --- Package definition.
 4 ;;;
 5 
 6 (in-package :iolib.common-lisp-user)
 7 
 8 (defpackage :iolib.base
 9   (:extend/excluding :iolib.common-lisp
10                      #:defun #:defmethod #:defmacro #:define-compiler-macro
11                      #:constantp)
12   (:extend :alexandria :split-sequence)
13   (:export
14    ;; Conditions
15    #:bug #:iolib-bug
16    #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
17    ;; Debugging
18    #:*safety-checks*
19    #:debug-only #:debug-only*
20    #:production-only #:production-only*
21    ;; Types
22    #:function-designator
23    #:character-designator
24    #:sb8 #:sb16 #:sb32 #:sb64
25    #:ub8 #:ub16 #:ub32 #:ub64
26    #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
27    #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
28    ;; RETURN*
29    #:return* #:lambda* #:defun #:defmethod
30    #:defmacro #:define-compiler-macro
31    ;; DEFALIAS
32    #:constantp
33    #:defnamespace
34    #:make-alias
35    #:defalias
36    ;; #:function is already in CL
37    #:macro
38    #:constant
39    ;; #:special is already in CL
40    ;; DEFFOLDABLE
41    #:deffoldable
42    #:constant-form-value
43    ;; DEFOBSOLETE
44    #:defobsolete
45    #:signal-obsolete
46    #:deprecation-warning
47    #:deprecation-warning-function-name
48    #:deprecation-warning-type
49    #:deprecation-warning-reason
50    ;; Reader utils
51    #:define-syntax
52    #:enable-reader-macro #:enable-reader-macro*
53    #:disable-reader-macro #:disable-reader-macro*
54    #:define-literal-reader
55    #:unknown-literal-syntax #:unknown-literal-syntax-name
56    ;; Misc
57    #:function-name #:function-name-p
58    #:check-bounds #:join #:join* #:shrink-vector #:full-string
59    ;; Matching
60    #:multiple-value-case #:flags-case
61    ;; Time
62    #:timeout-designator #:positive-timeout-designator
63    #:decode-timeout #:normalize-timeout #:clamp-timeout
64    ))
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/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
wirelike/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/manager/snmpm_network_interface_filter.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 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 -module(snmpm_network_interface_filter).
20 
21 -export([behaviour_info/1]).
22 -export([verify/1]).
23 
24 
25 behaviour_info(callbacks->
26     [{accept_recv,     2}
27      {accept_send,     2},
28      {accept_recv_pdu3},
29      {accept_send_pdu3}];
30 behaviour_info(_->
31     undefined.
32 
33 
34 %% accept_recv(address(), port()) -> boolean() 
35 %% Called at the receiption of a message 
36 %% (before *any* processing has been done).
37 %% 
38 %% accept_send(address(), port()) -> boolean()
39 %% Called before the sending of a message 
40 %% (after *all* processing has been done).
41 %% 
42 %% accept_recv_pdu(Addr, Port, pdu_type()) -> boolean()
43 %% Called after the basic message processing (MPD) has been done, 
44 %% but before the pdu is handed over to the master-agent for 
45 %% primary processing.
46 %% 
47 %% accept_send_pdu(Addr, Port, pdu_type()) -> boolean()
48 %% Called before the basic message processing (MPD) is done, 
49 %% when a pdu has been received from the master-agent.
50 %% 
51 
52 
53 verify(Module->
54     snmp_misc:verify_behaviour(?MODULEModule).
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
wirelike/light
https://github.com/erlang/otp/tree/master/lib/snmp/src/misc/snmp_verbosity.hrl
 1 %% 
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 2000-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 -ifndef(dont_use_verbosity).
21 
22 -define(vapply(M,F,A),{vapply{M,F,A}}).
23 
24 -ifdef(VMODULE).
25 
26 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),info?VMODULE,F,A)).
27 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  ?VMODULE,F,A)).
28 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,?VMODULE,F,A)).
29 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,?VMODULE,F,A)).
30 
31 -else.
32 
33 -define(vinfo(F,A), snmp_verbosity:print(get(verbosity),infoF,A)).
34 -define(vlog(F,A),  snmp_verbosity:print(get(verbosity),log,  F,A)).
35 -define(vdebug(F,A),snmp_verbosity:print(get(verbosity),debug,F,A)).
36 -define(vtrace(F,A),snmp_verbosity:print(get(verbosity),trace,F,A)).
37 
38 -endif.
39 
40 -define(vvalidate(V), snmp_verbosity:validate(V)).
41 
42 -define(vinfoc(F,A), snmp_verbosity:printc(get(verbosity),infoF,A)).
43 -define(vlogc(F,A),  snmp_verbosity:printc(get(verbosity),log,  F,A)).
44 -define(vdebugc(F,A),snmp_verbosity:printc(get(verbosity),debug,F,A)).
45 -define(vtracec(F,A),snmp_verbosity:printc(get(verbosity),trace,F,A)).
46 
47 -else.
48 
49 -define(vvalidate(V),ok).
50 
51 -define(vinfo(F,A),ok).
52 -define(vlog(F,A),ok).
53 -define(vdebug(F,A),ok).
54 -define(vtrace(F,A),ok).
55 
56 -define(vinfoc(F,A),ok).
57 -define(vlogc(F,A),ok).
58 -define(vdebugc(F,A),ok).
59 -define(vtracec(F,A),ok).
60 
61 -endif.
62 
63 
64 
wirelike/dark
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
wirelike/light
https://github.com/yesodweb/yesod/tree/master/yesod-core/widget-benchmark.hs
 1 -- | BigTable benchmark implemented using Hamlet.
 2 --
 3 {-# LANGUAGE QuasiQuotes #-}
 4 module Main where
 5 
 6 import Criterion.Main
 7 import Text.Hamlet
 8 import Numeric (showInt)
 9 import qualified Data.ByteString.Lazy as L
10 import qualified Text.Blaze.Renderer.Utf8 as Utf8
11 import Data.Monoid (mconcat)
12 import Text.Blaze.Html5 (table, tr, td)
13 import Yesod.Widget
14 import Control.Monad.Trans.Writer
15 import Control.Monad.Trans.RWS
16 import Data.Functor.Identity
17 import Yesod.Internal
18 
19 main = defaultMain
20     [ bench "bigTable html" $ nf bigTableHtml bigTableData
21     , bench "bigTable hamlet" $ nf bigTableHamlet bigTableData
22     , bench "bigTable widget" $ nf bigTableWidget bigTableData
23     , bench "bigTable blaze" $ nf bigTableBlaze bigTableData
24     ]
25   where
26     rows :: Int
27     rows = 1000
28 
29     bigTableData :: [[Int]]
30     bigTableData = replicate rows [1..10]
31     {-# NOINLINE bigTableData #-}
32 
33 bigTableHtml rows = L.length $ renderHtml [$hamlet|
34 <table
35     $forall row <- rows
36         <tr
37             $forall cell <- row
38                 <td>#{show cell}
39 |]
40 
41 bigTableHamlet rows = L.length $ renderHamlet id [$hamlet|
42 <table
43     $forall row <- rows
44         <tr
45             $forall cell <- row
46                 <td>#{show cell}
47 |]
48 
49 bigTableWidget rows = L.length $ renderHtml $ (run [$hamlet|
50 <table
51     $forall row <- rows
52         <tr
53             $forall cell <- row
54                 <td>#{show cell}
55 |]) (\_ _ -> "foo")
56   where
57   run (GWidget w) =
58     let (_, _, GWData (Body x) _ _ _ _ _ _) = runRWS w () 0
59      in x
60   {-
61   run (GWidget w) = runIdentity $ do
62     w' <- flip evalStateT 0
63         $ runWriterT $ runWriterT $ runWriterT $ runWriterT
64         $ runWriterT $ runWriterT $ runWriterT w
65     let ((((((((),
66          Body body),
67          _),
68          _),
69          _),
70          _),
71          _),
72          _) = w'
73 
74     return body
75     -}
76 
77 bigTableBlaze t = L.length $ renderHtml $ table $ mconcat $ map row t
78   where
79     row r = tr $ mconcat $ map (td . string . show) r
wirelike/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
wirelike/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/HumanEntity.java
 1 package org.bukkit.entity;
 2 
 3 import org.bukkit.GameMode;
 4 import org.bukkit.inventory.ItemStack;
 5 import org.bukkit.inventory.PlayerInventory;
 6 import org.bukkit.permissions.Permissible;
 7 
 8 /**
 9  * Represents a human entity, such as an NPC or a player
10  */
11 public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible {
12 
13     /**
14      * Returns the name of this player
15      *
16      @return Player name
17      */
18     public String getName();
19 
20     /**
21      * Get the player's inventory.
22      *
23      * @return The inventory of the player, this also contains the armor slots.
24      */
25     public PlayerInventory getInventory();
26 
27     /**
28      * Returns the ItemStack currently in your hand, can be empty.
29      *
30      * @return The ItemStack of the item you are currently holding.
31      */
32     public ItemStack getItemInHand();
33 
34     /**
35      * Sets the item to the given ItemStack, this will replace whatever the
36      * user was holding.
37      *
38      * @param item The ItemStack which will end up in the hand
39      * @return
40      */
41     public void setItemInHand(ItemStack item);
42 
43     /**
44      * Changes the item in hand to another of your 'action slots'.
45      *
46      * @param index The new index to use, only valid ones are 0-8.
47      *
48      public void selectItemInHand(int index);
49      */
50 
51     /**
52      * Returns whether this player is slumbering.
53      *
54      * @return slumber state
55      */
56     public boolean isSleeping();
57 
58     /**
59      * Get the sleep ticks of the player. This value may be capped.
60      *
61      * @return slumber ticks
62      */
63     public int getSleepTicks();
64 
65     /**
66      * Gets this humans current {@link GameMode}
67      *
68      @return Current game mode
69      */
70     public GameMode getGameMode();
71 
72     /**
73      * Sets this humans current {@link GameMode}
74      *
75      @param mode New game mode
76      */
77     public void setGameMode(GameMode mode);
78 }
wirelike/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
wirelike/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/hex-parsing.js
 1 // Copyright 2011 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 var k = 0x1000000000000081;
29 assertEquals(1152921504606847200, k);
30 k = 0x1000000000000281;
31 assertEquals(1152921504606847700, k);
32 k = 0x10000000000002810;
33 assertEquals(18446744073709564000, k);
34 k = 0x10000000000002810000;
35 assertEquals(7.555786372591437e+22, k);
36 k = 0xffffffffffffffff;
37 assertEquals(18446744073709552000, k);
38 k = 0xffffffffffffffffffff;
39 assertEquals(1.2089258196146292e+24, k);
wirelike/dark
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
wirelike/light
https://github.com/Elv22/Tukui/tree/master/ElvUI/modules/blizzard/skins/gossip.lua
 1 local E, C, L, DB = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
 2 if C["skin"].enable ~= true or C["skin"].gossip ~= true then return end
 3 
 4 local function LoadSkin()
 5     ItemTextFrame:StripTextures(true)
 6     ItemTextScrollFrame:StripTextures()
 7     ItemTextFrame:SetTemplate("Transparent")
 8     E.SkinCloseButton(ItemTextCloseButton)
 9     E.SkinNextPrevButton(ItemTextPrevPageButton)
10     E.SkinNextPrevButton(ItemTextNextPageButton)
11     ItemTextPageText:SetTextColor(111)
12     ItemTextPageText.SetTextColor = E.dummy
13     
14     local StripAllTextures = {
15         "GossipFrameGreetingPanel",
16     }           
17 
18     for _, object in pairs(StripAllTextures) do
19         _G[object]:StripTextures()
20     end
21 
22     local KillTextures = {
23         "GossipFramePortrait",
24     }
25 
26     for _, texture in pairs(KillTextures) do
27         _G[texture]:Kill()
28     end
29 
30     local buttons = {
31         "GossipFrameGreetingGoodbyeButton",
32     }
33 
34     for i = 1, #buttons do
35         _G[buttons[i]]:StripTextures()
36         E.SkinButton(_G[buttons[i]])
37     end
38 
39 
40     for i = 1, NUMGOSSIPBUTTONS do
41         obj = select(3,_G["GossipTitleButton"..i]:GetRegions())
42         obj:SetTextColor(1,1,1)
43     end
44 
45     GossipGreetingText:SetTextColor(1,1,1)
46     GossipFrame:CreateBackdrop("Transparent")
47     GossipFrame.backdrop:Point("TOPLEFT", GossipFrame, "TOPLEFT"15, -20)
48     GossipFrame.backdrop:Point("BOTTOMRIGHT", GossipFrame, "BOTTOMRIGHT", -3065)
49     E.SkinCloseButton(GossipFrameCloseButton,GossipFrame.backdrop)
50     
51     
52     --Extreme hackage, blizzard makes button text on quest frame use hex color codes for some reason
53     hooksecurefunc("GossipFrameUpdate"function()
54         for i=1, NUMGOSSIPBUTTONS do
55             local button = _G["GossipTitleButton"..i]
56             
57             if button:GetFontString() then
58                 if button:GetFontString():GetText() and button:GetFontString():GetText():find("|cff000000"then
59                     button:GetFontString():SetText(string.gsub(button:GetFontString():GetText(), "|cff000000""|cffFFFF00"))
60                 end
61             end
62         end
63     end)    
64 end
65 
66 tinsert(E.SkinFuncs["ElvUI"], LoadSkin)
wirelike/dark
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
wirelike/light
https://github.com/RestKit/RestKit/tree/master/Code/Support/RKAlert.m
 1 //
 2 //  RKAlert.m
 3 //  RestKit
 4 //
 5 //  Created by Blake Watters on 4/10/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 #if TARGET_OS_IPHONE
22 #import <UIKit/UIKit.h>
23 #else
24 #import <AppKit/AppKit.h>
25 #endif
26 
27 #import "RKAlert.h"
28 
29 void RKAlert(NSString* message) {
30     RKAlertWithTitle(message, @"Alert");
31 }
32 
33 void RKAlertWithTitle(NSString* message, NSString* title) {
34 #if TARGET_OS_IPHONE
35     UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
36                                                         message:message
37                                                        delegate:nil
38                                               cancelButtonTitle:NSLocalizedString(@"OK"nil)
39                                               otherButtonTitles:nil];
40     [alertView show];
41     [alertView release];
42 #else
43     NSAlert *alert = [[NSAlert alloc] init];
44     [alert setMessageText:message];
45      [alert setInformativeText:message];
46     [alert addButtonWithTitle:NSLocalizedString(@"OK"nil)];   
47     [alert runModal];
48     [alert release];
49 #endif    
50 }
wirelike/dark
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
wirelike/light
https://github.com/facebook/three20/tree/master/src/Three20Style/Headers/TTStyledLayout.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import <Foundation/Foundation.h>
18 #import <UIKit/UIKit.h>
19 
20 @class TTStyle;
21 @class TTStyledNode;
22 @class TTStyledElement;
23 @class TTStyledFrame;
24 @class TTStyledBoxFrame;
25 @class TTStyledInlineFrame;
26 
27 @interface TTStyledLayout : NSObject {
28   CGFloat _x;
29   CGFloat _width;
30   CGFloat _height;
31   CGFloat _lineWidth;
32   CGFloat _lineHeight;
33   CGFloat _minX;
34   CGFloat _floatLeftWidth;
35   CGFloat _floatRightWidth;
36   CGFloat _floatHeight;
37 
38   TTStyledFrame*        _rootFrame;
39   TTStyledFrame*        _lineFirstFrame;
40   TTStyledInlineFrame*  _inlineFrame;
41   TTStyledBoxFrame*     _topFrame;
42   TTStyledFrame*        _lastFrame;
43 
44   UIFont* _font;
45   UIFont* _boldFont;
46   UIFont* _italicFont;
47 
48   UITextAlignment _textAlignment;
49 
50   TTStyle*      _linkStyle;
51   TTStyledNode* _rootNode;
52   TTStyledNode* _lastNode;
53 
54   NSMutableArray* _invalidImages;
55 }
56 
57 @property (nonatomic)           CGFloat         width;
58 @property (nonatomic)           CGFloat         height;
59 @property (nonatomic, retain)   UIFont*         font;
60 @property (nonatomic)           UITextAlignment textAlignment;
61 @property (nonatomic, readonly) TTStyledFrame*  rootFrame;
62 @property (nonatomic, retain)   NSMutableArray* invalidImages;
63 
64 (id)initWithRootNode:(TTStyledNode*)rootNode;
65 (id)initWithX:(CGFloat)x width:(CGFloat)width height:(CGFloat)height;
66 
67 (void)layout:(TTStyledNode*)node;
68 (void)layout:(TTStyledNode*)node container:(TTStyledElement*)element;
69 
70 @end
wirelike/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wirelike/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wirelike/dark
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
wirelike/light
https://github.com/zendframework/zf2/tree/master/tests/Zend/Db/Table/Table/SqlsrvTest.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_Db
17  * @subpackage UnitTests
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace ZendTest\Db\Table\Table;
26 
27 
28 /**
29  * @category   Zend
30  * @package    Zend_Db
31  * @subpackage UnitTests
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  * @group      Zend_Db
35  * @group      Zend_Db_Table
36  */
37 class SqlsrvTest extends AbstractTest
38 {
39     public function setup()
40     {
41         $this->markTestSkipped('This suite is skipped until Zend\DB can be refactored.');
42     }
43     
44     public function testTableInsertSequence()
45     {
46         $this->markTestSkipped($this->getDriver().' does not support sequences.');
47     }
48 
49     public function testTableCascadeUpdate()
50     {
51         $this->markTestSkipped($this->getDriver() . ' cannot update identity columns.');
52     }
53 
54     public function getDriver()
55     {
56         return 'Sqlsrv';
57     }
58 }
wirelike/dark
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
wirelike/light
https://github.com/django/django/tree/master/django/utils/numberformat.py
 1 from django.conf import settings
 2 from django.utils.safestring import mark_safe
 3 
 4 
 5 def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
 6     """
 7     Gets a number (as a number or string), and returns it as a string,
 8     using formats definied as arguments:
 9 
10     * decimal_sep: Decimal separator symbol (for example ".")
11     * decimal_pos: Number of decimal positions
12     * grouping: Number of digits in every group limited by thousand separator
13     * thousand_sep: Thousand separator symbol (for example ",")
14 
15     """
16     use_grouping = force_grouping or settings.USE_L10N and \
17         settings.USE_THOUSAND_SEPARATOR and grouping
18     # Make the common case fast:
19     if isinstance(number, intand not use_grouping and not decimal_pos:
20         return mark_safe(unicode(number))
21     # sign
22     if float(number) < 0:
23         sign = '-'
24     else:
25         sign = ''
26     str_number = unicode(number)
27     if str_number[0] == '-':
28         str_number = str_number[1:]
29     # decimal part
30     if '.' in str_number:
31         int_part, dec_part = str_number.split('.')
32         if decimal_pos is not None:
33             dec_part = dec_part[:decimal_pos]
34     else:
35         int_part, dec_part = str_number, ''
36     if decimal_pos is not None:
37         dec_part = dec_part + ('0' * (decimal_pos - len(dec_part)))
38     if dec_part: dec_part = decimal_sep + dec_part
39     # grouping
40     if use_grouping:
41         int_part_gd = ''
42         for cnt, digit in enumerate(int_part[::-1]):
43             if cnt and not cnt % grouping:
44                 int_part_gd += thousand_sep
45             int_part_gd += digit
46         int_part = int_part_gd[::-1]
47     return sign + int_part + dec_part
48 
wirelike/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
wirelike/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/coreutils.rb
 1 require 'formula'
 2 
 3 def use_default_names?
 4   ARGV.include? '--default-names'
 5 end
 6 
 7 def coreutils_aliases
 8   s = "brew_prefix=`brew --prefix`\n"
 9 
10   %w{
11     base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit
12     cut date dd df dir dircolors dirname du echo env expand expr factor false
13     fmt fold groups head hostid id install join kill link ln logname ls md5sum
14     mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr
15     printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha225sum
16     sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum
17     sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink
18     uptime users vdir wc who whoami yes
19     }.each do |g|
20     s += "alias #{g}=\"$brew_prefix/bin/g#{g}\"\n"
21   end
22 
23   s += "alias '['=\"$brew_prefix/bin/g\\[\"\n"
24 
25   return s
26 end
27 
28 class Coreutils < Formula
29   homepage 'http://www.gnu.org/software/coreutils'
30   url 'http://ftpmirror.gnu.org/coreutils/coreutils-8.12.tar.gz'
31   sha256 '9e233a62c98a3378a7b0483d2ae3d662dbaf6cd3917d3830d3514665e12a85c8'
32 
33   def options
34     [['--default-names'"Do NOT prepend 'g' to the binary; will override system utils."]]
35   end
36 
37   def install
38     args = ["--prefix=#{prefix}"]
39     args << "--program-prefix=g" unless use_default_names?
40 
41     system "./configure", *args
42     system "make install"
43 
44     (prefix+'aliases').write(coreutils_aliases)
45   end
46 
47   def caveats
48     unless use_default_names?; <<-EOS
49 All commands have been installed with the prefix 'g'.
50 
51 A file that aliases these commands to their normal names is available
52 and may be used in your bashrc like:
53 
54     source #{prefix}/aliases
55 
56 But note that sourcing these aliases will cause them to be used instead
57 of Bash built-in commands, which may cause problems in shell scripts.
58 The Bash "printf" built-in behaves differently than gprintf, for instance,
59 which is known to cause problems with "bash-completion".
60 
61 The man pages are still referenced with the g-prefix.
62     EOS
63     end
64   end
65 end
wirelike/dark
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
wirelike/light
https://github.com/jboner/akka/tree/master/akka-actor/src/main/scala/akka/actor/BootableActorLoaderService.scala
 1 /**
 2  * Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
 3  */
 4 
 5 package akka.actor
 6 
 7 import java.io.File
 8 import java.net.{ URL, URLClassLoader }
 9 import java.util.jar.JarFile
10 
11 import akka.util.{ Bootable }
12 import akka.config.Config._
13 
14 /**
15  * Handles all modules in the deploy directory (load and unload)
16  */
17 trait BootableActorLoaderService extends Bootable {
18 
19   val BOOT_CLASSES = config.getList("akka.boot")
20   lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader
21 
22   protected def createApplicationClassLoader: Option[ClassLoader] = Some({
23     if (HOME.isDefined) {
24       val DEPLOY = HOME.get + "/deploy"
25       val DEPLOY_DIR = new File(DEPLOY)
26       if (!DEPLOY_DIR.exists) {
27         System.exit(-1)
28       }
29       val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
30         .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
31       var dependencyJars: List[URL] = Nil
32       filesToDeploy.map { file ⇒
33         val jarFile = new JarFile(file)
34         val en = jarFile.entries
35         while (en.hasMoreElements) {
36           val name = en.nextElement.getName
37           if (name.endsWith(".jar")) dependencyJars ::= new File(
38             String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
39         }
40       }
41       val toDeploy = filesToDeploy.map(_.toURI.toURL)
42       val allJars = toDeploy ::: dependencyJars
43 
44       new URLClassLoader(allJars.toArray, Thread.currentThread.getContextClassLoader)
45     } else Thread.currentThread.getContextClassLoader
46   })
47 
48   abstract override def onLoad = {
49     super.onLoad
50 
51     applicationLoader foreach Thread.currentThread.setContextClassLoader
52 
53     for (loader ← applicationLoader; clazz ← BOOT_CLASSES) {
54       loader.loadClass(clazz).newInstance
55     }
56   }
57 
58   abstract override def onUnload = {
59     super.onUnload
60     Actor.registry.local.shutdownAll
61   }
62 }
63 
64 /**
65  * Java API for the default JAX-RS/Mist Initializer
66  */
67 class DefaultBootableActorLoaderService extends BootableActorLoaderService
wirelike/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wirelike/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wirelike/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))
wirelike/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/mobyc.ss
 1 #lang scheme/base
 2 
 3 (require scheme/cmdline
 4          scheme/runtime-path
 5          "compiler/mzscheme-vm/compile.ss"
 6          "compiler/mzscheme-vm/write-support.ss")
 7 
 8 
 9 (define-runtime-path mzscheme-vm-library-path "../support/externals/mzscheme-vm/lib")
10 
11 
12 
13 
14 
15 
16 (define (write-compilation a-platform input-file out-port)
17   (write-support a-platform out-port)
18   (fprintf out-port #<<EOF
19 var state = interpret.load(
20 EOF
21            )
22   (call-with-input-file input-file 
23     (lambda (ip) 
24       ;; HACK: currently ignoring lang line!
25       (void (read-line ip))
26       (compile ip out-port)))
27   (fprintf out-port #<<EOF
28                );
29 interpret.run(state, function(lastResult) {});
30 EOF
31            ))
32 
33 
34 
35 
36 
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 
39 
40 (define current-platform (make-parameter "node"))
41 
42 ;; output-name: path -> path
43 (define (output-name a-path)
44   (regexp-replace #px"\\.\\w+$" 
45                   (path->string (build-path a-path)) 
46                   ".js"))
47 
48 
49 ;; mobyc: command line compiler
50 (define files-to-compile
51   (command-line #:program "mobyc"
52                 #:once-any
53                 [("-p" "--platform") platform 
54                                      "Platform"
55                                      (current-platform platform)]
56                 #:args filenames
57                 
58                 filenames))
59 
60 (let ([platform (current-platform)])
61   (for ([file (in-list files-to-compile)])
62     (call-with-output-file (output-name file)
63       (lambda (op)
64         (write-compilation platform file op))
65       #:exists 'replace)))