Merge branch 'master' into 2073-local

This commit is contained in:
Arfon Smith
2015-02-27 14:12:23 -06:00
19 changed files with 1532 additions and 11 deletions

6
.gitmodules vendored
View File

@@ -633,3 +633,9 @@
[submodule "vendor/grammars/ampl"]
path = vendor/grammars/ampl
url = https://github.com/ampl/sublime-ampl
[submodule "vendor/grammars/openscad.tmbundle"]
path = vendor/grammars/openscad.tmbundle
url = https://github.com/tbuser/openscad.tmbundle
[submodule "vendor/grammars/sublime-varnish"]
path = vendor/grammars/sublime-varnish
url = https://github.com/brandonwamboldt/sublime-varnish

View File

@@ -385,6 +385,8 @@ vendor/grammars/ooc.tmbundle:
- source.ooc
vendor/grammars/opa.tmbundle:
- source.opa
vendor/grammars/openscad.tmbundle/:
- source.scad
vendor/grammars/oz-tmbundle/Syntaxes/Oz.tmLanguage:
- source.oz
vendor/grammars/pascal.tmbundle:
@@ -492,6 +494,8 @@ vendor/grammars/sublime-text-ox/:
- source.ox
vendor/grammars/sublime-text-pig-latin/:
- source.pig_latin
vendor/grammars/sublime-varnish:
- source.varnish.vcl
vendor/grammars/sublime_cobol:
- source.acucobol
- source.cobol

View File

@@ -107,10 +107,14 @@ module Linguist
end
end
disambiguate "IDL", "Prolog" do |data|
disambiguate "IDL", "Prolog", "INI", "QMake" do |data|
if data.include?(":-")
Language["Prolog"]
else
elsif data.include?("last_client=")
Language["INI"]
elsif data.include?("HEADERS") && data.include?("SOURCES")
Language["QMake"]
elsif /^\s*function[ \w,]+$/.match(data)
Language["IDL"]
end
end
@@ -178,11 +182,13 @@ module Linguist
end
end
disambiguate "M", "Mathematica", "Matlab", "Mercury", "Objective-C" do |data|
disambiguate "M", "MUF", "Mathematica", "Matlab", "Mercury", "Objective-C" do |data|
if ObjectiveCRegex.match(data)
Language["Objective-C"]
elsif data.include?(":- module")
Language["Mercury"]
elsif /^: /.match(data)
Language["MUF"]
elsif /^\s*;/.match(data)
Language["M"]
elsif /^\s*\(\*/.match(data)
@@ -229,5 +235,15 @@ module Linguist
Language["Text"]
end
end
disambiguate "D", "DTrace", "Makefile" do |data|
if /^module /.match(data)
Language["D"]
elsif /^((dtrace:::)?BEGIN|provider |#pragma (D (option|attributes)|ident)\s)/.match(data)
Language["DTrace"]
elsif /(\/.*:( .* \\)$| : \\$|^ : |: \\$)/.match(data)
Language["Makefile"]
end
end
end
end

View File

@@ -712,6 +712,15 @@ DM:
tm_scope: source.c++
ace_mode: c_cpp
DTrace:
type: programming
extensions:
- .d
interpreters:
- dtrace
tm_scope: source.c
ace_mode: c_cpp
Darcs Patch:
type: programming
search_term: dpatch
@@ -1334,6 +1343,7 @@ INI:
- .ini
- .cfg
- .prefs
- .pro
- .properties
tm_scope: source.ini
aliases:
@@ -1753,6 +1763,15 @@ MTML:
tm_scope: text.html.basic
ace_mode: html
MUF:
type: programming
group: Forth
extensions:
- .muf
- .m
tm_scope: none
ace_mode: forth
Makefile:
type: programming
aliases:
@@ -1761,6 +1780,7 @@ Makefile:
- mf
extensions:
- .mak
- .d
- .mk
filenames:
- GNUmakefile
@@ -1808,6 +1828,8 @@ Mathematica:
- .ma
- .nb
- .nbp
- .wl
- .wlt
aliases:
- mma
ace_mode: text
@@ -2125,7 +2147,7 @@ OpenSCAD:
type: programming
extensions:
- .scad
tm_scope: none
tm_scope: source.scad
ace_mode: scad
Org:
@@ -3110,11 +3132,11 @@ UnrealScript:
VCL:
type: programming
ace_mode: perl
color: "#0298c3"
extensions:
- .vcl
tm_scope: source.perl
tm_scope: source.varnish.vcl
ace_mode: text
VHDL:
type: programming

166
samples/C/pqiv.h Normal file
View File

@@ -0,0 +1,166 @@
/**
* pqiv
*
* Copyright (c) 2013-2014, Phillip Berndt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// This file contains the definition of files, image types and
// the plugin infrastructure. It should be included in file type
// handlers.
#ifndef _PQIV_H_INCLUDED
#define _PQIV_H_INCLUDED
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include "lib/bostree.h"
#ifndef PQIV_VERSION
#define PQIV_VERSION "2.3"
#endif
#define FILE_FLAGS_ANIMATION (guint)(1)
#define FILE_FLAGS_MEMORY_IMAGE (guint)(1<<1)
// The structure for images {{{
typedef struct file_type_handler_struct_t file_type_handler_t;
typedef struct {
// File type
const file_type_handler_t *file_type;
// Special flags
// FILE_FLAGS_ANIMATION -> Animation functions are invoked
// Set by file type handlers
// FILE_FLAGS_MEMORY_IMAGE -> File lives in memory
guint file_flags;
// The file name to display and to sort by
gchar *display_name;
// The URI or file name of the file
gchar *file_name;
// If the file is a memory image, the actual image data
GBytes *file_data;
// The file monitor structure is used for inotify-watching of
// the files
GFileMonitor *file_monitor;
// This flag stores whether this image is currently loaded
// and valid. i.e. if it is set, you can assume that
// private_data contains a representation of the image;
// if not, you can NOT assume that it does not.
gboolean is_loaded;
// Cached image size
guint width;
guint height;
// File-type specific data, allocated and freed by the file type handlers
void *private;
} file_t;
// }}}
// Definition of the built-in file types {{{
// If you want to implement your own file type, you'll have to implement the
// following functions and a non-static initialization function named
// file_type_NAME_initializer that fills a file_type_handler_t with pointers to
// the functions. Store the file in backends/NAME.c and adjust the Makefile to
// add the required libraries if your backend is listed in the $(BACKENDS)
// variable.
typedef enum { PARAMETER, RECURSION, INOTIFY, BROWSE_ORIGINAL_PARAMETER, FILTER_OUTPUT } load_images_state_t;
// Allocation function: Allocate the ->private structure within a file and add the
// image(s) to the list of available images via load_images_handle_parameter_add_file()
// If an image is not to be loaded for any reason, the file structure should be
// deallocated using file_free()
// Returns a pointer to the first added image
// Optional, you can also set the pointer to this function to NULL.
typedef BOSNode *(*file_type_alloc_fn_t)(load_images_state_t state, file_t *file);
// Deallocation, if a file is removed from the images list. Free the ->private structure.
// Only called if ->private is non-NULL.
typedef void (*file_type_free_fn_t)(file_t *file);
// Actually load a file into memory
typedef void (*file_type_load_fn_t)(file_t *file, GInputStream *data, GError **error_pointer);
// Unload a file
typedef void (*file_type_unload_fn_t)(file_t *file);
// Animation support: Initialize memory for animations, return ms until first frame
// Optional, you can also set the pointer to this function to NULL.
typedef double (*file_type_animation_initialize_fn_t)(file_t *file);
// Animation support: Advance to the next frame, return ms until next frame
// Optional, you can also set the pointer to this function to NULL.
typedef double (*file_type_animation_next_frame_fn_t)(file_t *file);
// Draw the current view to a cairo context
typedef void (*file_type_draw_fn_t)(file_t *file, cairo_t *cr);
struct file_type_handler_struct_t {
// All files will be filtered with this filter. If it lets it pass,
// a handler is assigned to a file. If none do, the file is
// discarded if it was found during directory traversal or
// loaded using the first image backend if it was an explicit
// parameter.
GtkFileFilter *file_types_handled;
// Pointers to the functions defined above
file_type_alloc_fn_t alloc_fn;
file_type_free_fn_t free_fn;
file_type_load_fn_t load_fn;
file_type_unload_fn_t unload_fn;
file_type_animation_initialize_fn_t animation_initialize_fn;
file_type_animation_next_frame_fn_t animation_next_frame_fn;
file_type_draw_fn_t draw_fn;
};
// Initialization function: Tell pqiv about a backend
typedef void (*file_type_initializer_fn_t)(file_type_handler_t *info);
// pqiv symbols available to plugins {{{
// Global cancellable that should be used for every i/o operation
extern GCancellable *image_loader_cancellable;
// Current scale level. For backends that don't support cairo natively.
extern gdouble current_scale_level;
// Load a file from disc/memory/network
GInputStream *image_loader_stream_file(file_t *file, GError **error_pointer);
// Add a file to the list of loaded files
// Should be called at least once in a file_type_alloc_fn_t, with the state being
// forwarded unaltered.
BOSNode *load_images_handle_parameter_add_file(load_images_state_t state, file_t *file);
// Load all data from an input stream into memory, conveinience function
GBytes *g_input_stream_read_completely(GInputStream *input_stream, GCancellable *cancellable, GError **error_pointer);
// Free a file
void file_free(file_t *file);
// }}}
// File type handlers, used in the initializer and file type guessing
extern file_type_handler_t file_type_handlers[];
/* }}} */
#endif

318
samples/D/mpq.d Normal file
View File

@@ -0,0 +1,318 @@
/*
* mpq.d -- D programming language module for libmpq
*
* Copyright (c) 2008 Georg Lukas <georg@op-co.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This module is written to support Phobos. Patches to allow binding to
* Tango are welcome.
*/
module mpq;
/* the following pragma does not work on DMD/Linux, generates a warning on
* GDC/Linux and has not been tested on Windows. Commented out for now. */
// pragma(lib, "libmpq");
import std.string; // for format() and toStringz()
import std.traits; // for ParameterTypeTuple!()
/* XXX: this assumes that libmpq is compiled with Large File Support on */
alias long off_t;
/* libmpq error return values */
const LIBMPQ_ERROR_OPEN = -1; /* open error on file. */
const LIBMPQ_ERROR_CLOSE = -2; /* close error on file. */
const LIBMPQ_ERROR_SEEK = -3; /* lseek error on file. */
const LIBMPQ_ERROR_READ = -4; /* read error on file. */
const LIBMPQ_ERROR_WRITE = -5; /* write error on file. */
const LIBMPQ_ERROR_MALLOC = -6; /* memory allocation error. */
const LIBMPQ_ERROR_FORMAT = -7; /* format errror. */
const LIBMPQ_ERROR_NOT_INITIALIZED = -8; /* init() wasn't called. */
const LIBMPQ_ERROR_SIZE = -9; /* buffer size is to small. */
const LIBMPQ_ERROR_EXIST = -10; /* file or block does not exist in archive. */
const LIBMPQ_ERROR_DECRYPT = -11; /* we don't know the decryption seed. */
const LIBMPQ_ERROR_UNPACK = -12; /* error on unpacking file. */
/** libmpq internal meta-data for an archive */
extern struct mpq_archive_s;
extern(C) {
/* libmpq__generic information about library. */
char *libmpq__version();
/* libmpq__generic mpq archive information. */
int libmpq__archive_open(mpq_archive_s **mpq_archive, char *mpq_filename, off_t archive_offset);
int libmpq__archive_close(mpq_archive_s *mpq_archive);
int libmpq__archive_packed_size(mpq_archive_s *mpq_archive, off_t *packed_size);
int libmpq__archive_unpacked_size(mpq_archive_s *mpq_archive, off_t *unpacked_size);
int libmpq__archive_offset(mpq_archive_s *mpq_archive, off_t *offset);
int libmpq__archive_version(mpq_archive_s *mpq_archive, uint *version_);
int libmpq__archive_files(mpq_archive_s *mpq_archive, uint *files);
/* libmpq__generic file processing functions. */
int libmpq__file_packed_size(mpq_archive_s *mpq_archive, uint file_number, off_t *packed_size);
int libmpq__file_unpacked_size(mpq_archive_s *mpq_archive, uint file_number, off_t *unpacked_size);
int libmpq__file_offset(mpq_archive_s *mpq_archive, uint file_number, off_t *offset);
int libmpq__file_blocks(mpq_archive_s *mpq_archive, uint file_number, uint *blocks);
int libmpq__file_encrypted(mpq_archive_s *mpq_archive, uint file_number, uint *encrypted);
int libmpq__file_compressed(mpq_archive_s *mpq_archive, uint file_number, uint *compressed);
int libmpq__file_imploded(mpq_archive_s *mpq_archive, uint file_number, uint *imploded);
int libmpq__file_number(mpq_archive_s *mpq_archive, char *filename, uint *number);
int libmpq__file_read(mpq_archive_s *mpq_archive, uint file_number, ubyte *out_buf, off_t out_size, off_t *transferred);
/* libmpq__generic block processing functions. */
int libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint file_number);
int libmpq__block_close_offset(mpq_archive_s *mpq_archive, uint file_number);
int libmpq__block_unpacked_size(mpq_archive_s *mpq_archive, uint file_number, uint block_number, off_t *unpacked_size);
int libmpq__block_read(mpq_archive_s *mpq_archive, uint file_number, uint block_number, ubyte *out_buf, off_t out_size, off_t *transferred);
}
/** exception class for failed libmpq calls */
class MPQException : Exception {
const string[] Errors = [
"unknown error",
"open error on file",
"close error on file",
"lseek error on file",
"read error on file",
"write error on file",
"memory allocation error",
"format errror",
"init() wasn't called",
"buffer size is to small",
"file or block does not exist in archive",
"we don't know the decryption seed",
"error on unpacking file"];
public int errno;
this(char[] fnname = "unknown_function", int errno = 0) {
this.errno = errno;
if (-errno >= Errors.length)
errno = 0;
super(std.string.format("Error in %s(): %s (%d)",
fnname, Errors[-errno], errno));
}
}
/** template to wrap function calls and throw exceptions in case of error
*
* thanks for the idea to while(nan) blog,
* http://while-nan.blogspot.com/2007/06/wrapping-functions-for-fun-and-profit.html
*
* use: MPQ_CHECKERR(libmpq__archive_open)(&m, "foo.mpq", -1);
* returns the retval of archive_open on success;
* throws an MPQException on failure.
*
* @param Fn libmpq__function reference
* @param args libmpq__function parameters
* @return return value of libmpq__function on success
* @throw MPQException on error
*/
int MPQ_CHECKERR(alias Fn)(ParameterTypeTuple!(Fn) args)
{
int result = Fn(args);
if (result < 0) {
/* XXX: relying on non-specified stringof() behaviour */
throw new MPQException((&Fn).stringof[2..$], result);
}
return result;
}
/** mixin alias to wrap library functions into MPQ_CHECKERR.
*
* alias mpq.func_name(...) to MPQ_CHECKERR(libmpq__func_name)(...)
* @param func_name name of the function to be wrapped
*/
template MPQ_FUNC(char[] func_name) {
const char[] MPQ_FUNC = "alias MPQ_CHECKERR!(libmpq__" ~ func_name ~ ") " ~ func_name ~ ";";
}
alias libmpq__version libversion; /* must be direct alias because it returns char*, not error int */
mixin(MPQ_FUNC!("archive_open"));
mixin(MPQ_FUNC!("archive_close"));
mixin(MPQ_FUNC!("archive_packed_size"));
mixin(MPQ_FUNC!("archive_unpacked_size"));
mixin(MPQ_FUNC!("archive_offset"));
mixin(MPQ_FUNC!("archive_version"));
mixin(MPQ_FUNC!("archive_files"));
mixin(MPQ_FUNC!("file_packed_size"));
mixin(MPQ_FUNC!("file_unpacked_size"));
mixin(MPQ_FUNC!("file_offset"));
mixin(MPQ_FUNC!("file_blocks"));
mixin(MPQ_FUNC!("file_encrypted"));
mixin(MPQ_FUNC!("file_compressed"));
mixin(MPQ_FUNC!("file_imploded"));
mixin(MPQ_FUNC!("file_number"));
mixin(MPQ_FUNC!("file_read"));
mixin(MPQ_FUNC!("block_open_offset"));
mixin(MPQ_FUNC!("block_close_offset"));
mixin(MPQ_FUNC!("block_unpacked_size"));
mixin(MPQ_FUNC!("block_read"));
/** getter function named name for returning archive_* single values:
*
* <type> Archive.<name>() { return libmpq__archive_<name>() }
*
* @param type return type for the original function reference
* @param name name of the original function
* @param name2 name for the prototype (defaults to name, used for "version")
* @return getter function mixin
*/
template MPQ_A_GET(char[] type, char[] name, char[] name2 = name) {
const char[] MPQ_A_GET = type ~ " " ~ name2 ~ "() { " ~
type ~ " ret; " ~
"archive_" ~ name ~ "(m, &ret); return ret;" ~
"}";
}
/** wrapper class for an MPQ Archive
*
* syntax: auto a = new mpq.Archive("somefile.mpq");
*/
class Archive {
mpq_archive_s *m;
File listfile;
char[][] listfiledata;
this(char[] archivename, off_t offset = -1) {
archive_open(&m, toStringz(archivename), offset);
}
mixin(MPQ_A_GET!("off_t", "packed_size"));
mixin(MPQ_A_GET!("off_t", "unpacked_size"));
mixin(MPQ_A_GET!("off_t", "offset"));
mixin(MPQ_A_GET!("uint", "version", "version_"));
mixin(MPQ_A_GET!("uint", "files"));
~this() {
archive_close(m);
}
mpq_archive_s* archive() {
return m;
}
File opIndex(char[] fname) {
return new File(this, fname);
}
File opIndex(int fno) {
return new File(this, fno);
}
char[][] filelist() {
try {
if (!listfile) {
listfile = this["(listfile)"];
listfiledata = (cast(char[])listfile.read()).splitlines();
}
return listfiledata;
} catch (MPQException e) {
return [];
}
}
/+uint filenumber(char[] filename) {
try {
if (!listfile) {
listfile = this["(listfile)"];
listfiledata = (cast(char[])listfile.read()).splitlines();
}
return listfiledata;
} catch (MPQException e) {
return [];
}
}+/
}
/** getter function named name for returning file_* single values:
*
* <type> File.<name>() { return libmpq__file_<name>() }
*
* @param type return type for the original function reference
* @param name name of the original function
* @param name2 name for the prototype (defaults to name, used for "version")
* @return getter function mixin
*/
template MPQ_F_GET(char[] type, char[] name, char[] name2 = name) {
const char[] MPQ_F_GET = type ~ " " ~ name2 ~ "() { " ~
type ~ " ret; " ~
"file_" ~ name ~ "(am, fileno, &ret); " ~
"return ret;" ~
"}";
}
/** wrapper class for a single file in an MPQ Archive
*
* syntax:
* auto a = new mpq.Archive("somefile.mpq");
* auto f = a["(listfile)"];
* auto f2 = a[0];
* auto f3 = new File(a, "(listfile)");
*/
class File {
Archive a;
mpq_archive_s* am;
char[] filename;
uint fileno;
this(Archive a, int fileno) {
this.a = a;
this.am = a.archive();
if (fileno >= a.files) {
throw new MPQException(format("File(%d)", fileno),
LIBMPQ_ERROR_EXIST);
}
this.filename = format("file%04d.xxx", fileno);
this.fileno = fileno;
}
this(Archive a, char[] filename) {
this.a = a;
this.am = a.archive();
this.filename = filename;
/* this line will throw an exception when the file is not there */
mpq.file_number(am, toStringz(filename), &this.fileno);
}
mixin(MPQ_F_GET!("off_t", "packed_size"));
mixin(MPQ_F_GET!("off_t", "unpacked_size"));
mixin(MPQ_F_GET!("off_t", "offset"));
mixin(MPQ_F_GET!("uint", "blocks"));
mixin(MPQ_F_GET!("uint", "encrypted"));
mixin(MPQ_F_GET!("uint", "compressed"));
mixin(MPQ_F_GET!("uint", "imploded"));
uint no() { return fileno; }
char[] name() { return filename; }
ubyte[] read() {
ubyte[] content;
content.length = this.unpacked_size();
off_t trans;
mpq.file_read(am, fileno, content.ptr, content.length, &trans);
content.length = trans;
return content;
}
}

23
samples/DTrace/counts.d Normal file
View File

@@ -0,0 +1,23 @@
/*
* This software is in the public domain.
*
* $Id: counts.d 10510 2005-08-15 01:46:19Z kateturner $
*/
#pragma D option quiet
self int tottime;
BEGIN {
tottime = timestamp;
}
php$target:::function-entry
@counts[copyinstr(arg0)] = count();
}
END {
printf("Total time: %dus\n", (timestamp - tottime) / 1000);
printf("# calls by function:\n");
printa("%-40s %@d\n", @counts);
}

View File

@@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Copyright (C) 2007 Sun Microsystems, Inc. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* javascript provider probes
*
* function-entry (filename, classname, funcname)
* function-info (filename, classname, funcname, lineno,
* runfilename, runlineno)
* function-args (filename, classname, funcname, argc, argv, argv0,
* argv1, argv2, argv3, argv4)
* function-rval (filename, classname, funcname, lineno, rval, rval0)
* function-return (filename, classname, funcname)
* object-create-start (filename, classname)
* object-create (filename, classname, *object, rlineno)
* object-create-done (filename, classname)
* object-finalize (NULL, classname, *object)
* execute-start (filename, lineno)
* execute-done (filename, lineno)
*/
provider javascript {
probe function__entry(char *, char *, char *);
probe function__info(char *, char *, char *, int, char *, int);
probe function__args(char *, char *, char *, int, void *, void *, void *,
void *, void *, void *);
probe function__rval(char *, char *, char *, int, void *, void *);
probe function__return(char *, char *, char *);
probe object__create__start(char *, char *);
probe object__create__done(char *, char *);
/* XXX must use unsigned longs here instead of uintptr_t for OS X
(Apple radar: 5194316 & 5565198) */
probe object__create(char *, char *, unsigned long, int);
probe object__finalize(char *, char *, unsigned long);
probe execute__start(char *, int);
probe execute__done(char *, int);
};
/*
#pragma D attributes Unstable/Unstable/Common provider mozilla provider
#pragma D attributes Private/Private/Unknown provider mozilla module
#pragma D attributes Private/Private/Unknown provider mozilla function
#pragma D attributes Unstable/Unstable/Common provider mozilla name
#pragma D attributes Unstable/Unstable/Common provider mozilla args
*/

93
samples/DTrace/probes.d Normal file
View File

@@ -0,0 +1,93 @@
/* ----------
* DTrace probes for PostgreSQL backend
*
* Copyright (c) 2006-2009, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.11 2009/04/02 20:59:10 momjian Exp $
* ----------
*/
/*
* Typedefs used in PostgreSQL.
*
* NOTE: Do not use system-provided typedefs (e.g. uintptr_t, uint32_t, etc)
* in probe definitions, as they cause compilation errors on Mac OS X 10.5.
*/
#define LocalTransactionId unsigned int
#define LWLockId int
#define LWLockMode int
#define LOCKMODE int
#define BlockNumber unsigned int
#define Oid unsigned int
#define ForkNumber int
#define bool char
provider postgresql {
probe transaction__start(LocalTransactionId);
probe transaction__commit(LocalTransactionId);
probe transaction__abort(LocalTransactionId);
probe lwlock__acquire(LWLockId, LWLockMode);
probe lwlock__release(LWLockId);
probe lwlock__wait__start(LWLockId, LWLockMode);
probe lwlock__wait__done(LWLockId, LWLockMode);
probe lwlock__condacquire(LWLockId, LWLockMode);
probe lwlock__condacquire__fail(LWLockId, LWLockMode);
probe lock__wait__start(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
probe lock__wait__done(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
probe query__parse__start(const char *);
probe query__parse__done(const char *);
probe query__rewrite__start(const char *);
probe query__rewrite__done(const char *);
probe query__plan__start();
probe query__plan__done();
probe query__execute__start();
probe query__execute__done();
probe query__start(const char *);
probe query__done(const char *);
probe statement__status(const char *);
probe sort__start(int, bool, int, int, bool);
probe sort__done(bool, long);
probe buffer__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool);
probe buffer__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool, bool);
probe buffer__flush__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe buffer__flush__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe buffer__checkpoint__start(int);
probe buffer__checkpoint__sync__start();
probe buffer__checkpoint__done();
probe buffer__sync__start(int, int);
probe buffer__sync__written(int);
probe buffer__sync__done(int, int, int);
probe buffer__write__dirty__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe buffer__write__dirty__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe deadlock__found();
probe checkpoint__start(int);
probe checkpoint__done(int, int, int, int, int);
probe clog__checkpoint__start(bool);
probe clog__checkpoint__done(bool);
probe subtrans__checkpoint__start(bool);
probe subtrans__checkpoint__done(bool);
probe multixact__checkpoint__start(bool);
probe multixact__checkpoint__done(bool);
probe twophase__checkpoint__start();
probe twophase__checkpoint__done();
probe smgr__md__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe smgr__md__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int);
probe smgr__md__write__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe smgr__md__write__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int);
probe xlog__insert(unsigned char, unsigned char);
probe xlog__switch();
probe wal__buffer__write__dirty__start();
probe wal__buffer__write__dirty__done();
};

View File

@@ -0,0 +1,71 @@
update=Sun 15 Feb 2015 01:10:10 PM EST
last_client=eeschema
[pcbnew]
version=1
PageLayoutDescrFile=
LastNetListRead=
UseCmpFile=1
PadDrill=0.6
PadDrillOvalY=0.6
PadSizeH=1.5
PadSizeV=1.5
PcbTextSizeV=1.5
PcbTextSizeH=1.5
PcbTextThickness=0.3
ModuleTextSizeV=1
ModuleTextSizeH=1
ModuleTextSizeThickness=0.15
SolderMaskClearance=0
SolderMaskMinWidth=0
DrawSegmentWidth=0.2
BoardOutlineThickness=0.09999999999999999
ModuleOutlineThickness=0.15
[pcbnew/libraries]
LibDir=
[general]
version=1
[eeschema]
version=1
PageLayoutDescrFile=
SubpartIdSeparator=0
SubpartFirstId=65
LibDir=/home/hschmale/KiCad/LibMods-3rdParty
NetFmtName=
RptD_X=0
RptD_Y=100
RptLab=1
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
LibName31=arduino_shieldsNCL
LibName32=con-usb-2
LibName33=2axispotwselect

278
samples/MUF/39.m Normal file
View File

@@ -0,0 +1,278 @@
$include $lib/strings
$include $lib/match
lvar check-obj-addr
: check-next-loop (d -- )
dup not if pop exit then
dup exit? over thing? or
me @ 3 pick .controls and if
dup check-obj-addr @ execute
then
next check-next-loop
;
: check-contents (d -- )
contents check-next-loop
;
: check-exits (d -- )
exits check-next-loop
;
: exec-err (d mtypestr warnstr -- )
"On " 4 rotate unparseobj strcat
", in it's " strcat rot strcat
", " strcat swap strcat .tell
;
: can-linkto? (player object -- i)
dup "link_ok" flag? if pop pop 1 exit then
.controls
;
: check-exec (d mtype execstr -- )
dup "@" 1 strncmp if pop pop pop exit then
1 strcut swap pop
" " .split pop
dup "$" 1 strncmp not if
dup match ok? not if
" is not a known registered program." strcat
exec-err exit
then
dup match program? not if
" is not a program." strcat
exec-err exit
then
3 pick owner over match can-linkto? not if
" is not Link_OK." strcat
exec-err exit
then
else
dup number? not if
" is not a program dbref." strcat
"@" swap strcat exec-err exit
then
dup atoi dbref ok? not if
" is not a valid program reference." strcat
"@" swap strcat exec-err exit
then
dup atoi dbref program? not if
" is not a valid program reference." strcat
"@" swap strcat exec-err exit
then
3 pick owner over atoi dbref can-linkto? not if
" is not Link_OK." strcat
"@" swap strcat exec-err exit
then
then
pop pop pop
;
: missing-err ( d s -- )
swap unparseobj
" is missing an "
strcat swap strcat
" message." strcat .tell
;
: colon-err ( d s -- )
swap unparseobj
" has an unnecesary ':' at the start of its "
strcat swap strcat
" message." strcat .tell
;
: check-desc (d -- )
dup desc not if
"@description" missing-err
else
"@description" over
desc check-exec
then
;
: check-succ (d -- )
dup succ not if
"@success" missing-err
else
"@success" over
succ check-exec
then
;
: check-fail (d -- )
dup fail not if
"@fail" missing-err
else
"@fail" over
fail check-exec
then
;
: check-drop (d -- )
dup drop not if
"@drop" missing-err
else
"@drop" over
drop check-exec
then
;
: check-osucc (d -- )
dup osucc not if
"@osuccess" missing-err
else
dup osucc ":" 1 strncmp not if
"@osuccess" colon-err
else pop
then
then
;
: check-ofail (d -- )
dup ofail not if
"@ofail" missing-err
else
dup ofail ":" 1 strncmp not if
"@ofail" colon-err
else pop
then
then
;
: check-odrop (d -- )
dup odrop not if
"@odrop" missing-err
else
dup odrop ":" 1 strncmp not if
"@odrop" colon-err
else pop
then
then
;
$define islocked? (d -- i) getlockstr "*UNLOCKED*" stringcmp $enddef
: islocked_always? (d -- i)
getlockstr dup "#0" stringcmp not if pop 1 exit then
dup "#" STRsplit swap pop atoi
"#" swap intostr strcat
(lockstr "#dbref")
dup "&!" over strcat strcat
3 pick stringcmp not if pop pop 1 exit then
"&" over strcat strcat "!" swap strcat
stringcmp not if 1 exit then
0
;
: check-link ( d -- )
dup getlink not if
dup unparseobj " is unlinked." strcat .tell
else
dup getlink over location dbcmp if
dup islocked? not if
dup unparseobj
" is linked to it's location, but is unlocked."
strcat .tell
then
else (is not linked to it's location)
dup getlink program? if
dup dup owner swap getlink can-linkto? not if
dup unparseobj
" is linked to a program which is not Link_OK."
strcat .tell
then
then
then
then
pop
;
: check-room (d -- )
dup check-desc
dup islocked? if
dup islocked_always? not if
dup check-succ
then
dup check-fail
then
dup getlink if
dup check-drop
dup check-odrop
then
dup check-contents
check-exits
;
: check-exit ( d -- )
dup check-link
dup check-desc
dup getlink dup ok? if
program? not if
dup islocked_always? not if
dup check-succ
dup check-osucc
dup check-odrop
then
dup islocked? if
dup check-fail
dup check-ofail
then
then
else pop
then
pop
;
: check-thing ( d -- )
dup check-desc
dup islocked_always? not if
dup check-succ
dup check-osucc
then
dup islocked? if
dup check-fail
dup check-ofail
then
dup check-drop
dup check-odrop
check-exits
;
: check-player ( d -- )
dup check-desc
dup islocked_always? not if
dup check-succ
dup check-osucc
then
dup islocked? if
dup check-fail
dup check-ofail
then
dup check-contents
check-exits
;
: check-program ( d -- )
check-desc
;
: check-obj (d -- )
dup room? if check-room exit then
dup exit? if check-exit exit then
dup thing? if check-thing exit then
dup player? if check-player exit then
check-program
;
: main
'check-obj check-obj-addr !
.strip dup not if pop "here" then
.match_controlled
dup #-3 dbcmp if pop me @ getlink then
dup ok? not if pop exit then
check-obj
me @ "Check done." notify
;

275
samples/MUF/cmd-say.muf Normal file
View File

@@ -0,0 +1,275 @@
@program cmd-say.muf
1 1000 d
i
( cmd-say.muf by Natasha@HLM
Copyright 2002-2004 Natasha Snunkmeox. Copyright 2002-2004 Here Lie Monsters.
"@view $box/mit" for license information.
)
$author Natasha Snunkmeox <natmeox@neologasm.org>
$note Say for Fuzzball 6.
$version 1.0
$include $lib/ignore
$include $lib/strings
$include $lib/match
$def str_program "saypose"
$def prop_third "_prefs/say/third"
$def prop_quotes "_say/def/quotes"
$def prop_overb "_say/def/osay"
$def prop_verb "_say/def/say"
$def prop_split "_prefs/say/split"
$def prop_color "_prefs/say/color"
$def prop_meow "_prefs/say/meow"
lvar randomWord
lvar verb
lvar overb
lvar lquo
lvar rquo
lvar splitsay
: rtn-getThirdVerb[ var:overb -- ]
( Get the third-person verb. )
me @ prop_overb getpropstr dup if ( str strOverb )
strip dup dup "," instr not and if "," strcat then
else pop "says," then ( str strOverb )
me @ "%D %s" fmtstring overb @ ! ( str )
;
: rtn-getFirstVerb[ var:verb var:overb -- ]
me @ prop_third getpropstr .yes? not if ( str )
( Get the first-person verb. )
me @ prop_verb getpropstr dup if ( str strVerb )
strip dup dup "," instr not and if "," strcat then
else pop "say," then ( str strVerb )
splitsay @ if "you %s" else "You %s" then fmtstring ( str strVerb )
else overb @ @ then verb @ ! ( str )
;
: rtn-getQuotes[ var:lquo var:rquo -- ]
me @ prop_quotes getpropstr dup "%m" instr if ( strQuotes )
"%m" split ( strLquo strRquo )
else pop "\"" dup then ( strLquo strRquo )
rquo @ ! lquo @ ! ( )
;
: do-say ( str -- )
"" randomWord !
var who
var exclude
( Ignoring? Get 'em outta here. )
loc @ contents_array ( str arrHere )
dup me @ str_program array_get_ignorers ( str arrHere arrIgnorers )
dup exclude !
swap array_diff who !
( Anyone #meowing this player? Go ahead and notify before special formatting. )
who @ prop_meow me @ owner "*{%d}*" fmtstring array_filter_prop ( str arrMeow )
dup if ( str arrMeow )
dup who @ array_diff who ! ( str arrMeow )
dup exclude @ array_union exclude ! ( str arrMeow )
over ansi_strip ( str arrMeow str )
"\\b[A-Z0-9_]+\\b" "MEOW" REG_ALL regsub ( str arrMeow str' )
"\\b[A-Z0-9_][A-Za-z0-9_]*[a-z][A-Za-z0-9_]*\\b" "Meow" REG_ALL regsub ( str arrMeow str' )
"\\b[a-z_][A-Za-z0-9_]*\\b" "meow" REG_ALL regsub ( str arrMeow str' )
me @ "%D meows, \"%s\"" fmtstring ( str arrMeow str" )
1 array_make swap array_notify ( str )
else pop then ( str )
var msg
dup ",," instr ( str boolCommas )
me @ prop_split getpropstr .no? not ( str boolCommas boolSplitOK )
and if ( str )
",," split ( str- -str )
( User-supplied verb? )
dup ",," instr if
",," split ( str- strVerb -str )
swap dup if ( str- -str strVerb )
strip ( str- -str strVerb )
dup me @ name instr over tolower "%n" instr or if ( str- -str strVerb )
"%n" "%N" subst me @ name "%n" subst ( str- -str strVerb )
else
me @ swap "%s %D," fmtstring ( str- -str -str- )
then ( str- -str -str- )
dup "*[-!.,:;]" smatch not if "," strcat then ( str- -str -str- )
dup verb ! overb ! ( str- -str )
else pop then ( str- -str )
then ( str- -str )
2 array_make ( arrMsg )
1
else 0 then splitsay ! msg !
verb @ string? not if
overb rtn-getThirdVerb
verb overb rtn-getFirstVerb
then
lquo rquo rtn-getQuotes ( str )
( Say. )
msg @ string? if
rquo @ msg @ lquo @ ( strRquo strMsg strLquo )
"%s %s%s%s" ( strRquo strMsg strLquo strFormat )
4 dupn
verb @ swap fmtstring .tell ( strRquo strMsg strLquo strFormat )
overb @ swap fmtstring ( strOsay )
else
rquo @ msg @ array_vals pop ( strRquo strMsg strMsg2 )
swap dup "*[-!.,:;]" smatch not if "," strcat then swap ( strRquo strMsg strMsg2 )
( Only handle strMsg if there's no strMsg2. )
dup if ( strRquo strMsg strMsg2 )
swap ( strRquo strMsg2 strMsg )
lquo @ swap rquo @ swap lquo @ ( strRquo strMsg2 strLquo strRquo strMsg' strLquo )
"%s%s%s %s %s%s%s" ( strRquo strMsg2 strLquo strRquo strMsg' strLquo strFormat )
7
else ( strRquo strMsg strMsg2 )
pop lquo @ ( strRquo strMsg' strLquo )
"%s%s%s %s" ( strRquo strMsg' strLquo strFormat )
verb @ ",$" "." 0 regsub verb !
overb @ ",$" "." 0 regsub overb !
4
then ( ... strRquo strMsg strLquo strFormat intDepth )
dupn
verb @ -5 rotate fmtstring .tell ( ... strRquo strMsg strLquo strFormat )
overb @ -5 rotate fmtstring ( strOsay )
then ( strOsay )
( Is there color to avoid? )
dup "\[[" instr if
who @ prop_color "{n*|0}" array_filter_prop ( strOsay arrGreyed )
dup if ( strOsay arrGreyed )
over ansi_strip 1 array_make ( strOsay arrGreyed arrMsg )
over array_notify ( strOsay arrGreyed )
exclude @ array_union exclude ! ( strOsay )
else pop then ( strOsay )
then ( strOsay )
loc @ ( strOsay db )
exclude @ array_vals ( strOsay db dbExcludeN..dbExclude1 intN )
me @ swap ++ ( strOsay db dbGreyedN..dbGreyed1' intN' )
dup 3 + rotate ( db dbGreyedN..dbGreyed1 intN strOsay )
notify_exclude ( )
;
: do-help pop pop .showhelp ;
: do-ignore pop str_program cmd-ignore-add ;
: do-unignore pop str_program cmd-ignore-del ;
: do-third ( strY strZ -- )
pop pop ( )
me @ prop_third "yes" setprop
me @ "You will see your own says in the third person (\"%D says\")." fmtstring .tellgood
;
: do-unthird ( strY strZ -- )
pop pop ( )
me @ prop_third remove_prop
"You will see your own says in the second person (\"You say\")." .tellgood
;
: do-grey ( strY strZ -- )
pop pop ( )
me @ prop_color "no" setprop
me @ "You will not see color in any says. Note you will see color in your own says." fmtstring .tellgood
;
: do-ungrey ( strY strZ -- )
pop pop ( )
me @ prop_color remove_prop
"You will see color in says." .tellgood
;
: do-meow ( strY strZ -- )
pop ( strY )
dup if
.noisy_pmatch dup ok? not if pop exit then ( db )
me @ prop_meow 3 pick reflist_find if ( db )
"%D is already in your #meow list." fmtstring .tellbad exit ( )
then ( db )
me @ prop_meow 3 pick reflist_add ( db )
"%D added." fmtstring .tellgood
else
me @ prop_meow array_get_reflist ( arr )
"" swap foreach swap pop "%D %s" fmtstring repeat
"Your meowlist: " swap strcat .tellgood
then
;
: do-unmeow ( strY strZ -- )
pop ( strY )
.noisy_pmatch dup ok? not if pop exit then ( db )
me @ prop_meow 3 pick reflist_find not if ( db )
"%D is not in your #meow list." fmtstring .tellbad exit ( )
then ( db )
me @ prop_meow 3 pick reflist_del ( db )
"%D removed." fmtstring .tellgood
;
$define dict_commands {
"help" 'do-help
"ignore" 'do-ignore
"!ignore" 'do-unignore
"meow" 'do-meow
"!meow" 'do-unmeow
"third" 'do-third
"!third" 'do-unthird
"grey" 'do-grey
"gray" 'do-grey
"!grey" 'do-ungrey
"!gray" 'do-ungrey
}dict $enddef
: main ( str -- )
dup STRparse ( str strX strY strZ )
3 pick string? if 3 pick "#" stringpfx if ( str strX strY strZ )
pop pop pop ( str )
"#" split strcat ( str' )
do-say exit ( )
then then
3 pick int? if pop pop pop do-say exit then
4 rotate pop ( strX strY strZ )
rot dict_commands over array_getitem ( strY strZ strX ? )
dup address? if ( strY strZ strX adr )
swap pop ( strY strZ adr )
execute ( )
else pop ( strY strZ strX )
"I don't recognize the command '#%s'. Try 'say #help' for help, or using '##' to say something starting with '#'." fmtstring .tellbad ( strY strZ )
pop pop ( )
then ( )
;
.
c
q
lsedit #257=_help
.del 1 $
say <message>
."<message>
say #[!]ignore <names>
say #[!]third
say #[!]grey
say #[!]meow <names>
Speaks <message> to the room. Use #ignore <name> to not see <name>'s says, poses, and spoofs; use #meow <name> to see <name>'s says with all the words replaced with "meow." Use #third to see your own says in the third person (that is, "Puck says" instead of the normal "You say"). Use #grey to turn off color in others' says and poses.
Say supports a "split" say if you put two consecutive commas in your message. For example, if CobaltBlue typed '"Hello,,how are you?' everyone would see '"Hello," says CobaltBlue, "how are you?"' You can also specify an "ad-hoc" verb by putting a message with your name or '%N' between pairs of commas: '"Hello,,%N welcomes Weiran,,how are you?' would display '"Hello," CobaltBlue welcomes Weiran, "how are you?"'
.format 10=78
.format 8=78
.end

5
samples/Makefile/foo.o.d Normal file
View File

@@ -0,0 +1,5 @@
bar/foo.o: \
bar/foo.c \
bar/baz.h
bar/baz.h:

View File

@@ -0,0 +1,150 @@
(* ::Package:: *)
BeginPackage["Predicates`"];
(* ::Title:: *)
(*Predicates*)
(* ::Section::Closed:: *)
(*Fuzzy Logic*)
(* ::Subsection:: *)
(*Documentation*)
PossiblyTrueQ::usage="Returns True if the argument is not definitely False.";
PossiblyFalseQ::usage="Returns True if the argument is not definitely True.";
PossiblyNonzeroQ::usage="Returns True if and only if its argument is not definitely zero.";
(* ::Subsection:: *)
(*Implimentation*)
Begin["`Private`"];
PossiblyTrueQ[expr_]:=\[Not]TrueQ[\[Not]expr]
PossiblyFalseQ[expr_]:=\[Not]TrueQ[expr]
End[];
(* ::Section::Closed:: *)
(*Numbers and Lists*)
(* ::Subsection:: *)
(*Documentation*)
AnyQ::usage="Given a predicate and a list, retuns True if and only if that predicate is True for at least one element of the list.";
AnyElementQ::usage="Returns True if cond matches any element of L.";
AllQ::usage="Given a predicate and a list, retuns True if and only if that predicate is True for all elements of the list.";
AllElementQ::usage="Returns True if cond matches any element of L.";
AnyNonzeroQ::usage="Returns True if L is a list such that at least one element is definitely not zero.";
AnyPossiblyNonzeroQ::usage="Returns True if expr is a list such that at least one element is not definitely zero.";
RealQ::usage="Returns True if and only if the argument is a real number";
PositiveQ::usage="Returns True if and only if the argument is a positive real number";
NonnegativeQ::usage="Returns True if and only if the argument is a non-negative real number";
PositiveIntegerQ::usage="Returns True if and only if the argument is a positive integer";
NonnegativeIntegerQ::usage="Returns True if and only if the argument is a non-negative integer";
IntegerListQ::usage="Returns True if and only if the input is a list of integers.";
PositiveIntegerListQ::usage="Returns True if and only if the input is a list of positive integers.";
NonnegativeIntegerListQ::usage="Returns True if and only if the input is a list of non-negative integers.";
IntegerOrListQ::usage="Returns True if and only if the input is a list of integers or an integer.";
PositiveIntegerOrListQ::usage="Returns True if and only if the input is a list of positive integers or a positive integer.";
NonnegativeIntegerOrListQ::usage="Returns True if and only if the input is a list of positive integers or a positive integer.";
SymbolQ::usage="Returns True if argument is an unassigned symbol.";
SymbolOrNumberQ::usage="Returns True if argument is a number of has head 'Symbol'";
(* ::Subsection:: *)
(*Implimentation*)
Begin["`Private`"];
AnyQ[cond_, L_] := Fold[Or, False, cond /@ L]
AnyElementQ[cond_,L_]:=AnyQ[cond,Flatten[L]]
AllQ[cond_, L_] := Fold[And, True, cond /@ L]
AllElementQ[cond_, L_] := Fold[And, True, cond /@ L]
AnyNonzeroQ[L_]:=AnyElementQ[#!=0&,L]
PossiblyNonzeroQ[expr_]:=PossiblyTrueQ[expr!=0]
AnyPossiblyNonzeroQ[expr_]:=AnyElementQ[PossiblyNonzeroQ,expr]
RealQ[n_]:=TrueQ[Im[n]==0];
PositiveQ[n_]:=Positive[n];
PositiveIntegerQ[n_]:=PositiveQ[n]\[And]IntegerQ[n];
NonnegativeQ[n_]:=TrueQ[RealQ[n]&&n>=0];
NonnegativeIntegerQ[n_]:=NonnegativeQ[n]\[And]IntegerQ[n];
IntegerListQ[input_]:=ListQ[input]&&Not[MemberQ[IntegerQ/@input,False]];
IntegerOrListQ[input_]:=IntegerListQ[input]||IntegerQ[input];
PositiveIntegerListQ[input_]:=IntegerListQ[input]&&Not[MemberQ[Positive[input],False]];
PositiveIntegerOrListQ[input_]:=PositiveIntegerListQ[input]||PositiveIntegerQ[input];
NonnegativeIntegerListQ[input_]:=IntegerListQ[input]&&Not[MemberQ[NonnegativeIntegerQ[input],False]];
NonnegativeIntegerOrListQ[input_]:=NonnegativeIntegerListQ[input]||NonnegativeIntegerQ[input];
SymbolQ[a_]:=Head[a]===Symbol;
SymbolOrNumberQ[a_]:=NumericQ[a]||Head[a]===Symbol;
End[];
(* ::Section:: *)
(*Epilogue*)
EndPackage[];

View File

@@ -0,0 +1,17 @@
BeginTestSection["Untitled-5"]
VerificationTest[(* 1 *)
RotationMatrix[phi]
,
List[List[Cos[phi], Times[-1, Sin[phi]]], List[Sin[phi], Cos[phi]]]
]
VerificationTest[(* 2 *)
Times[1, Power[Plus[a, Times[-1, a]], -1]]
,
ComplexInfinity
,
{Power::infy}
]
EndTestSection[]

View File

@@ -60,11 +60,13 @@ class TestHeuristcs < Minitest::Test
})
end
# Candidate languages = ["IDL", "Prolog"]
def test_pro_prolog_idl_by_heuristics
# Candidate languages = ["IDL", "Prolog", "QMake", "INI"]
def test_pro_by_heuristics
assert_heuristics({
"Prolog" => "Prolog/logic-problem.pro",
"IDL" => "IDL/mg_acosh.pro"
"Prolog" => all_fixtures("Prolog", "*.pro"),
"IDL" => all_fixtures("IDL", "*.pro"),
"INI" => all_fixtures("INI", "*.pro"),
"QMake" => all_fixtures("QMake", "*.pro")
})
end

View File

@@ -188,7 +188,7 @@ class TestLanguage < Minitest::Test
assert_equal [], Language.find_by_extension('foo.rb')
assert_equal [Language['Ruby']], Language.find_by_extension('rb')
assert_equal [Language['Ruby']], Language.find_by_extension('.rb')
assert_equal [Language['M'], Language['Mathematica'], Language['Matlab'], Language['Mercury'], Language['Objective-C']], Language.find_by_extension('.m')
assert_equal [Language['M'], Language['MUF'], Language['Mathematica'], Language['Matlab'], Language['Mercury'], Language['Objective-C']], Language.find_by_extension('.m')
end
def test_find_all_by_extension