code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
multiline_comment|/*&n; * Check-out files from the "current cache directory"&n; *&n; * Copyright (C) 2005 Linus Torvalds&n; *&n; */ macro_line|#include "builtin.h" macro_line|#include "lockfile.h" macro_line|#include "quote.h" macro_line|#include "cache-tree.h" macro_line|#include "parse-options.h" DECL|macro|CHECKOUT_ALL mdefine_line|#define CHECKOUT_ALL 4 DECL|variable|line_termination r_static r_int id|line_termination op_assign l_char|&squot;&bslash;n&squot; suffix:semicolon DECL|variable|checkout_stage r_static r_int id|checkout_stage suffix:semicolon multiline_comment|/* default to checkout stage0 */ DECL|variable|to_tempfile r_static r_int id|to_tempfile suffix:semicolon DECL|variable|topath r_static r_char id|topath (braket l_int|4 )braket (braket id|TEMPORARY_FILENAME_LENGTH op_plus l_int|1 )braket suffix:semicolon DECL|variable|state r_static r_struct id|checkout id|state suffix:semicolon DECL|function|write_tempfile_record r_static r_void id|write_tempfile_record c_func (paren r_const r_char op_star id|name comma r_const r_char op_star id|prefix )paren (brace r_int id|i suffix:semicolon r_if c_cond (paren id|CHECKOUT_ALL op_eq id|checkout_stage )paren (brace r_for c_loop (paren id|i op_assign l_int|1 suffix:semicolon id|i OL l_int|4 suffix:semicolon id|i op_increment )paren (brace r_if c_cond (paren id|i OG l_int|1 )paren id|putchar c_func (paren l_char|&squot; &squot; )paren suffix:semicolon r_if c_cond (paren id|topath (braket id|i )braket (braket l_int|0 )braket )paren id|fputs c_func (paren id|topath (braket id|i )braket comma id|stdout )paren suffix:semicolon r_else id|putchar c_func (paren l_char|&squot;.&squot; )paren suffix:semicolon )brace )brace r_else id|fputs c_func (paren id|topath (braket id|checkout_stage )braket comma id|stdout )paren suffix:semicolon id|putchar c_func (paren l_char|&squot;&bslash;t&squot; )paren suffix:semicolon id|write_name_quoted_relative c_func (paren id|name comma id|prefix comma id|stdout comma id|line_termination )paren suffix:semicolon r_for c_loop (paren id|i op_assign l_int|0 suffix:semicolon id|i OL l_int|4 suffix:semicolon id|i op_increment )paren (brace id|topath (braket id|i )braket (braket l_int|0 )braket op_assign l_int|0 suffix:semicolon )brace )brace DECL|function|checkout_file r_static r_int id|checkout_file c_func (paren r_const r_char op_star id|name comma r_const r_char op_star id|prefix )paren (brace r_int id|namelen op_assign id|strlen c_func (paren id|name )paren suffix:semicolon r_int id|pos op_assign id|cache_name_pos c_func (paren id|name comma id|namelen )paren suffix:semicolon r_int id|has_same_name op_assign l_int|0 suffix:semicolon r_int id|did_checkout op_assign l_int|0 suffix:semicolon r_int id|errs op_assign l_int|0 suffix:semicolon r_if c_cond (paren id|pos OL l_int|0 )paren id|pos op_assign id|pos l_int|1 suffix:semicolon r_while c_loop (paren id|pos OL id|active_nr )paren (brace r_struct id|cache_entry op_star id|ce op_assign id|active_cache (braket id|pos )braket suffix:semicolon r_if c_cond (paren id|ce_namelen c_func (paren id|ce )paren op_ne id|namelen op_logical_or id|memcmp c_func (paren id|ce->name comma id|name comma id|namelen )paren )paren r_break suffix:semicolon id|has_same_name op_assign l_int|1 suffix:semicolon id|pos op_increment suffix:semicolon r_if c_cond (paren id|ce_stage c_func (paren id|ce )paren op_ne id|checkout_stage op_logical_and (paren id|CHECKOUT_ALL op_ne id|checkout_stage op_logical_or op_logical_neg id|ce_stage c_func (paren id|ce )paren )paren )paren r_continue suffix:semicolon id|did_checkout op_assign l_int|1 suffix:semicolon r_if c_cond (paren id|checkout_entry c_func (paren id|ce comma op_amp id|state comma id|to_tempfile ques c_cond id|topath (braket id|ce_stage c_func (paren id|ce )paren )braket suffix:colon l_int|NULL )paren OL l_int|0 )paren id|errs op_increment suffix:semicolon )brace r_if c_cond (paren id|did_checkout )paren (brace r_if c_cond (paren id|to_tempfile )paren id|write_tempfile_record c_func (paren id|name comma id|prefix )paren suffix:semicolon r_return id|errs OG l_int|0 ques c_cond l_int|1 suffix:colon l_int|0 suffix:semicolon )brace r_if c_cond (paren op_logical_neg id|state.quiet )paren (brace id|fprintf c_func (paren id|stderr comma l_string|"git checkout-index: %s " comma id|name )paren suffix:semicolon r_if c_cond (paren op_logical_neg id|has_same_name )paren id|fprintf c_func (paren id|stderr comma l_string|"is not in the cache" )paren suffix:semicolon r_else r_if c_cond (paren id|checkout_stage )paren id|fprintf c_func (paren id|stderr comma l_string|"does not exist at stage %d" comma id|checkout_stage )paren suffix:semicolon r_else id|fprintf c_func (paren id|stderr comma l_string|"is unmerged" )paren suffix:semicolon id|fputc c_func (paren l_char|&squot;&bslash;n&squot; comma id|stderr )paren suffix:semicolon )brace r_return l_int|1 suffix:semicolon )brace DECL|function|checkout_all r_static r_void id|checkout_all c_func (paren r_const r_char op_star id|prefix comma r_int id|prefix_length )paren (brace r_int id|i comma id|errs op_assign l_int|0 suffix:semicolon r_struct id|cache_entry op_star id|last_ce op_assign l_int|NULL suffix:semicolon r_for c_loop (paren id|i op_assign l_int|0 suffix:semicolon id|i OL id|active_nr suffix:semicolon id|i op_increment )paren (brace r_struct id|cache_entry op_star id|ce op_assign id|active_cache (braket id|i )braket suffix:semicolon r_if c_cond (paren id|ce_stage c_func (paren id|ce )paren op_ne id|checkout_stage op_logical_and (paren id|CHECKOUT_ALL op_ne id|checkout_stage op_logical_or op_logical_neg id|ce_stage c_func (paren id|ce )paren )paren )paren r_continue suffix:semicolon r_if c_cond (paren id|prefix op_logical_and op_star id|prefix op_logical_and (paren id|ce_namelen c_func (paren id|ce )paren op_le id|prefix_length op_logical_or id|memcmp c_func (paren id|prefix comma id|ce->name comma id|prefix_length )paren )paren )paren r_continue suffix:semicolon r_if c_cond (paren id|last_ce op_logical_and id|to_tempfile )paren (brace r_if c_cond (paren id|ce_namelen c_func (paren id|last_ce )paren op_ne id|ce_namelen c_func (paren id|ce )paren op_logical_or id|memcmp c_func (paren id|last_ce->name comma id|ce->name comma id|ce_namelen c_func (paren id|ce )paren )paren )paren id|write_tempfile_record c_func (paren id|last_ce->name comma id|prefix )paren suffix:semicolon )brace r_if c_cond (paren id|checkout_entry c_func (paren id|ce comma op_amp id|state comma id|to_tempfile ques c_cond id|topath (braket id|ce_stage c_func (paren id|ce )paren )braket suffix:colon l_int|NULL )paren OL l_int|0 )paren id|errs op_increment suffix:semicolon id|last_ce op_assign id|ce suffix:semicolon )brace r_if c_cond (paren id|last_ce op_logical_and id|to_tempfile )paren id|write_tempfile_record c_func (paren id|last_ce->name comma id|prefix )paren suffix:semicolon r_if c_cond (paren id|errs )paren multiline_comment|/* we have already done our error reporting.&n;&t;&t; * exit with the same code as die().&n;&t;&t; */ m_exit (paren l_int|128 )paren suffix:semicolon )brace DECL|variable|builtin_checkout_index_usage r_static r_const r_char op_star r_const id|builtin_checkout_index_usage (braket )braket op_assign (brace id|N_ c_func (paren l_string|"git checkout-index [<options>] [--] [<file>...]" )paren comma l_int|NULL )brace suffix:semicolon DECL|variable|lock_file r_static r_struct id|lock_file id|lock_file suffix:semicolon DECL|function|option_parse_u r_static r_int id|option_parse_u c_func (paren r_const r_struct id|option op_star id|opt comma r_const r_char op_star id|arg comma r_int id|unset )paren (brace r_int op_star id|newfd op_assign id|opt->value suffix:semicolon id|state.refresh_cache op_assign l_int|1 suffix:semicolon id|state.istate op_assign op_amp id|the_index suffix:semicolon r_if c_cond (paren op_star id|newfd OL l_int|0 )paren op_star id|newfd op_assign id|hold_locked_index c_func (paren op_amp id|lock_file comma l_int|1 )paren suffix:semicolon r_return l_int|0 suffix:semicolon )brace DECL|function|option_parse_z r_static r_int id|option_parse_z c_func (paren r_const r_struct id|option op_star id|opt comma r_const r_char op_star id|arg comma r_int id|unset )paren (brace r_if c_cond (paren id|unset )paren id|line_termination op_assign l_char|&squot;&bslash;n&squot; suffix:semicolon r_else id|line_termination op_assign l_int|0 suffix:semicolon r_return l_int|0 suffix:semicolon )brace DECL|function|option_parse_prefix r_static r_int id|option_parse_prefix c_func (paren r_const r_struct id|option op_star id|opt comma r_const r_char op_star id|arg comma r_int id|unset )paren (brace id|state.base_dir op_assign id|arg suffix:semicolon id|state.base_dir_len op_assign id|strlen c_func (paren id|arg )paren suffix:semicolon r_return l_int|0 suffix:semicolon )brace DECL|function|option_parse_stage r_static r_int id|option_parse_stage c_func (paren r_const r_struct id|option op_star id|opt comma r_const r_char op_star id|arg comma r_int id|unset )paren (brace r_if c_cond (paren op_logical_neg id|strcmp c_func (paren id|arg comma l_string|"all" )paren )paren (brace id|to_tempfile op_assign l_int|1 suffix:semicolon id|checkout_stage op_assign id|CHECKOUT_ALL suffix:semicolon )brace r_else (brace r_int id|ch op_assign id|arg (braket l_int|0 )braket suffix:semicolon r_if c_cond (paren l_char|&squot;1&squot; op_le id|ch op_logical_and id|ch op_le l_char|&squot;3&squot; )paren id|checkout_stage op_assign id|arg (braket l_int|0 )braket l_char|&squot;0&squot; suffix:semicolon r_else id|die c_func (paren l_string|"stage should be between 1 and 3 or all" )paren suffix:semicolon )brace r_return l_int|0 suffix:semicolon )brace DECL|function|cmd_checkout_index r_int id|cmd_checkout_index c_func (paren r_int id|argc comma r_const r_char op_star op_star id|argv comma r_const r_char op_star id|prefix )paren (brace r_int id|i suffix:semicolon r_int id|newfd op_assign l_int|1 suffix:semicolon r_int id|all op_assign l_int|0 suffix:semicolon r_int id|read_from_stdin op_assign l_int|0 suffix:semicolon r_int id|prefix_length suffix:semicolon r_int id|force op_assign l_int|0 comma id|quiet op_assign l_int|0 comma id|not_new op_assign l_int|0 suffix:semicolon r_struct id|option id|builtin_checkout_index_options (braket )braket op_assign (brace id|OPT_BOOL c_func (paren l_char|&squot;a&squot; comma l_string|"all" comma op_amp id|all comma id|N_ c_func (paren l_string|"check out all files in the index" )paren )paren comma id|OPT__FORCE c_func (paren op_amp id|force comma id|N_ c_func (paren l_string|"force overwrite of existing files" )paren )paren comma id|OPT__QUIET c_func (paren op_amp id|quiet comma id|N_ c_func (paren l_string|"no warning for existing files and files not in index" )paren )paren comma id|OPT_BOOL c_func (paren l_char|&squot;n&squot; comma l_string|"no-create" comma op_amp id|not_new comma id|N_ c_func (paren l_string|"don&squot;t checkout new files" )paren )paren comma (brace id|OPTION_CALLBACK comma l_char|&squot;u&squot; comma l_string|"index" comma op_amp id|newfd comma l_int|NULL comma id|N_ c_func (paren l_string|"update stat information in the index file" )paren comma id|PARSE_OPT_NOARG comma id|option_parse_u )brace comma (brace id|OPTION_CALLBACK comma l_char|&squot;z&squot; comma l_int|NULL comma l_int|NULL comma l_int|NULL comma id|N_ c_func (paren l_string|"paths are separated with NUL character" )paren comma id|PARSE_OPT_NOARG comma id|option_parse_z )brace comma id|OPT_BOOL c_func (paren l_int|0 comma l_string|"stdin" comma op_amp id|read_from_stdin comma id|N_ c_func (paren l_string|"read list of paths from the standard input" )paren )paren comma id|OPT_BOOL c_func (paren l_int|0 comma l_string|"temp" comma op_amp id|to_tempfile comma id|N_ c_func (paren l_string|"write the content to temporary files" )paren )paren comma id|OPT_CALLBACK c_func (paren l_int|0 comma l_string|"prefix" comma l_int|NULL comma id|N_ c_func (paren l_string|"string" )paren comma id|N_ c_func (paren l_string|"when creating files, prepend <string>" )paren comma id|option_parse_prefix )paren comma id|OPT_CALLBACK c_func (paren l_int|0 comma l_string|"stage" comma l_int|NULL comma l_int|NULL comma id|N_ c_func (paren l_string|"copy out the files from named stage" )paren comma id|option_parse_stage )paren comma id|OPT_END c_func (paren )paren )brace suffix:semicolon r_if c_cond (paren id|argc op_eq l_int|2 op_logical_and op_logical_neg id|strcmp c_func (paren id|argv (braket l_int|1 )braket comma l_string|"-h" )paren )paren id|usage_with_options c_func (paren id|builtin_checkout_index_usage comma id|builtin_checkout_index_options )paren suffix:semicolon id|git_config c_func (paren id|git_default_config comma l_int|NULL )paren suffix:semicolon id|state.base_dir op_assign l_string|"" suffix:semicolon id|prefix_length op_assign id|prefix ques c_cond id|strlen c_func (paren id|prefix )paren suffix:colon l_int|0 suffix:semicolon r_if c_cond (paren id|read_cache c_func (paren )paren OL l_int|0 )paren (brace id|die c_func (paren l_string|"invalid cache" )paren suffix:semicolon )brace id|argc op_assign id|parse_options c_func (paren id|argc comma id|argv comma id|prefix comma id|builtin_checkout_index_options comma id|builtin_checkout_index_usage comma l_int|0 )paren suffix:semicolon id|state.force op_assign id|force suffix:semicolon id|state.quiet op_assign id|quiet suffix:semicolon id|state.not_new op_assign id|not_new suffix:semicolon r_if c_cond (paren id|state.base_dir_len op_logical_or id|to_tempfile )paren (brace multiline_comment|/* when --prefix is specified we do not&n;&t;&t; * want to update cache.&n;&t;&t; */ r_if c_cond (paren id|state.refresh_cache )paren (brace id|rollback_lock_file c_func (paren op_amp id|lock_file )paren suffix:semicolon id|newfd op_assign l_int|1 suffix:semicolon )brace id|state.refresh_cache op_assign l_int|0 suffix:semicolon )brace multiline_comment|/* Check out named files first */ r_for c_loop (paren id|i op_assign l_int|0 suffix:semicolon id|i OL id|argc suffix:semicolon id|i op_increment )paren (brace r_const r_char op_star id|arg op_assign id|argv (braket id|i )braket suffix:semicolon r_char op_star id|p suffix:semicolon r_if c_cond (paren id|all )paren id|die c_func (paren l_string|"git checkout-index: don&squot;t mix &squot;--all&squot; and explicit filenames" )paren suffix:semicolon r_if c_cond (paren id|read_from_stdin )paren id|die c_func (paren l_string|"git checkout-index: don&squot;t mix &squot;--stdin&squot; and explicit filenames" )paren suffix:semicolon id|p op_assign id|prefix_path c_func (paren id|prefix comma id|prefix_length comma id|arg )paren suffix:semicolon id|checkout_file c_func (paren id|p comma id|prefix )paren suffix:semicolon id|free c_func (paren id|p )paren suffix:semicolon )brace r_if c_cond (paren id|read_from_stdin )paren (brace r_struct id|strbuf id|buf op_assign id|STRBUF_INIT comma id|nbuf op_assign id|STRBUF_INIT suffix:semicolon r_if c_cond (paren id|all )paren id|die c_func (paren l_string|"git checkout-index: don&squot;t mix &squot;--all&squot; and &squot;--stdin&squot;" )paren suffix:semicolon r_while c_loop (paren id|strbuf_getline c_func (paren op_amp id|buf comma id|stdin comma id|line_termination )paren op_ne id|EOF )paren (brace r_char op_star id|p suffix:semicolon r_if c_cond (paren id|line_termination op_logical_and id|buf.buf (braket l_int|0 )braket op_eq l_char|&squot;"&squot; )paren (brace id|strbuf_reset c_func (paren op_amp id|nbuf )paren suffix:semicolon r_if c_cond (paren id|unquote_c_style c_func (paren op_amp id|nbuf comma id|buf.buf comma l_int|NULL )paren )paren id|die c_func (paren l_string|"line is badly quoted" )paren suffix:semicolon id|strbuf_swap c_func (paren op_amp id|buf comma op_amp id|nbuf )paren suffix:semicolon )brace id|p op_assign id|prefix_path c_func (paren id|prefix comma id|prefix_length comma id|buf.buf )paren suffix:semicolon id|checkout_file c_func (paren id|p comma id|prefix )paren suffix:semicolon id|free c_func (paren id|p )paren suffix:semicolon )brace id|strbuf_release c_func (paren op_amp id|nbuf )paren suffix:semicolon id|strbuf_release c_func (paren op_amp id|buf )paren suffix:semicolon )brace r_if c_cond (paren id|all )paren id|checkout_all c_func (paren id|prefix comma id|prefix_length )paren suffix:semicolon r_if c_cond (paren l_int|0 op_le id|newfd op_logical_and id|write_locked_index c_func (paren op_amp id|the_index comma op_amp id|lock_file comma id|COMMIT_LOCK )paren )paren id|die c_func (paren l_string|"Unable to write new index file" )paren suffix:semicolon r_return l_int|0 suffix:semicolon )brace eof
dmgerman/git-test
builtin/checkout-index.c
C
gpl-2.0
17,029
/************************************************************************* Copyright (C) 2005 Joseph D'Errico, Wei Qin See file COPYING for more information. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. *************************************************************************/ #ifndef CGEN_HPP #define CGEN_HPP #include "arch.hpp" char *emitc_nop(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_add(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_addi(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_addiu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_addu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sub(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_subu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mult(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_multu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_div(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_divu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_and(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_andi(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_nor(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_or(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_ori(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_xor(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_xori(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sll(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sllv(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_srl(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_srlv(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sra(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_srav(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_slt(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_slti(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sltiu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sltu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_beq(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bgez(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bgezal(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bgtz(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_blez(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bltzal(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bltz(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bne(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_j(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_jal(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_jalr(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_jr(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mfhi(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mflo(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mthi(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mtlo(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mfc1(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mtc1(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cfc1(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_ctc1(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lb(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lbu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lh(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lhu(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lw(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lwl(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lwr(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lui(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sb(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sh(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sw(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_swl(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_swr(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_lwc1(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_swc1(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_ll(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sc(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_brk(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_abs_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_abs_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_add_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_add_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cvt_d_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cvt_d_w(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cvt_s_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cvt_s_w(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cvt_w_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_cvt_w_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_div_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_div_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mov_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mov_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mul_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_mul_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_neg_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_neg_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sub_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_sub_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_c_cond_d(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_c_cond_s(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bc1f(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_bc1t(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); char *emitc_syscall(char *, emulator_t *, target_addr_t, target_addr_t, target_addr_t, bool); #endif
kagucho/mipsim
jit/mips_gen.hpp
C++
gpl-2.0
9,099
package de.zedlitz.opendocument; import groovy.lang.Closure; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; /** * A row in an OpenDocument table. * * @author jzedlitz * */ public class Row { /** * Element name "table-row" */ static final QName ELEMENT_ROW = new QName(Document.NS_TABLE, "table-row"); private final XMLStreamReaderWithDepth xpp; private final int depth; private int emptyCells; List<Cell> allCells = null; /** * @param xpp */ public Row(final XMLStreamReaderWithDepth xpp) { this.xpp = xpp; this.depth = xpp.getDepth(); } /** * @see de.freenet.jzedlitz.oo.Row#nextCell() */ public Cell nextCell() { Cell result = null; // while there are empty (faked) cells return one those if (this.emptyCells > 0) { result = new EmptyCell(); this.emptyCells--; } else { try { int eventType = xpp.getEventType(); while (!((eventType == XMLStreamConstants.END_ELEMENT) && Row.ELEMENT_ROW.equals(xpp.getName())) && (eventType != XMLStreamConstants.END_DOCUMENT) && (xpp.getDepth() >= depth)) { if ((eventType == XMLStreamConstants.START_ELEMENT) && Cell.ELEMENT_CELL.equals(xpp.getName())) { final Cell myCell = new Cell(xpp); if (myCell.getNumberColumnsRepeated() > 1) { this.emptyCells = myCell.getNumberColumnsRepeated() - 1; } result = myCell; xpp.next(); break; } eventType = xpp.next(); } } catch (final XMLStreamException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result; } Cell getAt(final int i) { // switch to memory mode if (allCells == null) { allCells = new ArrayList<Cell>(); Cell nextCell = this.nextCell(); while (nextCell != null) { allCells.add(nextCell); nextCell = this.nextCell(); } } return allCells.get(i); } /** * @see de.zedlitz.opendocument.Row#eachCell(groovy.lang.Closure) */ public void eachCell(final Closure c) { Cell nextCell = this.nextCell(); while (nextCell != null) { c.call(nextCell); nextCell = this.nextCell(); } } }
jze/opendocument-reader
src/main/java/de/zedlitz/opendocument/Row.java
Java
gpl-2.0
2,873
# KIGIV(c) [![Build Status](https://travis-ci.org/cjbrigato/kigiv-for-proxmark3.svg?branch=kigiv-for-proxmark-master)](https://travis-ci.org/cjbrigato/kigiv-for-proxmark3)[![Coverity Status](https://scan.coverity.com/projects/14115/badge.svg)](https://scan.coverity.com/project/cjbrigato-kigiv-for-proxmark3)[![Latest release](https://img.shields.io/github/release/cjbrigato/kigib-for-proxmark3.svg)](https://github.com/cjbrigato/kigiv-for-proxmark3/releases/latest) ## from Vigik "20years of (un)sercurity without a single update"; What's this fork ? =============== * This is KIGIV. Meaning "Reverse - Vigik". Diff from proxmark3-master? =============== * Aimed at providing a full standalone + Monitor over Serial/PM3 client solution for breaking Mifares/VIGIK Tags and other insecure but everywhere in the wild Tags. ## Demos. The VT100 ============== * Is being implemented. [![asciicast](https://asciinema.org/a/w4qyQSa2VNslfTr32fi6o5Zt7.png)](https://asciinema.org/a/w4qyQSa2VNslfTr32fi6o5Zt7) The WTF =============== * Is everywhere (YT LINKS these are) [![WTF#1](https://j.gifs.com/32lypn.gif)](http://www.youtube.com/watch?v=GFgWeonYn7s) [![WTF#2](https://j.gifs.com/mQwYPE.gif)](http://www.youtube.com/watch?v=iU9BbxGtFGY) * http://www.youtube.com/watch?v=GFgWeonYn7s * http://www.youtube.com/watch?v=iU9BbxGtFGY
cjbrigato/kigiv-for-proxmark3
README.md
Markdown
gpl-2.0
1,337
#include "nexusdefs.h" #include "nexustoken.h" #include "nexus.h" /** * @class NexusBlock * @file nexus.h * @file nexusblock.cpp * @author Paul O. Lewis * @copyright Copyright © 1999. All Rights Reserved. * @variable isDisabled [bool:private] true if this block is currently disabled * @variable isEmpty [bool:private] true if this object is currently storing data * @variable next [NexusBlock*:protected] pointer to next block in list * @variable id [nxsstring:protected] holds name of block (e.g., "DATA", "TREES", etc.) * @see Nexus * @see NexusReader * @see NexusToken * * This is the base class from which all Nexus block classes are derived. * The abstract virtual function Read must be overridden for each derived * class to provide the ability to read everything following the block name * (which is read by the Nexus object) to the end or endblock statement. * Derived classes must provide their own data storage and access functions. */ /** * @constructor * * Default constructor * Initializes 'next' and 'nexus' data members to NULL, and 'isEmpty' and * 'isEnabled' to true. */ NexusBlock::NexusBlock() : next(NULL), nexus(NULL), isEmpty(true), isEnabled(true) { } /** * @destructor * * Does nothing. */ NexusBlock::~NexusBlock() { } /** * @method CharLabelToNumber [int:protected] * @param s [nxsstring] the character label to be translated to character number * * This base class version simply returns -1, but a derived class should * override this function if it needs to construct and run a SetReader * object to read a set involving characters. The SetReader object may * need to use this function to look up a character label encountered in * the set. A class that overrides this method should return the * character index in the range [1..nchar]; i.e., add one to the 0-offset * index. */ int NexusBlock::CharLabelToNumber( nxsstring /*s*/ ) { return 0; } /** * @method Disable [void:public] * * Sets the value of isEnabled to false. A NexusBlock * can be disabled (by calling this method) if blocks of that type * are to be skipped during execution of the nexus file. * If a disabled block is encountered, the virtual * Nexus::SkippingDisabledBlock function is called. */ void NexusBlock::Disable() { isEnabled = false; } /** * @method Enable [void:public] * * Sets the value of isEnabled to true. A NexusBlock * can be disabled (by calling Disable) if blocks of that type * are to be skipped during execution of the nexus file. * If a disabled block is encountered, the virtual * Nexus::SkippingDisabledBlock function is called. */ void NexusBlock::Enable() { isEnabled = true; } /** * @method IsEnabled [bool:public] * * Returns value of isEnabled, which can be controlled through * use of the Enable and Disable member functions. A NexusBlock * should be disabled if blocks of that type are to be skipped * during execution of the nexus file. If a disabled block is * encountered, the virtual Nexus::SkippingDisabledBlock function * is called. */ bool NexusBlock::IsEnabled() { return isEnabled; } /** * @method IsEmpty [bool:public] * * Returns true if Read function has not been called since the last Reset. * This base class version simply returns the value of the data member * isEmpty. If you derive a new block class from NexusBlock, be sure * to set isEmpty to true in your Reset function and isEmpty to false in your * Read function. */ bool NexusBlock::IsEmpty() { return isEmpty; } /** * @method Read [virtual void:protected] * @param token [NexusToken&] the NexusToken to use for reading block * @param in [istream&] the input stream from which to read * * This abstract virtual function must be overridden for each derived * class to provide the ability to read everything following the block name * (which is read by the Nexus object) to the end or endblock statement. * Characters are read from the input stream in. Note that to get output * comments displayed, you must derive a class from NexusToken, override * the member function OutputComment to display a supplied comment, and * then pass a reference to an object of the derived class to this function. */ // virtual void Read( NexusToken& token, istream& in ) = 0; /** * @method Reset [virtual void:protected] * * This abstract virtual function must be overridden for each derived * class to completely reset the block object in preparation for reading * in another block of this type. This function is called by the Nexus * object just prior to calling the block object's Read function. */ // virtual void Reset() = 0; /** * @method GetID [nxsstring:public] * * Returns the id nxsstring. */ nxsstring NexusBlock::GetID() { return id; } /** * @method Report [virtual void:public] * @param out [ostream&] the output stream to which the report is sent * * Provides a brief report of the contents of the block. */ // virtual void Report( ostream& out ) = 0; /** * @method SetNexus [virtual void:public] * @param nxsptr [Nexus*] pointer to a Nexus object * * Sets the nexus data member of the NexusBlock object to * nxsptr. */ void NexusBlock::SetNexus( Nexus* nxsptr ) { nexus = nxsptr; } /** * @method SkippingCommand [virtual void:public] * @param commandName [nxsstring] the name of the command being skipped * * This function is called when an unknown command named commandName is * about to be skipped. This version of the function does nothing (i.e., * no warning is issued that a command was unrecognized. Override this * virtual function in a derived class to provide such warnings to the * user. */ void NexusBlock::SkippingCommand( nxsstring /* commandName */ ) { } /** * @method TaxonLabelToNumber [int:protected] * @param s [nxsstring] the taxon label to be translated to a taxon number * * This base class version simply returns 0, but a derived class should * override this function if it needs to construct and run a SetReader * object to read a set involving taxa. The SetReader object may * need to use this function to look up a taxon label encountered in * the set. A class that overrides this method should return the * taxon index in the range [1..ntax]; i.e., add one to the 0-offset * index. */ int NexusBlock::TaxonLabelToNumber( nxsstring /*s*/ ) { return 0; }
rdmpage/treeviewx
ncl-2.0/src/nexusblock.cpp
C++
gpl-2.0
6,417
/* * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * */ package sun.jvm.hotspot.types.basic; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.types.*; /** A specialization of BasicField which represents a field containing an oop value and which adds typechecked getValue() routines returning OopHandles. */ public class BasicNarrowOopField extends BasicOopField implements NarrowOopField { private static final boolean DEBUG = false; public BasicNarrowOopField (OopField oopf) { super(oopf); } public BasicNarrowOopField(BasicTypeDataBase db, Type containingType, String name, Type type, boolean isStatic, long offset, Address staticFieldAddress) { super(db, containingType, name, type, isStatic, offset, staticFieldAddress); if (DEBUG) { System.out.println(" name " + name + " type " + type + " isStatic " + isStatic + " offset " + offset + " static addr " + staticFieldAddress); } if (!type.isOopType()) { throw new WrongTypeException("Type of a BasicOopField must be an oop type"); } } /** The field must be nonstatic and the type of the field must be a Java oop, or a WrongTypeException will be thrown. */ public OopHandle getValue(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException { return getNarrowOopHandle(addr); } /** The field must be static and the type of the field must be a Java oop, or a WrongTypeException will be thrown. */ public OopHandle getValue() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException { return getNarrowOopHandle(); } }
TheTypoMaster/Scaper
openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicNarrowOopField.java
Java
gpl-2.0
2,652
cmd_sound/soc/atmel/built-in.o := rm -f sound/soc/atmel/built-in.o; ../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-ar rcs sound/soc/atmel/built-in.o
venkatkamesh/2.6.35-kernel-for-lg-optimus-me-
sound/soc/atmel/.built-in.o.cmd
Batchfile
gpl-2.0
163
.bbp-search-form { float: none; } #bbpress-forums #bbp-search-form #bbp_search { width: 270px; margin-right: 26px; } #bbp_search_submit { min-width: 170px; vertical-align: top; } div.bbp-breadcrumb { float: none; } #bbpress-forums div.bbp-search-form { margin: 102px 0 46px; } @media (max-width: 767px) { #bbpress-forums div.bbp-search-form { float: none; margin: 0; display: table-footer-group; } } #bbpress-forums { margin-bottom: 52px; } #bbpress-forums li.bbp-header, #bbpress-forums li.bbp-footer { padding: 0; display: table; width: 100%; color: #ffffff; background: #37c4aa; border-top: 0px solid #eee; } #bbpress-forums li.bbp-header ul, #bbpress-forums li.bbp-footer ul { display: table-row; } #bbpress-forums li.bbp-header ul li, #bbpress-forums li.bbp-footer ul li { display: table-cell; padding: 12px 39px; float: none; } #bbpress-forums li.bbp-header a, #bbpress-forums li.bbp-footer a { color: inherit; } .bbp-forum-title { display: block; margin: 0px 0 17px; font-weight: 600; font-size: 20px; } #bbpress-forums li.bbp-header .bbp-search-content, #bbpress-forums li.bbp-footer .bbp-search-content, #bbpress-forums li.bbp-header .bbp-forum-content, #bbpress-forums li.bbp-footer .bbp-forum-content, #bbpress-forums li.bbp-header .bbp-topic-content, #bbpress-forums li.bbp-footer .bbp-topic-content, #bbpress-forums li.bbp-header .bbp-reply-content, #bbpress-forums li.bbp-footer .bbp-reply-content { padding: 12px 39px; } #bbpress-forums li.bbp-header .bbp-search-author, #bbpress-forums li.bbp-footer .bbp-search-author, #bbpress-forums li.bbp-header .bbp-forum-author, #bbpress-forums li.bbp-footer .bbp-forum-author, #bbpress-forums li.bbp-header .bbp-topic-author, #bbpress-forums li.bbp-footer .bbp-topic-author, #bbpress-forums li.bbp-header .bbp-reply-author, #bbpress-forums li.bbp-footer .bbp-reply-author { padding: 12px 39px 0; } #bbpress-forums li.bbp-body ul.forum, #bbpress-forums li.bbp-body ul.topic { border-top: 1px solid #d9dde0; padding: 0; } #bbpress-forums ul.bbp-lead-topic, #bbpress-forums ul.bbp-topics, #bbpress-forums ul.bbp-forums, #bbpress-forums ul.bbp-search-results { border: 0px solid; border-left: 1px solid #d9dde0; margin-bottom: 24px; } #bbpress-forums ul.bbp-replies { margin-bottom: 24px; border: 1px solid #d9dde0; } #bbpress-forums ul.bbp-replies div.bbp-reply-header, #bbpress-forums ul.bbp-replies div.bbp-reply-header + div.reply { border-right: 0px solid #d9dde0; border-left: 0px solid #d9dde0; } div.bbp-submit-wrapper { margin-bottom: 10px; } #bbpress-forums .bbp-forum-info .bbp-forum-content, #bbpress-forums p.bbp-topic-meta { margin: 0; } .bbp-body { display: table; width: 100%; } .bbp-body ul { display: table-row; } .bbp-body ul li { display: table-cell; vertical-align: top; padding: 12px 39px 18px; float: none; border-right: 1px solid #d9dde0; border-bottom: 1px solid #d9dde0; } li.bbp-forum-info, li.bbp-topic-title { width: 41.22%; } li.bbp-forum-topic-count, li.bbp-forum-reply-count, li.bbp-topic-voice-count, li.bbp-topic-reply-count { width: 17.19%; } li.bbp-forum-freshness, li.bbp-topic-freshness { width: 24.4%; } #bbpress-forums li.bbp-footer { display: none; } .wp-core-ui .button-group.button-small .button, .wp-core-ui .button.button-small { min-height: 0; } #bbpress-forums div.bbp-the-content-wrapper div.quicktags-toolbar, #bbpress-forums div.odd, #bbpress-forums ul.odd { background: transparent; border: 0px solid; } #bbpress-forums fieldset.bbp-form p, #bbpress-forums div.bbp-the-content-wrapper { margin: 0 0 30px; } #bbpress-forums div.bbp-reply-header, #bbpress-forums div.bbp-reply-header + div.reply { border-right: 1px solid #d9dde0; border-left: 1px solid #d9dde0; } .bbp-pagination { padding-top: 14px; border-top: 1px solid #d9dde0; } #bbpress-forums #bbp-your-profile fieldset input, #bbpress-forums #bbp-your-profile fieldset textarea { width: 60%; padding: 8px 16px 7px; color: #83868a; background: #ffffff; border: 1px solid #d9dde0; } #bbpress-forums div.bbp-the-content-wrapper input { border-radius: 0px; } #bbpress-forums #bbp-your-profile fieldset div.select-wrapper { width: 60%; clear: none; } .bbp-form th { float: left; width: 20%; padding: 5px 20px 5px 0; text-align: right; cursor: pointer; } .bbp-form .form-table, .bbp-form .form-table tbody, .bbp-form .form-table tr, .bbp-form .form-table th, .bbp-form .form-table td { display: block; } .bbp-form .form-table th, .bbp-form .form-table td { border: 0px solid; padding: 0; overflow: hidden; } #bbpress-forums #bbp-your-profile fieldset .form-table input { width: 100%; } .bbp-form .form-table td { width: 60%; } #bbpress-forums fieldset.bbp-form .form-table p.description { margin: 5px 0 20px 0; font-size: 12px; font-style: italic; clear: left; padding: 5px 8px; border: #cee1ef 1px solid; background-color: #f0f8ff; text-align: left; } #bbpress-forums #bbp-your-profile fieldset .form-table label[for] { width: 100%; } .bbp-form table tbody tr:nth-child(even), .bbp-form table tfoot tr:nth-child(even) { background: transparent; } #bbpress-forums p.bbp-topic-meta img.avatar { display: none; } #bbp-user-wrapper { margin: 70px 0 0; } #bbpress-forums ul .bbp-forums-list li { display: block; font-size: inherit; border: 0px solid; padding: 4px 0 0; } #bbpress-forums fieldset.bbp-form label { font-size: 16px; font-weight: 400; margin-bottom: 10px; } @media (max-width: 991px) { .bbp-body ul li { padding: 10px; } #bbpress-forums li.bbp-header ul li, #bbpress-forums li.bbp-footer ul li { padding: 12px 10px; } #bbpress-forums #bbp-your-profile fieldset label[for], .bbp-form th { float: none; width: 100%; text-align: left; } #bbpress-forums #bbp-your-profile fieldset div.select-wrapper, #bbpress-forums #bbp-your-profile fieldset input, #bbpress-forums #bbp-your-profile fieldset textarea { width: 100%; } #bbpress-forums #bbp-your-profile fieldset span.description { margin: 5px 0 0 0%; width: 100%; } #bbpress-forums #bbp-your-profile fieldset fieldset.password, .bbp-form .form-table td { width: 100%; } } @media (max-width: 767px) { #bbpress-forums #bbp-search-form #bbp_search, #bbp_search_submit { margin-bottom: 24px; } } div.bbp-breadcrumb { font-size: 14px; padding: 40px 0 40px; } div.bbp-breadcrumb { float: none; } @media (max-width: 767px) { div.bbp-breadcrumb { display: table-header-group; } div.bbp-breadcrumb .breadcrumb-trail { padding: 40px 0; } } .widget.widget_display_stats dt { float: left; margin: 0 8px 15px 0; } .widget.widget_display_stats dd { margin: 0 0 15px; } .widget .bbp-logged-in img.avatar { margin: 0 28px 0 0; border-radius: 5px; overflow: hidden; width: 72px; } .widget .bbp-logged-in h4 { font-size: 20px; margin-bottom: 39px; } .widget .bbp-login-form .bbp-username, .widget .bbp-login-form .bbp-email, .widget .bbp-login-form .bbp-password, .widget .bbp-login-form .bbp-remember-me, .widget .bbp-login-form .bbp-submit-wrapper { margin: 0 0 15px; } .widget #bbp_search { vertical-align: top; width: 100%; margin-bottom: 24px; } .widget #bbp-search-form { padding-top: 5px; } #sidebar .bbp-login-form label { width: auto; } @media (max-width: 1229px) { .widget #bbp_search { width: 209px; } } @media (max-width: 991px) { .widget #bbp_search_submit { margin: 0; } } div.bbp-topic-tags, #bbpress-forums .bbp-forum-info .bbp-forum-content, #bbpress-forums p.bbp-topic-meta, #bbpress-forums ul.bbp-lead-topic, #bbpress-forums ul.bbp-topics, #bbpress-forums ul.bbp-forums, #bbpress-forums ul.bbp-replies, #bbpress-forums ul.bbp-search-results, #bbpress-forums, .bbp-topics-front ul.super-sticky, .bbp-topics ul.super-sticky, .bbp-topics ul.sticky, .bbp-forum-content ul.sticky { font-size: 16px; } #bbpress-forums p.bbp-topic-meta img.avatar, #bbpress-forums ul.bbp-reply-revision-log img.avatar, #bbpress-forums ul.bbp-topic-revision-log img.avatar, #bbpress-forums div.bbp-template-notice img.avatar, #bbpress-forums .widget_display_topics img.avatar, #bbpress-forums .widget_display_replies img.avatar { margin-bottom: 3px; } #bbpress-forums fieldset.bbp-form select { margin: 0px; } @media (max-width: 767px) { div.bbp-topic-tags, #bbpress-forums .bbp-forum-info .bbp-forum-content, #bbpress-forums p.bbp-topic-meta, #bbpress-forums ul.bbp-lead-topic, #bbpress-forums ul.bbp-topics, #bbpress-forums ul.bbp-forums, #bbpress-forums ul.bbp-replies, #bbpress-forums ul.bbp-search-results, #bbpress-forums, .bbp-topics-front ul.super-sticky, .bbp-topics ul.super-sticky, .bbp-topics ul.sticky, .bbp-forum-content ul.sticky { font-size: 14px; } }
vswamy/hackathon
wp-content/themes/emmet-lite/css/emmet-bbpress.css
CSS
gpl-2.0
9,289
package com.teambitcoin.coinwallet; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.Gravity; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import android.widget.Toast; import android.view.KeyEvent; import android.view.inputmethod.*; import com.teambitcoin.coinwallet.models.*; public class ForgotPassword extends Activity { String username; // username variable to hold the input String secretQuestionDb; // variable to hold the secret question query from database String answer; // answer variable to the input String dbAnswer; // variable to hold answer query from database String dbPassword; // variable to hold password query from database public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.forgot_main); // added this text when hit done after the user entered username // had to make it final in order to work... final EditText editText1 = (EditText) findViewById(R.id.username_field); editText1.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_DONE) { Context context = getApplicationContext(); CharSequence text = "Successfully entered username"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); username = editText1.getText().toString(); CharSequence usernamePrint = "Welcome " + username + " your question will appear shortly"; int durationUsername = Toast.LENGTH_LONG; Toast toastUsername = Toast.makeText(context, usernamePrint, durationUsername); toastUsername.show(); // method to query the secret question from database // according to username entered... // this method return a string with the question querySecretQuestion(username); handled = true; } return handled; } }); // added this text when hit done after the user entered answer final EditText editText2 = (EditText) findViewById(R.id.password_field); editText2.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_DONE) { Context context = getApplicationContext(); CharSequence text = "Successfully answered question"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); // set the variable answer to be the inputed answer user answer = editText2.getText().toString(); handled = true; } return handled; } }); // adding the button object Button button = (Button) findViewById(R.id.login_button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Context context = getApplicationContext(); CharSequence text = "Checking answer..."; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); validateAnswer(answer); // call the method which will check if the answer entered // corresponds to the right answer to that member's secret question } }); } public String querySecretQuestion(String username) { if (User.getUser(username) == null) { Context context = getApplicationContext(); secretQuestionDb = null; CharSequence secretQuestion = "No Secret Question associated with the inputted username"; int duration2 = Toast.LENGTH_LONG; Toast toast2 = Toast.makeText(context, secretQuestion, duration2); toast2.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER, 0, -40); toast2.show(); return secretQuestionDb; } if (User.getUser(username).getQuestion() == null) { Context context = getApplicationContext(); secretQuestionDb = null; CharSequence secretQuestion = "No Secret Question associated with the inputted username"; int duration2 = Toast.LENGTH_LONG; Toast toast2 = Toast.makeText(context, secretQuestion, duration2); toast2.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER, 0, -40); toast2.show(); return secretQuestionDb; } else { Context context = getApplicationContext(); secretQuestionDb = User.getUser(username).getQuestion(); CharSequence secretQuestion = "Secret question: " + secretQuestionDb; int duration2 = Toast.LENGTH_LONG; Toast toast2 = Toast.makeText(context, secretQuestion, duration2); toast2.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER, 0, -40); toast2.show(); return secretQuestionDb; } // take the inputed username and go to the database first check if that username exists // if not output the entered username does not exist // if the username exist query the secret question associated with it and return it } public String validateAnswer(String answer) { if (User.getUser(username) == null) { Context context = getApplicationContext(); dbPassword = null; CharSequence secretAnswer = "Could not find any user with the given username"; int duration2 = Toast.LENGTH_LONG;// stay on screen longer Toast toast2 = Toast.makeText(context, secretAnswer, duration2); toast2.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER, 0, -40); toast2.show(); return dbPassword; } // if the password is null, wrong answer inputed. no password shown. if (User.getUser(username).recoverPassword(answer) == null) { dbPassword = null; Context context = getApplicationContext(); // wrong answer no password shown CharSequence text = "Wrong answer to question, please try again"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER, 0, -40); toast.show(); return dbPassword; } else { // if correct answer shown, show password to user dbPassword = User.getUser(username).recoverPassword(answer); Context context = getApplicationContext(); // set to password, query from database CharSequence text = "Password: " + dbPassword; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER, 0, -40); toast.show(); return dbPassword; } // query from database the answer associated to the user's secret // question, if the inputted answer // equals the one saved in the database output the user recorded // password else print WRONG ANSWER... } }
cwallet/coinwallet
CoinWallet/src/main/java/com/teambitcoin/coinwallet/ForgotPassword.java
Java
gpl-2.0
8,528
cmd_/home/keithconger/Projects/bbbandroid-bluez/backports-3.18.1-1/drivers/bluetooth/btmrvl.ko := /home/keithconger/Projects/bbbandroid-bluez/prebuilts/gcc/linux-x86/arm/arm-gnueabihf-4.7/bin/arm-linux-gnueabihf-ld -EL -r -T /home/keithconger/Projects/bbbandroid-bluez/kernel/scripts/module-common.lds --build-id -o /home/keithconger/Projects/bbbandroid-bluez/backports-3.18.1-1/drivers/bluetooth/btmrvl.ko /home/keithconger/Projects/bbbandroid-bluez/backports-3.18.1-1/drivers/bluetooth/btmrvl.o /home/keithconger/Projects/bbbandroid-bluez/backports-3.18.1-1/drivers/bluetooth/btmrvl.mod.o
kconger/backports-3.18.1-1
drivers/bluetooth/.btmrvl.ko.cmd
Batchfile
gpl-2.0
593
#pragma once /* * Copyright (C) 2012-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include <map> #include "addons/include/xbmc_pvr_types.h" #include "settings/lib/ISettingCallback.h" #include "threads/Event.h" #include "threads/Thread.h" #include "utils/JobManager.h" class CGUIDialogProgressBarHandle; class CStopWatch; class CAction; class CFileItemList; namespace EPG { class CEpgContainer; } namespace PVR { class CPVRClients; class CPVRChannel; typedef boost::shared_ptr<PVR::CPVRChannel> CPVRChannelPtr; class CPVRChannelGroupsContainer; class CPVRChannelGroup; class CPVRRecording; class CPVRRecordings; class CPVRTimers; class CPVRGUIInfo; class CPVRDatabase; class CGUIWindowPVRCommon; enum ManagerState { ManagerStateError = 0, ManagerStateStopped, ManagerStateStarting, ManagerStateStopping, ManagerStateInterrupted, ManagerStateStarted }; enum PlaybackType { PlaybackTypeAny = 0, PlaybackTypeTv, PlaybackTypeRadio }; enum ChannelStartLast { START_LAST_CHANNEL_OFF = 0, START_LAST_CHANNEL_MIN, START_LAST_CHANNEL_ON }; #define g_PVRManager CPVRManager::Get() #define g_PVRChannelGroups g_PVRManager.ChannelGroups() #define g_PVRTimers g_PVRManager.Timers() #define g_PVRRecordings g_PVRManager.Recordings() #define g_PVRClients g_PVRManager.Clients() typedef boost::shared_ptr<PVR::CPVRChannelGroup> CPVRChannelGroupPtr; class CPVRManager : public ISettingCallback, private CThread { friend class CPVRClients; private: /*! * @brief Create a new CPVRManager instance, which handles all PVR related operations in XBMC. */ CPVRManager(void); public: /*! * @brief Stop the PVRManager and destroy all objects it created. */ virtual ~CPVRManager(void); /*! * @brief Get the instance of the PVRManager. * @return The PVRManager instance. */ static CPVRManager &Get(void); virtual void OnSettingChanged(const CSetting *setting); virtual void OnSettingAction(const CSetting *setting); /*! * @brief Get the channel groups container. * @return The groups container. */ CPVRChannelGroupsContainer *ChannelGroups(void) const { return m_channelGroups; } /*! * @brief Get the recordings container. * @return The recordings container. */ CPVRRecordings *Recordings(void) const { return m_recordings; } /*! * @brief Get the timers container. * @return The timers container. */ CPVRTimers *Timers(void) const { return m_timers; } /*! * @brief Get the timers container. * @return The timers container. */ CPVRClients *Clients(void) const { return m_addons; } /*! * @brief Start the PVRManager, which loads all PVR data and starts some threads to update the PVR data. * @param bAsync True to (re)start the manager from another thread * @param bOpenPVRWindow True to open the PVR window after starting, false otherwise */ void Start(bool bAsync = false, bool bOpenPVRWindow = false); /*! * @brief Stop the PVRManager and destroy all objects it created. */ void Stop(void); /*! * @brief Delete PVRManager's objects. */ void Cleanup(void); /*! * @return True when a PVR window is active, false otherwise. */ bool IsPVRWindowActive(void) const; /*! * @brief Check whether an add-on can be upgraded or installed without restarting the pvr manager, when the add-on is in use or the pvr window is active * @param strAddonId The add-on to check. * @return True when the add-on can be installed, false otherwise. */ bool InstallAddonAllowed(const std::string& strAddonId) const; /*! * @brief Mark an add-on as outdated so it will be upgrade when it's possible again * @param strAddonId The add-on to mark as outdated * @param strReferer The referer to use when downloading */ void MarkAsOutdated(const std::string& strAddonId, const std::string& strReferer); /*! * @return True when updated, false when the pvr manager failed to load after the attempt */ bool UpgradeOutdatedAddons(void); /*! * @brief Get the TV database. * @return The TV database. */ CPVRDatabase *GetTVDatabase(void) const { return m_database; } /*! * @brief Updates the recordings and the "now" and "next" timers. */ void UpdateRecordingsCache(void); /*! * @brief Get a GUIInfoManager character string. * @param dwInfo The string to get. * @return The requested string or an empty one if it wasn't found. */ bool TranslateCharInfo(DWORD dwInfo, CStdString &strValue) const; /*! * @brief Get a GUIInfoManager integer. * @param dwInfo The integer to get. * @return The requested integer or 0 if it wasn't found. */ int TranslateIntInfo(DWORD dwInfo) const; /*! * @brief Get a GUIInfoManager boolean. * @param dwInfo The boolean to get. * @return The requested boolean or false if it wasn't found. */ bool TranslateBoolInfo(DWORD dwInfo) const; /*! * @brief Show the player info. * @param iTimeout Hide the player info after iTimeout seconds. * @todo not really the right place for this :-) */ void ShowPlayerInfo(int iTimeout); /*! * @brief Reset the TV database to it's initial state and delete all the data inside. * @param bResetEPGOnly True to only reset the EPG database, false to reset both PVR and EPG. */ void ResetDatabase(bool bResetEPGOnly = false); /*! * @brief Check if a TV channel, radio channel or recording is playing. * @return True if it's playing, false otherwise. */ bool IsPlaying(void) const; /*! * @return True while the PVRManager is initialising. */ bool IsInitialising(void) const; /*! * @brief Return the channel that is currently playing. * @param channel The channel or NULL if none is playing. * @return True if a channel is playing, false otherwise. */ bool GetCurrentChannel(CPVRChannelPtr &channel) const; /*! * @brief Return the EPG for the channel that is currently playing. * @param channel The EPG or NULL if no channel is playing. * @return The amount of results that was added or -1 if none. */ int GetCurrentEpg(CFileItemList &results) const; /*! * @brief Check whether the PVRManager has fully started. * @return True if started, false otherwise. */ bool IsStarted(void) const; /*! * @brief Check whether EPG tags for channels have been created. * @return True if EPG tags have been created, false otherwise. */ bool EpgsCreated(void) const; /*! * @brief Reset the playing EPG tag. */ void ResetPlayingTag(void); /*! * @brief Switch to the given channel. * @param channel The channel to switch to. * @param bPreview True to show a preview, false otherwise. * @return Trrue if the switch was successful, false otherwise. */ bool PerformChannelSwitch(const CPVRChannel &channel, bool bPreview); /*! * @brief Close an open PVR stream. */ void CloseStream(void); /*! * @brief Open a stream from the given channel. * @param channel The channel to open. * @return True if the stream was opened, false otherwise. */ bool OpenLiveStream(const CFileItem &channel); /*! * @brief Open a stream from the given recording. * @param tag The recording to open. * @return True if the stream was opened, false otherwise. */ bool OpenRecordedStream(const CPVRRecording &tag); /*! * @brief Start recording on a given channel if it is not already recording, stop if it is. * @param channel the channel to start/stop recording. * @return True if the recording was started or stopped successfully, false otherwise. */ bool ToggleRecordingOnChannel(unsigned int iChannelId); /*! * @brief Start or stop recording on the channel that is currently being played. * @param bOnOff True to start recording, false to stop. * @return True if the recording was started or stopped successfully, false otherwise. */ bool StartRecordingOnPlayingChannel(bool bOnOff); /*! * @brief Get the channel number of the previously selected channel. * @return The requested channel number or -1 if it wasn't found. */ int GetPreviousChannel(void); /*! * @brief Check whether there are active timers. * @return True if there are active timers, false otherwise. */ bool HasTimers(void) const; /*! * @brief Check whether there are active recordings. * @return True if there are active recordings, false otherwise. */ bool IsRecording(void) const; /*! * @brief Check whether the pvr backend is idle. * @return True if there are no active timers/recordings/wake-ups within the configured time span. */ bool IsIdle(void) const; /*! * @brief Set the current playing group, used to load the right channel. * @param group The new group. */ void SetPlayingGroup(CPVRChannelGroupPtr group); /*! * @brief Get the current playing group, used to load the right channel. * @param bRadio True to get the current radio group, false to get the current TV group. * @return The current group or the group containing all channels if it's not set. */ CPVRChannelGroupPtr GetPlayingGroup(bool bRadio = false); /*! * @brief Let the background thread create epg tags for all channels. */ void TriggerEpgsCreate(void); /*! * @brief Let the background thread update the recordings list. */ void TriggerRecordingsUpdate(void); /*! * @brief Let the background thread update the timer list. */ void TriggerTimersUpdate(void); /*! * @brief Let the background thread update the channel list. */ void TriggerChannelsUpdate(void); /*! * @brief Let the background thread update the channel groups list. */ void TriggerChannelGroupsUpdate(void); /*! * @brief Let the background thread save the current video settings. */ void TriggerSaveChannelSettings(void); /*! * @brief Update the channel that is currently active. * @param item The new channel. * @return True if it was updated correctly, false otherwise. */ bool UpdateItem(CFileItem& item); /*! * @brief Switch to a channel given it's channel number. * @param iChannelNumber The channel number to switch to. * @return True if the channel was switched, false otherwise. */ bool ChannelSwitch(unsigned int iChannelNumber); /*! * @brief Switch to the next channel in this group. * @param iNewChannelNumber The new channel number after the switch. * @param bPreview If true, don't do the actual switch but just update channel pointers. * Used to display event info while doing "fast channel switching" * @return True if the channel was switched, false otherwise. */ bool ChannelUp(unsigned int *iNewChannelNumber, bool bPreview = false) { return ChannelUpDown(iNewChannelNumber, bPreview, true); } /*! * @brief Switch to the previous channel in this group. * @param iNewChannelNumber The new channel number after the switch. * @param bPreview If true, don't do the actual switch but just update channel pointers. * Used to display event info while doing "fast channel switching" * @return True if the channel was switched, false otherwise. */ bool ChannelDown(unsigned int *iNewChannelNumber, bool bPreview = false) { return ChannelUpDown(iNewChannelNumber, bPreview, false); } /*! * @brief Get the total duration of the currently playing LiveTV item. * @return The total duration in milliseconds or NULL if no channel is playing. */ int GetTotalTime(void) const; /*! * @brief Get the current position in milliseconds since the start of a LiveTV item. * @return The position in milliseconds or NULL if no channel is playing. */ int GetStartTime(void) const; /*! * @brief Start playback on a channel. * @param channel The channel to start to play. * @param bPreview If true, open minimised. * @return True if playback was started, false otherwise. */ bool StartPlayback(const CPVRChannel *channel, bool bPreview = false); /*! * @brief Start playback of the last used channel, and if it fails use first channel in the current channelgroup. * @param type The type of playback to be started (any, radio, tv). See PlaybackType enum * @return True if playback was started, false otherwise. */ bool StartPlayback(PlaybackType type = PlaybackTypeAny); /*! * @brief Update the current playing file in the guiinfomanager and application. */ void UpdateCurrentFile(void); /*! * @brief Check whether names are still correct after the language settings changed. */ void LocalizationChanged(void); /*! * @brief Check if a TV channel is playing. * @return True if it's playing, false otherwise. */ bool IsPlayingTV(void) const; /*! * @brief Check if a radio channel is playing. * @return True if it's playing, false otherwise. */ bool IsPlayingRadio(void) const; /*! * @brief Check if a recording is playing. * @return True if it's playing, false otherwise. */ bool IsPlayingRecording(void) const; /*! * @return True when a channel scan is currently running, false otherwise. */ bool IsRunningChannelScan(void) const; /*! * @brief Open a selection dialog and start a channel scan on the selected client. */ void StartChannelScan(void); /*! * @brief Try to find missing channel icons automatically */ void SearchMissingChannelIcons(void); /*! * @brief Persist the current channel settings in the database. */ void SaveCurrentChannelSettings(void); /*! * @brief Load the settings for the current channel from the database. */ void LoadCurrentChannelSettings(void); /*! * @brief Check if channel is parental locked. Ask for PIN if neccessary. * @param channel The channel to open. * @return True if channel is unlocked (by default or PIN unlocked), false otherwise. */ bool CheckParentalLock(const CPVRChannel &channel); /*! * @brief Check if parental lock is overriden at the given moment. * @param channel The channel to open. * @return True if parental lock is overriden, false otherwise. */ bool IsParentalLocked(const CPVRChannel &channel); /*! * @brief Open Numeric dialog to check for parental PIN. * @param strTitle Override the title of the dialog if set. * @return True if entered PIN was correct, false otherwise. */ bool CheckParentalPIN(const char *strTitle = NULL); /*! * @brief Executes "pvrpowermanagement.setwakeupcmd" */ bool SetWakeupCommand(void); /*! * @brief Wait until the pvr manager is loaded * @return True when loaded, false otherwise */ bool WaitUntilInitialised(void); /*! * @brief Handle PVR specific cActions * @param action The action to process * @return True if action could be handled, false otherwise. */ bool OnAction(const CAction &action); static void SettingOptionsPvrStartLastChannelFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current); /*! * @brief Create EPG tags for all channels in internal channel groups * @return True if EPG tags where created successfully, false otherwise */ bool CreateChannelEpgs(void); protected: /*! * @brief PVR update and control thread. */ virtual void Process(void); private: /*! * @brief Load at least one client and load all other PVR data after loading the client. * If some clients failed to load here, the pvrmanager will retry to load them every second. * @return If at least one client and all pvr data was loaded, false otherwise. */ bool Load(void); /*! * @brief Update all recordings. */ void UpdateRecordings(void); /*! * @brief Update all timers. */ void UpdateTimers(void); /*! * @brief Update all channels. */ void UpdateChannels(void); /*! * @brief Update all channel groups and channels in them. */ void UpdateChannelGroups(void); /*! * @brief Reset all properties. */ void ResetProperties(void); /*! * @brief Called by ChannelUp() and ChannelDown() to perform a channel switch. * @param iNewChannelNumber The new channel number after the switch. * @param bPreview Preview window if true. * @param bUp Go one channel up if true, one channel down if false. * @return True if the switch was successful, false otherwise. */ bool ChannelUpDown(unsigned int *iNewChannelNumber, bool bPreview, bool bUp); /*! * @brief Stop the EPG and PVR threads but do not remove their data. */ void StopUpdateThreads(void); /*! * @brief Restart the EPG and PVR threads after they've been stopped by StopUpdateThreads() */ bool StartUpdateThreads(void); /*! * @brief Continue playback on the last channel if it was stored in the database. * @return True if playback was continued, false otherwise. */ bool ContinueLastChannel(void); /*! * @brief Show or update the progress dialog. * @param strText The current status. * @param iProgress The current progress in %. */ void ShowProgressDialog(const CStdString &strText, int iProgress); /*! * @brief Hide the progress dialog if it's visible. */ void HideProgressDialog(void); void ExecutePendingJobs(void); bool IsJobPending(const char *strJobName) const; ManagerState GetState(void) const; void SetState(ManagerState state); /** @name containers */ //@{ CPVRChannelGroupsContainer * m_channelGroups; /*!< pointer to the channel groups container */ CPVRRecordings * m_recordings; /*!< pointer to the recordings container */ CPVRTimers * m_timers; /*!< pointer to the timers container */ CPVRClients * m_addons; /*!< pointer to the pvr addon container */ CPVRGUIInfo * m_guiInfo; /*!< pointer to the guiinfo data */ //@} CCriticalSection m_critSectionTriggers; /*!< critical section for triggered updates */ CEvent m_triggerEvent; /*!< triggers an update */ std::vector<CJob *> m_pendingUpdates; /*!< vector of pending pvr updates */ CFileItem * m_currentFile; /*!< the PVR file that is currently playing */ CPVRDatabase * m_database; /*!< the database for all PVR related data */ CCriticalSection m_critSection; /*!< critical section for all changes to this class, except for changes to triggers */ bool m_bFirstStart; /*!< true when the PVR manager was started first, false otherwise */ bool m_bIsSwitchingChannels; /*!< true while switching channels */ bool m_bEpgsCreated; /*!< true if epg data for channels has been created */ CGUIDialogProgressBarHandle * m_progressHandle; /*!< progress dialog that is displayed while the pvrmanager is loading */ CCriticalSection m_managerStateMutex; ManagerState m_managerState; CStopWatch *m_parentalTimer; bool m_bOpenPVRWindow; std::map<std::string, std::string> m_outdatedAddons; }; class CPVREpgsCreateJob : public CJob { public: CPVREpgsCreateJob(void) {} virtual ~CPVREpgsCreateJob() {} virtual const char *GetType() const { return "pvr-create-epgs"; } virtual bool DoWork(); }; class CPVRRecordingsUpdateJob : public CJob { public: CPVRRecordingsUpdateJob(void) {} virtual ~CPVRRecordingsUpdateJob() {} virtual const char *GetType() const { return "pvr-update-recordings"; } virtual bool DoWork(); }; class CPVRTimersUpdateJob : public CJob { public: CPVRTimersUpdateJob(void) {} virtual ~CPVRTimersUpdateJob() {} virtual const char *GetType() const { return "pvr-update-timers"; } virtual bool DoWork(); }; class CPVRChannelsUpdateJob : public CJob { public: CPVRChannelsUpdateJob(void) {} virtual ~CPVRChannelsUpdateJob() {} virtual const char *GetType() const { return "pvr-update-channels"; } virtual bool DoWork(); }; class CPVRChannelGroupsUpdateJob : public CJob { public: CPVRChannelGroupsUpdateJob(void) {} virtual ~CPVRChannelGroupsUpdateJob() {} virtual const char *GetType() const { return "pvr-update-channelgroups"; } virtual bool DoWork(); }; class CPVRChannelSettingsSaveJob : public CJob { public: CPVRChannelSettingsSaveJob(void) {} virtual ~CPVRChannelSettingsSaveJob() {} virtual const char *GetType() const { return "pvr-save-channelsettings"; } bool DoWork(); }; class CPVRChannelSwitchJob : public CJob { public: CPVRChannelSwitchJob(CFileItem* previous, CFileItem* next) : m_previous(previous), m_next(next) {} virtual ~CPVRChannelSwitchJob() {} virtual const char *GetType() const { return "pvr-channel-switch"; } virtual bool DoWork(); private: CFileItem* m_previous; CFileItem* m_next; }; }
CharlieMarshall/xbmc
xbmc/pvr/PVRManager.h
C
gpl-2.0
22,946
#!/bin/sh # Start telnet server eval `flash TELNET_ACCESS_PORT WEB_WAN_ACCESS_PORT TR069_ENABLED` if [ -x "/usr/sbin/telnetd" ]; then echo -n $TELNET_ACCESS_PORT > /var/telnet_port /usr/sbin/telnetd -l /bin/cli -p $TELNET_ACCESS_PORT fi # Start debug telnet server #eval `flash DEBUG` #if [ $DEBUG = 1 ]; then # telnetd -p 1023 #fi # start web server echo -n $WEB_WAN_ACCESS_PORT > /var/websv_port ln -sf /web /var/www watcher /bin/websv -p $WEB_WAN_ACCESS_PORT & # Daemon to monitor reset button and reset config # btnreset & # Remote tr069 management if [ "$TR069_ENABLED" = 'Enabled' ]; then echo 'Starting TR069 agent' watcher /bin/cpeagent -F /etc/tr069/ -W /tmp/ & fi # Sysctl parameters sysctl.sh # Ready ledctl 4
xandlom/keenetic-firmware
package/base-scripts/all/services.sh
Shell
gpl-2.0
732
//----------------------------------------------------------------------------- // Class: Block Manager // Authors: LiXizhi, Clayman // Emails: LiXizhi@yeah.net // Company: ParaEngine // Date: 2012.11.26 //----------------------------------------------------------------------------- #include "ParaEngine.h" #include "SceneObject.h" #include "EffectManager.h" #include "OceanManager.h" #include "ParaVertexBufferPool.h" #include "ShadowMap.h" #ifdef USE_DIRECTX_RENDERER #include "DirectXEngine.h" #endif #include "SunLight.h" #include "BaseCamera.h" #include "ParaWorldAsset.h" #include "terrain/GlobalTerrain.h" #include "WorldInfo.h" #include "BlockCommon.h" #include "BlockRegion.h" #include "terrain/Settings.h" #include "IBatchedElementDraw.h" #include "AISimulator.h" #include "NPLRuntime.h" #include "BlockLightGridClient.h" #include "ParaEngineSettings.h" #include "ViewportManager.h" #include "LightObject.h" #include "NPLHelper.h" #include "util/os_calls.h" #include "ChunkVertexBuilderManager.h" #include "MultiFrameBlockWorldRenderer.h" #include "BlockWorldClient.h" #include "ParaScriptingCommon.h" #include "ParaScriptingMisc.h" /** default block light color. due to shader optimization, there can only be one color for all emissive blocks. * ARBG: it is usually white or yellow(red) color. */ // #define DEFAULT_BLOCK_LIGHT_COLOR 0xffffffff #define DEFAULT_BLOCK_LIGHT_COLOR 0xffffffff // define to output log for debugging. //#define PRINT_CHUNK_LOG #ifdef PRINT_CHUNK_LOG #include "ParaTime.h" #endif namespace ParaEngine { BlockWorldClient* BlockWorldClient::g_pInstance = NULL; int32_t BlockWorldClient::g_TexPass = 0; int32_t BlockWorldClient::g_twoTexPass = 1; int32_t BlockWorldClient::g_TexNormalMapPass = 2; int32_t BlockWorldClient::g_twoTexNormalMapPass = 3; // not used. #ifdef PARAENGINE_MOBILE int32_t BlockWorldClient::g_transparentBlockPass = 2; int32_t BlockWorldClient::g_waterBlockPass = 2; int32_t BlockWorldClient::g_bumpyBlockPass = 1; #else int32_t BlockWorldClient::g_transparentBlockPass = 3; int32_t BlockWorldClient::g_waterBlockPass = 4; int32_t BlockWorldClient::g_bumpyBlockPass = 5; #endif int32_t BlockWorldClient::g_selectBlockPass = 1; inline int64_t GetBlockSparseIndex(int64_t bx, int64_t by, int64_t bz) { return by * 30000 * 30000 + bx * 30000 + bz; } ////////////////////////////////////////////////////////////////////////// //BlockWorldClient ////////////////////////////////////////////////////////////////////////// BlockWorldClient::BlockWorldClient() :m_maxSelectBlockPerBatch(80), m_isUnderLiquid(false), m_vBlockLightColor(DEFAULT_BLOCK_LIGHT_COLOR), m_nBufferRebuildCountThisTick(0), m_bUsePointTextureFiltering(true), m_nVertexBufferSizeLimit(100 * 1024 * 1024), m_nMaxVisibleVertexBufferBytes(100 * 1024 * 1024), m_nAlwaysInVertexBufferChunkRadius(2), m_pMultiFrameRenderer(NULL), #ifdef USE_DIRECTX_RENDERER m_pDepthStencilSurface(NULL), m_render_target_block_info_surface(NULL), m_render_target_depth_tex_surface(NULL), m_render_target_normal_surface(NULL), m_pOldRenderTarget(NULL), m_pOldZBuffer(NULL), #endif m_bUseSunlightShadowMap(true), m_bUseWaterReflection(true), m_bMovieOutputMode(false), m_bAsyncChunkMode(true) { g_pInstance = this; m_damageDegree = 0; #if defined(PARAENGINE_CLIENT) || defined(WIN32) m_nMaxBufferRebuildPerTick = 4; m_nNearCameraChunkDist = 8; m_nMaxBufferRebuildPerTick_FarChunk = 2; m_nVertexBufferSizeLimit = 200 * 1024 * 1024; m_nMaxVisibleVertexBufferBytes = (100 * 1024 * 1024); #else m_nMaxBufferRebuildPerTick = 4; m_nNearCameraChunkDist = 6; m_nMaxBufferRebuildPerTick_FarChunk = 2; m_nVertexBufferSizeLimit = 100 * 1024 * 1024; m_nMaxVisibleVertexBufferBytes = (50 * 1024 * 1024); #endif #ifdef PARAENGINE_MOBILE SetGroupByChunkBeforeTexture(true); #endif SAFE_DELETE(m_pLightGrid); m_pLightGrid = new CBlockLightGridClient(m_activeChunkDim + 2, this); // ensure that all vertices can be indexed by uint16 index buffer. PE_ASSERT((BlockConfig::g_maxFaceCountPerBatch * 4) <= 0xffff); RenderableChunk::GetVertexBufferPool()->SetFullSizedBufferSize(BlockConfig::g_maxFaceCountPerBatch * sizeof(BlockVertexCompressed) * 4); // 6MB at most RenderableChunk::GetVertexBufferPool()->SetMaxPooledCount(6000000 / RenderableChunk::GetVertexBufferPool()->GetFullSizedBufferSize()); m_pMultiFrameRenderer = new CMultiFrameBlockWorldRenderer(this); } BlockWorldClient::~BlockWorldClient() { DeleteDeviceObjects(); SAFE_DELETE(m_pMultiFrameRenderer); for (int i = 0; i < (int)(m_activeChunks.size()); ++i) { SAFE_DELETE(m_activeChunks[i]); } m_activeChunks.clear(); ChunkVertexBuilderManager::GetInstance().Cleanup(); RenderableChunk::StaticRelease(); } void BlockWorldClient::EnterWorld(const string& sWorldDir, float x, float y, float z) { if (m_isInWorld) return; ChunkVertexBuilderManager::GetInstance().StartChunkBuildThread(this); Scoped_WriteLock<BlockReadWriteLock> lock_(GetReadWriteLock()); CBlockWorld::EnterWorld(sWorldDir, x, y, z); } void BlockWorldClient::Cleanup() { DeleteDeviceObjects(); for (int i = 0; i < BLOCK_GROUP_ID_MAX; ++i) { m_highLightTextures[i].reset(); } } void BlockWorldClient::LeaveWorld() { if (!m_isInWorld) return; ChunkVertexBuilderManager::GetInstance().Cleanup(); Scoped_WriteLock<BlockReadWriteLock> lock_(GetReadWriteLock()); Cleanup(); CBlockWorld::LeaveWorld(); } void BlockWorldClient::DeleteAllBlocks() { Scoped_WriteLock<BlockReadWriteLock> lock_(GetReadWriteLock()); for (std::map<int, BlockRegion*>::iterator iter = m_regionCache.begin(); iter != m_regionCache.end(); iter++) { iter->second->DeleteAllBlocks(); } for (uint32_t i = 0; i < m_activeChunks.size(); i++) { m_activeChunks[i]->SetChunkDirty(true); } m_isVisibleChunkDirty = true; } void BlockWorldClient::PreRender(bool bIsShadowPass) { if (!m_isInWorld) return; Vector3 camWorldPos = CGlobals::GetSceneState()->vEye; Uint16x3 camBlockPos; BlockCommon::ConvertToBlockIndex(camWorldPos.x, camWorldPos.y, camWorldPos.z, camBlockPos.x, camBlockPos.y, camBlockPos.z); SetEyeBlockId(camBlockPos); Block* eye_block = GetBlock(camBlockPos.x, camBlockPos.y, camBlockPos.z); if (eye_block && eye_block->GetTemplate()) { m_isUnderLiquid = eye_block->GetTemplate()->IsMatchAttribute(BlockTemplate::batt_liquid); } else m_isUnderLiquid = false; if (!bIsShadowPass) GetLightGrid().UpdateLighting(); //perform culling and refresh render buffers if dirty. m_nBufferRebuildCountThisTick = 0; if (m_isVisibleChunkDirty || (GetBlockRenderMethod() == BLOCK_RENDER_FANCY_SHADER && GetUseSunlightShadowMap())) UpdateVisibleChunks(bIsShadowPass); m_solidRenderTasks.clear(); m_alphaTestRenderTasks.clear(); m_alphaBlendRenderTasks.clear(); m_reflectedWaterRenderTasks.clear(); //fill render task Vector3 renderOfs = CGlobals::GetScene()->GetRenderOrigin(); float verticalOffset = GetVerticalOffset(); if (!bIsShadowPass) ChunkVertexBuilderManager::GetInstance().UploadPendingChunksToDevice(); if (IsRenderBlocks()) { // please note m_visibleChunks is already arranged in a spiral pattern around the eye. // hence the closer ones get updated sooner. m_nBufferRebuildCountThisTick = 0; CheckRebuildVisibleChunks(m_bAsyncChunkMode, bIsShadowPass); ClearVisibleChunksToByteLimit(bIsShadowPass); #ifdef PRINT_CHUNK_LOG static int64 g_lastTime = GetTimeUS(); int64 curTime = GetTimeUS(); if (m_nBufferRebuildCountThisTick > 0) { OUTPUT_LOG("deltaTime: %d ms: chunk buffer update this tick %d\n", (int)(curTime - g_lastTime) / 1000, (int)m_nBufferRebuildCountThisTick); } g_lastTime = curTime; #endif for (uint32 i = 0; i < m_visibleChunks.size(); i++) { m_visibleChunks[i]->FillRenderQueue(this, renderOfs, verticalOffset); } } //sort data if (!IsGroupByChunkBeforeTexture()) { if (m_solidRenderTasks.size() > 0) sort(m_solidRenderTasks.begin(), m_solidRenderTasks.end(), CompareRenderOrder); } if (m_alphaTestRenderTasks.size() > 0) sort(m_alphaTestRenderTasks.begin(), m_alphaTestRenderTasks.end(), CompareRenderOrder); if (m_alphaBlendRenderTasks.size() > 0) sort(m_alphaBlendRenderTasks.begin(), m_alphaBlendRenderTasks.end(), CompareRenderOrder); if (m_reflectedWaterRenderTasks.size() > 0) sort(m_reflectedWaterRenderTasks.begin(), m_reflectedWaterRenderTasks.end(), CompareRenderOrder); } void BlockWorldClient::RenderShadowMap() { #ifdef USE_DIRECTX_RENDERER // only render shadow map for fancy shader mode. if ((GetBlockRenderMethod() != BLOCK_RENDER_FANCY_SHADER) || !GetUseSunlightShadowMap()) return; // prepare shadow pass PreRender(true); // make sure all shaders are replaced. PrepareAllRenderTargets(false); if (m_alphaTestRenderTasks.size() == 0 && m_solidRenderTasks.size() == 0 && m_alphaBlendRenderTasks.size() == 0) return; if (m_block_effect_fancy == 0) return; m_block_effect_fancy->LoadAsset(); const float fBlockSize = BlockConfig::g_blockSize; Vector3 renderOfs = CGlobals::GetScene()->GetRenderOrigin(); float verticalOffset = GetVerticalOffset(); Uint16x3 renderBlockOfs; renderBlockOfs.x = (uint16_t)(renderOfs.x / fBlockSize); renderBlockOfs.z = (uint16_t)(renderOfs.z / fBlockSize); Vector3 renderBlockOfs_remain; renderBlockOfs_remain.x = renderOfs.x - renderBlockOfs.x * fBlockSize; renderBlockOfs_remain.z = renderOfs.z - renderBlockOfs.z * fBlockSize; EffectManager* pEffectManager = CGlobals::GetEffectManager(); RenderDevicePtr pDevice = CGlobals::GetRenderDevice(); IScene* pScene = CGlobals::GetEffectManager()->GetScene(); CBaseCamera* pCamera = pScene->GetCurrentCamera(); Matrix4 matViewProj; if (pCamera) { const Matrix4& pView = (CGlobals::GetEffectManager()->GetViewTransform()); const Matrix4& pProj = (CGlobals::GetEffectManager()->GetProjTransform()); matViewProj = (pView) * (pProj); } CEffectFile* pEffect = NULL; pEffectManager->BeginEffect(TECH_BLOCK_FANCY, &pEffect); if (pEffect != 0 && pEffect->begin(false)) { VertexDeclarationPtr pVertexLayout = GetVertexLayout(); pDevice->SetVertexDeclaration(pVertexLayout); // turn off alpha blending to enable early-Z on modern graphic cards. pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); ////////////////////////////////////////////////////////////////////////// // set the wave time parameter double time = CGlobals::GetGameTime(); // in case it loses accuracy, we will subtract integer number of 2*PI from time // time -= ((int)(time / (2*MATH_PI)))*(2*MATH_PI); time = (int)(time * 1000) % 1000000; pEffect->setParameter(CEffectFile::k_ConstVector1, Vector4((float)time, 0.f, 0.f, 0.f).ptr()); IDirect3DIndexBuffer9* pIndexBuffer = GetIndexBuffer(); pDevice->SetIndices(pIndexBuffer); for (int nRenderPass = 0; nRenderPass <= BlockRenderPass_AlphaBlended; nRenderPass++) { std::vector<BlockRenderTask*>* pCurRenderQueue = GetRenderQueueByPass((BlockRenderPass)nRenderPass); IDirect3DVertexBuffer9* pCurVB = NULL; uint16_t curTamplerId = 0; int32_t curPass = -1; D3DCULL culling = D3DCULL_CCW; IDirect3DTexture9* pCurTex0 = NULL; if (pCurRenderQueue->size() > 0) { for (uint32_t i = 0; i < pCurRenderQueue->size(); i++) { BlockRenderTask* pRenderTask = (*pCurRenderQueue)[i]; IDirect3DVertexBuffer9* pVB = pRenderTask->GetVertexBuffer(); if (pVB != pCurVB) { pDevice->SetStreamSource(0, pVB, 0, sizeof(BlockVertexCompressed)); pCurVB = pVB; } int32_t passId = 0; if (curTamplerId != pRenderTask->GetTemplateId()) { BlockTemplate* pTempate = pRenderTask->GetTemplate(); if (pTempate->IsShadowCaster()) { passId = 0; } if (curPass != passId) { if (curPass > -1) pEffect->EndPass(); if (pEffect->BeginPass(passId)) { curPass = passId; } else { curPass = -1; continue; } } TextureEntity* pTexEntity = pTempate->GetTexture0(pRenderTask->GetUserData()); if (pTexEntity && pTexEntity->GetTexture() != pCurTex0) { pCurTex0 = pTexEntity->GetTexture(); pDevice->SetTexture(0, pCurTex0); } // culling mode if (pTempate->GetBlockModel().IsDisableFaceCulling()) { if (culling != D3DCULL_NONE) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); culling = D3DCULL_NONE; } } else if (nRenderPass != BlockRenderPass_Opaque && m_isUnderLiquid && pRenderTask->GetTemplate()->IsMatchAttribute(BlockTemplate::batt_liquid)) { if (culling != D3DCULL_CW) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); culling = D3DCULL_CW; } } else { if (culling != D3DCULL_CCW) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); culling = D3DCULL_CCW; } } } Matrix4 vWorldMatrix(Matrix4::IDENTITY); Uint16x3& vMinPos = pRenderTask->GetMinBlockPos(); vWorldMatrix._11 = vWorldMatrix._22 = vWorldMatrix._33 = fBlockSize; vWorldMatrix._41 = (vMinPos.x - renderBlockOfs.x)*fBlockSize - renderBlockOfs_remain.x; vWorldMatrix._42 = vMinPos.y * fBlockSize - renderOfs.y + verticalOffset; vWorldMatrix._43 = (vMinPos.z - renderBlockOfs.z)*fBlockSize - renderBlockOfs_remain.z; vWorldMatrix = vWorldMatrix * matViewProj; pEffect->setMatrix(CEffectFile::k_worldViewProjMatrix, &vWorldMatrix); pEffect->CommitChanges(); pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, pRenderTask->GetVertexOfs(), pRenderTask->GetVertexCount(), pRenderTask->GetIndexOfs(), pRenderTask->GetPrimitiveCount()); } } if (curPass > -1) pEffect->EndPass(); pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); } // turn blending on again pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); pEffect->end(); } #endif } void BlockWorldClient::Render(BlockRenderPass nRenderPass, std::vector<BlockRenderTask*>* pCurRenderQueue, int nRenderMethod) { if (!m_isInWorld) return; BlockRenderMethod dwRenderMethod = (nRenderMethod < 0) ? GetBlockRenderMethod() : (BlockRenderMethod)nRenderMethod; // no need to lock if (pCurRenderQueue == 0) pCurRenderQueue = GetRenderQueueByPass(nRenderPass); RenderDevicePtr pDevice = CGlobals::GetRenderDevice(); if (pCurRenderQueue->size() > 0) { const float fBlockSize = BlockConfig::g_blockSize; Vector3 renderOfs = CGlobals::GetScene()->GetRenderOrigin(); float verticalOffset = GetVerticalOffset(); Uint16x3 renderBlockOfs; renderBlockOfs.x = (uint16_t)(renderOfs.x / fBlockSize); renderBlockOfs.z = (uint16_t)(renderOfs.z / fBlockSize); Vector3 renderBlockOfs_remain; renderBlockOfs_remain.x = renderOfs.x - renderBlockOfs.x * fBlockSize; renderBlockOfs_remain.z = renderOfs.z - renderBlockOfs.z * fBlockSize; EffectManager* pEffectManager = CGlobals::GetEffectManager(); CEffectFile* pEffect = NULL; if (dwRenderMethod == BLOCK_RENDER_FANCY_SHADER) { if (nRenderPass != BlockRenderPass_AlphaBlended) { if (!PrepareAllRenderTargets()) { // try a lower shader other than fancy SetBlockRenderMethod(BLOCK_RENDER_FAST_SHADER); return; } pEffectManager->BeginEffect(TECH_BLOCK_FANCY, &pEffect); if (pEffect == 0) { // try a lower shader other than fancy ; SetBlockRenderMethod(BLOCK_RENDER_FAST_SHADER); return; } } else { // use ordinary shader for alpha blended blocks. pEffectManager->BeginEffect(TECH_BLOCK, &pEffect); } } else if (dwRenderMethod == BLOCK_RENDER_FAST_SHADER) { pEffectManager->BeginEffect(TECH_BLOCK, &pEffect); } else if (dwRenderMethod == BLOCK_RENDER_FIXED_FUNCTION) { pEffectManager->BeginEffect(TECH_BLOCK, &pEffect); } // CEffectFile* pEffect = pEffectManager->GetCurrentEffectFile(); if (nRenderPass == BlockRenderPass_AlphaBlended || nRenderPass == BlockRenderPass_ReflectedWater) { pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); } else { if (nRenderPass == BlockRenderPass_AlphaTest) pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); // turn off alpha blending to enable early-Z on modern graphic cards. pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); } if (pEffect == 0) { #ifdef USE_DIRECTX_RENDERER if (dwRenderMethod != BLOCK_RENDER_FIXED_FUNCTION) { SetBlockRenderMethod(BLOCK_RENDER_FIXED_FUNCTION); return; } ////////////////////////////////////////////////////////////////////////// // render using fixed function pipeline pDevice->SetFVF(block_vertex::FVF); IDirect3DIndexBuffer9* pIndexBuffer = GetIndexBuffer(); pDevice->SetIndices(pIndexBuffer); IDirect3DVertexBuffer9* pCurVB = NULL; uint16_t curTamplerId = 0; int32_t curPass = -1; D3DCULL culling = D3DCULL_CCW; IDirect3DTexture9* pCurTex0 = NULL; IDirect3DTexture9* pCurTex1 = NULL; IDirect3DTexture9* pCurTex2 = NULL; pDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE); pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_DIFFUSE | D3DTA_ALPHAREPLICATE); for (uint32_t i = 0; i < pCurRenderQueue->size(); i++) { BlockRenderTask* pRenderTask = (*pCurRenderQueue)[i]; IDirect3DVertexBuffer9* pVB = pRenderTask->GetVertexBuffer(); if (pVB != pCurVB) { pDevice->SetStreamSource(0, pVB, 0, sizeof(BlockVertexCompressed)); pCurVB = pVB; } int32_t passId; if (curTamplerId != pRenderTask->GetTemplateId()) { BlockTemplate* pTempate = pRenderTask->GetTemplate(); if (pTempate->IsMatchAttribute(BlockTemplate::batt_twoTexture)) passId = g_twoTexPass; else if (pTempate->IsMatchAttribute(BlockTemplate::batt_transparent)) passId = g_transparentBlockPass; else passId = g_TexPass; if (curPass != passId) { curPass = passId; if (passId == 0) { pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); } else if (passId == 1) { pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); } else if (passId == 2) { pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); } else if (passId == 3) { pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); } else { curPass = -1; continue; } } TextureEntity* pTexEntity = pTempate->GetTexture0(pRenderTask->GetUserData()); if (pTexEntity && pTexEntity->GetTexture() != pCurTex0) { pCurTex0 = pTexEntity->GetTexture(); pDevice->SetTexture(0, pCurTex0); } pTexEntity = pTempate->GetTexture1(); if (pTexEntity && pTexEntity->GetTexture() != pCurTex1) { pCurTex1 = pTexEntity->GetTexture(); pDevice->SetTexture(1, pCurTex1); } /* fixed function never use normal map pTexEntity = pTempate->GetNormalMap(); if(pTexEntity && pTexEntity->GetTexture()!=pCurTex2) { pCurTex2 = pTexEntity->GetTexture(); pDevice->SetTexture(2,pCurTex2); }*/ // culling mode if (pTempate->GetBlockModel().IsDisableFaceCulling()) { if (culling != D3DCULL_NONE) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); culling = D3DCULL_NONE; } } else if (nRenderPass != BlockRenderPass_Opaque && m_isUnderLiquid && pRenderTask->GetTemplate()->IsMatchAttribute(BlockTemplate::batt_liquid)) { if (culling != D3DCULL_CW) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); culling = D3DCULL_CW; } } else { if (culling != D3DCULL_CCW) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); culling = D3DCULL_CCW; } } } Matrix4 vWorldMatrix(Matrix4::IDENTITY); Uint16x3& vMinPos = pRenderTask->GetMinBlockPos(); vWorldMatrix._11 = vWorldMatrix._22 = vWorldMatrix._33 = fBlockSize; vWorldMatrix._41 = (vMinPos.x - renderBlockOfs.x)*fBlockSize - renderBlockOfs_remain.x; vWorldMatrix._42 = vMinPos.y * fBlockSize - renderOfs.y + verticalOffset; vWorldMatrix._43 = (vMinPos.z - renderBlockOfs.z)*fBlockSize - renderBlockOfs_remain.z; pDevice->SetTransform(D3DTS_WORLD, vWorldMatrix.GetPointer()); RenderDevice::DrawIndexedPrimitive(pDevice, RenderDevice::DRAW_PERF_TRIANGLES_TERRAIN, D3DPT_TRIANGLELIST, 0, pRenderTask->GetVertexOfs(), pRenderTask->GetVertexCount(), pRenderTask->GetIndexOfs(), pRenderTask->GetPrimitiveCount()); } pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); pDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE); pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE); #endif } else if (pEffect != 0 && pEffect->begin(false)) { #ifdef USE_OPENGL_RENDERER if (nRenderPass == BlockRenderPass_AlphaTest) { // ParaEngine's opengl renderer currently does not support shared uniforms between passes, so do this. // Remove this: when you support it. pEffect->BeginPass(g_transparentBlockPass); pEffect->EndPass(); } CGlobals::GetEffectManager()->applyFogParameters(); if (CGlobals::GetEffectManager()->IsUsingShadowMap()) CGlobals::GetEffectManager()->GetShadowMap()->SetShadowTexture(*pEffect, 1); else CGlobals::GetEffectManager()->GetShadowMap()->UnsetShadowTexture(1); #endif VertexDeclarationPtr pVertexLayout = GetVertexLayout(); pDevice->SetVertexDeclaration(pVertexLayout); if (dwRenderMethod == BLOCK_RENDER_FANCY_SHADER) { ////////////////////////////////////////////////////////////////////////// // set the wave time parameter double time = CGlobals::GetGameTime(); // in case it loses accuracy, we will subtract integer number of 2*PI from time // time -= ((int)(time / (2*MATH_PI)))*(2*MATH_PI); time = (int)(time * 1000) % 1000000; pEffect->setParameter(CEffectFile::k_ConstVector1, Vector4((float)time, 0.f, 0.f, 0.f).ptr()); } else { Vector3 vDir = -CGlobals::GetScene()->GetSunLight().GetSunDirection(); Vector4 vDir_(vDir.x, vDir.y, vDir.z, 1.0f); pEffect->setParameter(CEffectFile::k_sunVector, &vDir_); } IndexBufferDevicePtr_type pIndexBuffer = GetIndexBuffer(); pDevice->SetIndices(pIndexBuffer); VertexBufferDevicePtr_type pCurVB = 0; uint16_t curTamplerId = 0; int32_t curPass = -1; D3DCULL culling = D3DCULL_CCW; DeviceTexturePtr_type pCurTex0 = 0; DeviceTexturePtr_type pCurTex1 = 0; DeviceTexturePtr_type pCurTex2 = 0; IScene* pScene = CGlobals::GetEffectManager()->GetScene(); CBaseCamera* pCamera = pScene->GetCurrentCamera(); Matrix4 matViewProj; if (pCamera) { const Matrix4& pView = (CGlobals::GetEffectManager()->GetViewTransform()); const Matrix4& pProj = (CGlobals::GetEffectManager()->GetProjTransform()); matViewProj = (pView) * (pProj); } /** block light params and sun intensity*/ Vector4 vLightParams(m_vBlockLightColor.r, m_vBlockLightColor.g, m_vBlockLightColor.b, m_sunIntensity); pEffect->setParameter(CEffectFile::k_ConstVector0, (const void*)(&vLightParams)); for (uint32_t i = 0; i < pCurRenderQueue->size(); i++) { BlockRenderTask* pRenderTask = (*pCurRenderQueue)[i]; VertexBufferDevicePtr_type pVB = pRenderTask->GetVertexBuffer(); if (pVB != pCurVB) { pDevice->SetStreamSource(0, pVB, 0, sizeof(BlockVertexCompressed)); pCurVB = pVB; } int32_t passId; if (curTamplerId != pRenderTask->GetTemplateId()) { BlockTemplate* pTempate = pRenderTask->GetTemplate(); if (pTempate->IsMatchAttribute(BlockTemplate::batt_twoTexture)) passId = g_twoTexPass; else if (nRenderPass == BlockRenderPass_AlphaTest) { passId = g_transparentBlockPass; } else if (nRenderPass == BlockRenderPass_AlphaBlended || nRenderPass == BlockRenderPass_ReflectedWater) { passId = g_TexPass; if (pTempate->GetCategoryID() == 8 && dwRenderMethod == BLOCK_RENDER_FANCY_SHADER) { passId = g_waterBlockPass; } } else if (pTempate->GetNormalMap() && dwRenderMethod == BLOCK_RENDER_FANCY_SHADER) { passId = g_bumpyBlockPass; } else passId = g_TexPass; if (curPass != passId) { if (curPass > -1) pEffect->EndPass(); if (pEffect->BeginPass(passId)) { curPass = passId; pCurTex0 = 0; pCurTex1 = 0; pCurTex2 = 0; // pEffect->setMatrix(CEffectFile::k_viewProjMatrix, &matViewProj); // pDevice->SetVertexShaderConstantF(0,&matViewProj._11,4); } else { curPass = -1; continue; } } TextureEntity* pTexEntity = pTempate->GetTexture0(pRenderTask->GetUserData()); if (pTexEntity && pTexEntity->GetTexture() != pCurTex0) { pCurTex0 = pTexEntity->GetTexture(); pDevice->SetTexture(0, pCurTex0); } pTexEntity = pTempate->GetTexture1(); if (pTexEntity && pTexEntity->GetTexture() != pCurTex1) { pCurTex1 = pTexEntity->GetTexture(); pDevice->SetTexture(1, pCurTex1); } pTexEntity = pTempate->GetNormalMap(); if (pTexEntity && pTexEntity->GetTexture() != pCurTex2) { pCurTex2 = pTexEntity->GetTexture(); if (dwRenderMethod == BLOCK_RENDER_FANCY_SHADER) { pDevice->SetTexture(2, pCurTex2); } } // culling mode if (pTempate->GetBlockModel().IsDisableFaceCulling()) { if (culling != D3DCULL_NONE) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); culling = D3DCULL_NONE; } } else if (nRenderPass != BlockRenderPass_Opaque && m_isUnderLiquid && pRenderTask->GetTemplate()->IsMatchAttribute(BlockTemplate::batt_liquid)) { if (culling != D3DCULL_CW) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); culling = D3DCULL_CW; } } else { if (culling != D3DCULL_CCW) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); culling = D3DCULL_CCW; } } } // Matrix4 vWorldMatrix(Matrix4::IDENTITY); Uint16x3& vMinPos = pRenderTask->GetMinBlockPos(); vWorldMatrix._11 = vWorldMatrix._22 = vWorldMatrix._33 = fBlockSize; vWorldMatrix._41 = (vMinPos.x - renderBlockOfs.x)*fBlockSize - renderBlockOfs_remain.x; vWorldMatrix._42 = vMinPos.y * fBlockSize - renderOfs.y + verticalOffset; vWorldMatrix._43 = (vMinPos.z - renderBlockOfs.z)*fBlockSize - renderBlockOfs_remain.z; Matrix4 mWorldViewProj; mWorldViewProj = vWorldMatrix * matViewProj; pEffect->setMatrix(CEffectFile::k_worldViewProjMatrix, &mWorldViewProj); if (pEffect->isMatrixUsed(CEffectFile::k_worldViewMatrix)) { Matrix4 mWorldView; ParaMatrixMultiply(&mWorldView, &vWorldMatrix, &matViewProj); pEffect->setMatrix(CEffectFile::k_worldViewMatrix, &mWorldView); } if (CGlobals::GetEffectManager()->IsUsingShadowMap() && pEffect->isMatrixUsed(CEffectFile::k_TexWorldViewProjMatrix)) { Matrix4 mTex; ParaMatrixMultiply(&mTex, &vWorldMatrix, CGlobals::GetEffectManager()->GetTexViewProjMatrix()); pEffect->setMatrix(CEffectFile::k_TexWorldViewProjMatrix, &mTex); } { // set the new render origin Vector4 vWorldPos(0, 0, 0, 1.f); /** this is for height shift, using the render origin. */ Vector3 vRenderOrigin = CGlobals::GetScene()->GetRenderOrigin(); vWorldPos.x = vRenderOrigin.x + vWorldMatrix._41; vWorldPos.y = vRenderOrigin.y + vWorldMatrix._42; vWorldPos.z = vRenderOrigin.z + vWorldMatrix._43; pEffect->setParameter(CEffectFile::k_worldPos, &vWorldPos); } pEffect->CommitChanges(); RenderDevice::DrawIndexedPrimitive(pDevice, D3DPT_TRIANGLELIST, D3DPT_TRIANGLELIST, 0, pRenderTask->GetVertexOfs(), pRenderTask->GetVertexCount(), pRenderTask->GetIndexOfs(), pRenderTask->GetPrimitiveCount()); } if (curPass > -1) pEffect->EndPass(); pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); if (dwRenderMethod == BLOCK_RENDER_FANCY_SHADER) { // disable render target again } pEffect->end(); if (pCurVB != 0) { // unbind buffer if any, this fixed a crash bug with OpenGL multi-frame renderer // where the same stream source is used both in multi-frame renderer and main renderer. pDevice->SetStreamSource(0, 0, 0, 0); } } if (nRenderPass != BlockRenderPass_AlphaBlended) { if (nRenderPass == BlockRenderPass_AlphaTest) pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); // turn blending on again pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); } } if (nRenderPass == BlockRenderPass_AlphaBlended) { if (dwRenderMethod != BLOCK_RENDER_FANCY_SHADER) { RenderDynamicBlocks(); } } } void BlockWorldClient::RenderWireFrameBlock(int nSelectionIndex, float fScaling, LinearColor* pLineColor) { auto& selectedBlocks = m_selectedBlockMap[nSelectionIndex]; auto& selectedBlockMap = selectedBlocks.m_blocks; if (selectedBlockMap.size() == 0) return; SceneState* sceneState = CGlobals::GetSceneState(); IBatchedElementDraw* pBatchedElementDraw = sceneState->GetBatchedElementDrawer(); if (pBatchedElementDraw == 0) return; Vector3 pVecBounds[8]; int nNumVertices; const float fBlockSize = BlockConfig::g_blockSize; Vector3 renderOfs = CGlobals::GetScene()->GetRenderOrigin(); float verticalOffset = GetVerticalOffset(); int32_t renderBlockOfs_x = (int32_t)(renderOfs.x / fBlockSize); int32_t renderBlockOfs_y = (int32_t)(renderOfs.y / fBlockSize); int32_t renderBlockOfs_z = (int32_t)(renderOfs.z / fBlockSize); Vector3 renderBlockOfs_remain; renderBlockOfs_remain.x = renderOfs.x - renderBlockOfs_x * fBlockSize; renderBlockOfs_remain.y = renderOfs.y - renderBlockOfs_y * fBlockSize; renderBlockOfs_remain.z = renderOfs.z - renderBlockOfs_z * fBlockSize; // scale the block a little to avoid z fighting. float fScaledBlockSize = BlockConfig::g_blockSize*fScaling; if (pBatchedElementDraw) { PARAVECTOR4 color(0.2f, 0.2f, 0.2f, 0.7f); if (pLineColor) { color = *((PARAVECTOR4*)pLineColor); } const float fLineWidth = -2.f; std::map<int64_t, Uint16x3>::iterator itCur, itEnd = selectedBlockMap.end(); for (itCur = selectedBlockMap.begin(); itCur != itEnd; itCur++) { Uint16x3& BlockPos = (*itCur).second; uint16_t x, y, z; x = BlockPos.x; y = BlockPos.y; z = BlockPos.z; BlockTemplate* pBlockTemplate = GetBlockTemplate(x, y, z); if (pBlockTemplate == 0) pBlockTemplate = GetBlockTemplate(1); if (pBlockTemplate) { int nLenCount = 12; CShapeAABB aabb; pBlockTemplate->GetAABB(this, x, y, z, &aabb); Vector3 vOffset((x - renderBlockOfs_x) * fBlockSize, (y - renderBlockOfs_y) * fBlockSize + verticalOffset, (z - renderBlockOfs_z) * fBlockSize); vOffset -= renderBlockOfs_remain; aabb.GetCenter() += vOffset; aabb.GetExtents() *= fScaling; BlockModel::GetBoundingBoxVertices(aabb, pVecBounds, &nNumVertices); { static const int pIndexBuffer[] = { 0,1,2,3,0, // bottom 4,5,6,7,4, // top 5,1,6,2,3,7, // sides }; Vector3 pVertexList[16]; for (int i = 0; i < 16; i++) { pVertexList[i] = pVecBounds[pIndexBuffer[i]]; } pBatchedElementDraw->AddThickLines((PARAVECTOR3*)pVertexList, 10, color, fLineWidth); pBatchedElementDraw->AddThickLines((PARAVECTOR3*)pVertexList + 10, 2, color, fLineWidth); pBatchedElementDraw->AddThickLines((PARAVECTOR3*)pVertexList + 12, 2, color, fLineWidth); pBatchedElementDraw->AddThickLines((PARAVECTOR3*)pVertexList + 14, 2, color, fLineWidth); } } } } } void BlockWorldClient::RenderSelectionBlock(int nSelectionIndex, float fScaledBlockSize, LinearColor* pColor, BOOL bColorAnimate) { auto& selectedBlocks = m_selectedBlockMap[nSelectionIndex]; auto& selectedBlockMap = selectedBlocks.m_blocks; auto& highLightTexture = m_highLightTextures[nSelectionIndex]; if (selectedBlockMap.size() == 0) return; if ((int)m_selectBlockInstData.size() < m_maxSelectBlockPerBatch * 4) m_selectBlockInstData.resize(m_maxSelectBlockPerBatch * 4); RenderDevicePtr pDevice = CGlobals::GetRenderDevice(); float blockSize = BlockConfig::g_blockSize; if (!highLightTexture) { return; } else if (!highLightTexture->IsLoaded()) { highLightTexture->LoadAsset(); return; } BuildSelectionBlockBuffer(); const float fBlockSize = BlockConfig::g_blockSize; Vector3 renderOfs = CGlobals::GetScene()->GetRenderOrigin(); float verticalOffset = GetVerticalOffset(); int32_t renderBlockOfs_x = (int32_t)(renderOfs.x / fBlockSize); int32_t renderBlockOfs_y = (int32_t)(renderOfs.y / fBlockSize); int32_t renderBlockOfs_z = (int32_t)(renderOfs.z / fBlockSize); Vector3 renderBlockOfs_remain; renderBlockOfs_remain.x = renderOfs.x - renderBlockOfs_x * fBlockSize; renderBlockOfs_remain.y = renderOfs.y - renderBlockOfs_y * fBlockSize; renderBlockOfs_remain.z = renderOfs.z - renderBlockOfs_z * fBlockSize; // scale the block a little to avoid z fighting. fScaledBlockSize = BlockConfig::g_blockSize*fScaledBlockSize; int32_t count = (int32)selectedBlockMap.size(); int32_t curInstCount = 0; int32_t instFloatCount = 0; EffectManager* pEffectManager = CGlobals::GetEffectManager(); pEffectManager->BeginEffect(TECH_BLOCK); CEffectFile* pEffect = pEffectManager->GetCurrentEffectFile(); pDevice->SetStreamSource(0, 0, 0, 0); pDevice->SetIndices(0); // culling mode if (selectedBlocks.m_bOnlyRenderClickableArea) { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); } else { pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); } if (pEffect == 0) { #ifdef USE_DIRECTX_RENDERER // fixed function pipeline pDevice->SetTexture(0, highLightTexture->GetTexture()); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); pDevice->SetFVF(mesh_vertex_plain::FVF); uint32_t time = CGlobals::GetSceneState()->GetGlobalTime(); uint8 lightScaler = (bColorAnimate) ? (uint8)(abs(sin(time*0.0015f)) * 0.4f * 255) : 0xff; DWORD lightIntensity = COLOR_ARGB(255, lightScaler, lightScaler, lightScaler); pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CONSTANT); pDevice->SetTextureStageState(0, D3DTSS_CONSTANT, lightIntensity); Matrix4 vWorldMatrix(Matrix4::IDENTITY); vWorldMatrix._41 = -renderBlockOfs_remain.x - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._42 = -renderBlockOfs_remain.y - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._43 = -renderBlockOfs_remain.z - (fScaledBlockSize - fBlockSize)*0.5f; pDevice->SetTransform(D3DTS_WORLD, vWorldMatrix.GetPointer()); int nMaxFaceCount = (m_maxSelectBlockPerBatch - 1) * 6; std::map<int64_t, Uint16x3>::iterator itCur, itEnd = selectedBlockMap.end(); for (itCur = selectedBlockMap.begin(); itCur != itEnd; itCur++) { Uint16x3& BlockPos = (*itCur).second; uint16_t x, y, z; x = BlockPos.x; y = BlockPos.y; z = BlockPos.z; if (curInstCount >= nMaxFaceCount) { RenderDevice::DrawIndexedPrimitiveUP(pDevice, RenderDevice::DRAW_PERF_TRIANGLES_TERRAIN, D3DPT_TRIANGLELIST, 0, curInstCount * 4, curInstCount * 2, &(m_select_block_indices[0]), D3DFMT_INDEX16, &(m_select_block_vertices[0]), sizeof(SelectBlockVertex)); curInstCount = 0; instFloatCount = 0; } Vector3 vOffset((x - renderBlockOfs_x) * fBlockSize, (y - renderBlockOfs_y) * fBlockSize + verticalOffset, (z - renderBlockOfs_z) * fBlockSize); int nCount = 0; if (selectedBlocks.m_bOnlyRenderClickableArea) nCount = FillSelectBlockInvert(selectedBlockMap, x, y, z, &(m_select_block_vertices[instFloatCount * 4]), vOffset, fScaledBlockSize); else nCount = FillSelectBlockVertice(&selectedBlockMap, x, y, z, &(m_select_block_vertices[instFloatCount * 4]), vOffset, fScaledBlockSize); instFloatCount += nCount; curInstCount += nCount; } if (curInstCount > 0) { RenderDevice::DrawIndexedPrimitiveUP(pDevice, RenderDevice::DRAW_PERF_TRIANGLES_TERRAIN, D3DPT_TRIANGLELIST, 0, curInstCount * 4, curInstCount * 2, &(m_select_block_indices[0]), D3DFMT_INDEX16, &(m_select_block_vertices[0]), sizeof(SelectBlockVertex)); } pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); pDevice->SetRenderState(D3DRS_DEPTHBIAS, 0); pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT); #endif } else if (pEffect != 0 && pEffect->begin(false)) { pDevice->SetVertexDeclaration(GetSelectBlockVertexLayout()); if (pEffect->BeginPass(g_selectBlockPass)) { IScene* pScene = CGlobals::GetEffectManager()->GetScene(); CBaseCamera* pCamera = pScene->GetCurrentCamera(); Matrix4 matViewProj; if (pCamera) { const Matrix4& pView = (CGlobals::GetEffectManager()->GetViewTransform()); const Matrix4& pProj = (CGlobals::GetEffectManager()->GetProjTransform()); matViewProj = (pView) * (pProj); } pDevice->SetTexture(0, highLightTexture->GetTexture()); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); uint32_t time = CGlobals::GetSceneState()->GetGlobalTime(); float lightIntensity = 1.f; if (bColorAnimate) lightIntensity = abs(sin(time*0.0015f)) * 0.4f; Vector4 vLightParams(lightIntensity, 0, 0, 0); pEffect->setParameter(CEffectFile::k_ConstVector0, (const void*)(&vLightParams)); Matrix4 vWorldMatrix(Matrix4::IDENTITY); vWorldMatrix._41 = -renderBlockOfs_remain.x - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._42 = -renderBlockOfs_remain.y - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._43 = -renderBlockOfs_remain.z - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix = vWorldMatrix * matViewProj; pEffect->setMatrix(CEffectFile::k_worldViewProjMatrix, &vWorldMatrix); pEffect->CommitChanges(); int nMaxFaceCount = (m_maxSelectBlockPerBatch - 1) * 6; std::map<int64_t, Uint16x3>::iterator itCur, itEnd = selectedBlockMap.end(); for (itCur = selectedBlockMap.begin(); itCur != itEnd; itCur++) { Uint16x3& BlockPos = (*itCur).second; uint16_t x, y, z; x = BlockPos.x; y = BlockPos.y; z = BlockPos.z; if (curInstCount >= nMaxFaceCount) { RenderDevice::DrawIndexedPrimitiveUP(pDevice, D3DPT_TRIANGLELIST, D3DPT_TRIANGLELIST, 0, curInstCount * 4, curInstCount * 2, &(m_select_block_indices[0]), D3DFMT_INDEX16, &(m_select_block_vertices[0]), sizeof(SelectBlockVertex)); curInstCount = 0; instFloatCount = 0; } Vector3 vOffset((x - renderBlockOfs_x) * fBlockSize, (y - renderBlockOfs_y) * fBlockSize + verticalOffset, (z - renderBlockOfs_z) * fBlockSize); int nCount = 0; if (selectedBlocks.m_bOnlyRenderClickableArea) nCount = FillSelectBlockInvert(selectedBlockMap, x, y, z, &(m_select_block_vertices[instFloatCount * 4]), vOffset, fScaledBlockSize); else nCount = FillSelectBlockVertice(&selectedBlockMap, x, y, z, &(m_select_block_vertices[instFloatCount * 4]), vOffset, fScaledBlockSize); instFloatCount += nCount; curInstCount += nCount; } if (curInstCount > 0) { RenderDevice::DrawIndexedPrimitiveUP(pDevice, D3DPT_TRIANGLELIST, D3DPT_TRIANGLELIST, 0, curInstCount * 4, curInstCount * 2, &(m_select_block_indices[0]), D3DFMT_INDEX16, &(m_select_block_vertices[0]), sizeof(SelectBlockVertex)); } pEffect->EndPass(); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); pDevice->SetRenderState(D3DRS_DEPTHBIAS, 0); } pEffect->end(); } pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); } void BlockWorldClient::RenderDamagedBlock() { if (m_damageDegree <= 0) return; #ifdef USE_DIRECTX_RENDERER RenderDevicePtr pDevice = CGlobals::GetRenderDevice(); float blockSize = BlockConfig::g_blockSize; if (!m_damangeTexture) { return; } else if (!m_damangeTexture->IsLoaded()) { m_damangeTexture->LoadAsset(); return; } //----------------------------------------- BuildSelectionBlockBuffer(); const float fBlockSize = BlockConfig::g_blockSize; Vector3 renderOfs = CGlobals::GetScene()->GetRenderOrigin(); float verticalOffset = GetVerticalOffset(); int32_t renderBlockOfs_x = (int32_t)(renderOfs.x / fBlockSize); int32_t renderBlockOfs_y = (int32_t)(renderOfs.y / fBlockSize); int32_t renderBlockOfs_z = (int32_t)(renderOfs.z / fBlockSize); Vector3 renderBlockOfs_remain; renderBlockOfs_remain.x = renderOfs.x - renderBlockOfs_x * fBlockSize; renderBlockOfs_remain.y = renderOfs.y - renderBlockOfs_y * fBlockSize; renderBlockOfs_remain.z = renderOfs.z - renderBlockOfs_z * fBlockSize; // scale the block a little to avoid z fighting. float fScaledBlockSize = BlockConfig::g_blockSize*1.02f; //----------------------------------------- EffectManager* pEffectManager = CGlobals::GetEffectManager(); pEffectManager->BeginEffect(TECH_BLOCK); CEffectFile* pEffect = pEffectManager->GetCurrentEffectFile(); if (pEffect == 0) { // fixed function pipeline pDevice->SetTexture(0, m_damangeTexture->GetTexture()); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); pDevice->SetFVF(mesh_vertex_plain::FVF); Matrix4 vWorldMatrix(Matrix4::IDENTITY); vWorldMatrix._41 = -renderBlockOfs_remain.x - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._42 = -renderBlockOfs_remain.y - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._43 = -renderBlockOfs_remain.z - (fScaledBlockSize - fBlockSize)*0.5f; pDevice->SetTransform(D3DTS_WORLD, vWorldMatrix.GetPointer()); int curInstCount = 0; int instFloatCount = 0; { Vector3 vOffset((m_damagedBlockId.x - renderBlockOfs_x) * fBlockSize, (m_damagedBlockId.y - renderBlockOfs_y) * fBlockSize + verticalOffset, (m_damagedBlockId.z - renderBlockOfs_z) * fBlockSize); FillSelectBlockVertice(NULL, 0, 0, 0, &(m_select_block_vertices[instFloatCount * 24]), vOffset, fScaledBlockSize, ((int)(max(m_damageDegree - 0.1f, 0.f) * 8)) / 8.f, 1 / 8.f); instFloatCount++; curInstCount++; } RenderDevice::DrawIndexedPrimitiveUP(pDevice, RenderDevice::DRAW_PERF_TRIANGLES_TERRAIN, D3DPT_TRIANGLELIST, 0, curInstCount * 24, curInstCount * 12, &(m_select_block_indices[0]), D3DFMT_INDEX16, &(m_select_block_vertices[0]), sizeof(SelectBlockVertex)); pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); } else if (pEffect != 0 && pEffect->begin(false)) { pDevice->SetVertexDeclaration(GetSelectBlockVertexLayout()); if (pEffect->BeginPass(2)) { IScene* pScene = CGlobals::GetEffectManager()->GetScene(); CBaseCamera* pCamera = pScene->GetCurrentCamera(); Matrix4 matViewProj; if (pCamera) { const Matrix4& pView = (CGlobals::GetEffectManager()->GetViewTransform()); const Matrix4& pProj = (CGlobals::GetEffectManager()->GetProjTransform()); matViewProj = (pView) * (pProj); } pDevice->SetTexture(0, m_damangeTexture->GetTexture()); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); Matrix4 vWorldMatrix(Matrix4::IDENTITY); vWorldMatrix._41 = -renderBlockOfs_remain.x - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._42 = -renderBlockOfs_remain.y - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix._43 = -renderBlockOfs_remain.z - (fScaledBlockSize - fBlockSize)*0.5f; vWorldMatrix = vWorldMatrix * matViewProj; pEffect->setMatrix(CEffectFile::k_worldViewProjMatrix, &vWorldMatrix); pEffect->CommitChanges(); int curInstCount = 0; int instFloatCount = 0; { Vector3 vOffset((m_damagedBlockId.x - renderBlockOfs_x) * fBlockSize, (m_damagedBlockId.y - renderBlockOfs_y) * fBlockSize + verticalOffset, (m_damagedBlockId.z - renderBlockOfs_z) * fBlockSize); // animate the UV's y offset according to m_damageDegree FillSelectBlockVertice(NULL, 0, 0, 0, &(m_select_block_vertices[instFloatCount * 24]), vOffset, fScaledBlockSize, ((int)(max(m_damageDegree - 0.1f, 0.f) * 8)) / 8.f, 1 / 8.f); instFloatCount++; curInstCount++; } RenderDevice::DrawIndexedPrimitiveUP(pDevice, D3DPT_TRIANGLELIST, D3DPT_TRIANGLELIST, 0, curInstCount * 24, curInstCount * 12, &(m_select_block_indices[0]), D3DFMT_INDEX16, &(m_select_block_vertices[0]), sizeof(SelectBlockVertex)); pEffect->EndPass(); pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); } pEffect->end(); } #endif } int BlockWorldClient::FillSelectBlockInvert(std::map<int64_t, Uint16x3>& selectedBlockMap, uint16_t x, uint16_t y, uint16_t z, SelectBlockVertex* blockModel, const Vector3& vOffset, const float blockSize, float fUV_Y_Offset /*= 0.f*/, float fUV_Y_Size/*=1.f*/) { int nCount = 0; if (GetBlockTemplateIdByIdx(x, y + 1, z) != 0) { //top face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y + blockSize; blockModel[0].position.z = vOffset.z; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z + blockSize; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z + blockSize; blockModel[2].texcoord = Vector2(1, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y + blockSize; blockModel[3].position.z = vOffset.z; blockModel[3].texcoord = Vector2(1, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (GetBlockTemplateIdByIdx(x, y, z - 1) != 0) { //front face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (GetBlockTemplateIdByIdx(x, y - 1, z) != 0) { //bottom face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z + blockSize; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y; blockModel[1].position.z = vOffset.z; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y; blockModel[2].position.z = vOffset.z; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z + blockSize; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (GetBlockTemplateIdByIdx(x - 1, y, z) != 0) { //left face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z + blockSize; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z + blockSize; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (GetBlockTemplateIdByIdx(x + 1, y, z) != 0) { //right blockModel[0].position.x = vOffset.x + blockSize; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x + blockSize; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z + blockSize; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z + blockSize; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (GetBlockTemplateIdByIdx(x, y, z + 1) != 0) { //back face blockModel[0].position.x = vOffset.x + blockSize; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z + blockSize; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x + blockSize; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z + blockSize; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z + blockSize; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z + blockSize; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (nCount == 0) { nCount = FillSelectBlockVertice(&selectedBlockMap, x, y, z, blockModel, vOffset, blockSize, fUV_Y_Offset, fUV_Y_Size); } return nCount; } int BlockWorldClient::FillSelectBlockVertice(std::map<int64_t, Uint16x3>* pSelectedBlockMap, uint16_t x, uint16_t y, uint16_t z, SelectBlockVertex* blockModel, const Vector3& vOffset, const float blockSize, float fUV_Y_Offset, float fUV_Y_Size) { int nCount = 0; if (!pSelectedBlockMap || pSelectedBlockMap->find(GetBlockSparseIndex(x, y + 1, z)) == pSelectedBlockMap->end()) { //top face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y + blockSize; blockModel[0].position.z = vOffset.z; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z + blockSize; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z + blockSize; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y + blockSize; blockModel[3].position.z = vOffset.z; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (!pSelectedBlockMap || pSelectedBlockMap->find(GetBlockSparseIndex(x, y, z - 1)) == pSelectedBlockMap->end()) { //front face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (!pSelectedBlockMap || pSelectedBlockMap->find(GetBlockSparseIndex(x, y - 1, z)) == pSelectedBlockMap->end()) { //bottom face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z + blockSize; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y; blockModel[1].position.z = vOffset.z; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y; blockModel[2].position.z = vOffset.z; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z + blockSize; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (!pSelectedBlockMap || pSelectedBlockMap->find(GetBlockSparseIndex(x - 1, y, z)) == pSelectedBlockMap->end()) { //left face blockModel[0].position.x = vOffset.x; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z + blockSize; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z + blockSize; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (!pSelectedBlockMap || pSelectedBlockMap->find(GetBlockSparseIndex(x + 1, y, z)) == pSelectedBlockMap->end()) { //right blockModel[0].position.x = vOffset.x + blockSize; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x + blockSize; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x + blockSize; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z + blockSize; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x + blockSize; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z + blockSize; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } if (!pSelectedBlockMap || pSelectedBlockMap->find(GetBlockSparseIndex(x, y, z + 1)) == pSelectedBlockMap->end()) { //back face blockModel[0].position.x = vOffset.x + blockSize; blockModel[0].position.y = vOffset.y; blockModel[0].position.z = vOffset.z + blockSize; blockModel[0].texcoord = Vector2(0, fUV_Y_Offset + fUV_Y_Size); blockModel[1].position.x = vOffset.x + blockSize; blockModel[1].position.y = vOffset.y + blockSize; blockModel[1].position.z = vOffset.z + blockSize; blockModel[1].texcoord = Vector2(0, fUV_Y_Offset); blockModel[2].position.x = vOffset.x; blockModel[2].position.y = vOffset.y + blockSize; blockModel[2].position.z = vOffset.z + blockSize; blockModel[2].texcoord = Vector2(1.f, fUV_Y_Offset); blockModel[3].position.x = vOffset.x; blockModel[3].position.y = vOffset.y; blockModel[3].position.z = vOffset.z + blockSize; blockModel[3].texcoord = Vector2(1.f, fUV_Y_Offset + fUV_Y_Size); blockModel += 4; nCount++; } return nCount; } void BlockWorldClient::BuildSelectionBlockBuffer() { if (m_select_block_vertices.empty()) { float blockSize = BlockConfig::g_blockSize; SelectBlockVertex blockModel[24]; Vector3 vOffset(0, 0, 0); FillSelectBlockVertice(NULL, 0, 0, 0, blockModel, vOffset, BlockConfig::g_blockSize); m_select_block_vertices.resize(24 * m_maxSelectBlockPerBatch); SelectBlockVertex* pVertices = &(m_select_block_vertices[0]); for (int i = 0; i < m_maxSelectBlockPerBatch; i++) { memcpy(pVertices, blockModel, sizeof(SelectBlockVertex) * 24); pVertices += 24; } } if (m_select_block_indices.empty()) { m_select_block_indices.resize(36 * m_maxSelectBlockPerBatch); uint16_t* pIndices = &(m_select_block_indices[0]); for (int i = 0; i < m_maxSelectBlockPerBatch; i++) { uint16_t indexOfs = 24 * i; //top face *pIndices = indexOfs + 0; pIndices++; *pIndices = indexOfs + 1; pIndices++; *pIndices = indexOfs + 3; pIndices++; *pIndices = indexOfs + 1; pIndices++; *pIndices = indexOfs + 2; pIndices++; *pIndices = indexOfs + 3; pIndices++; //front face *pIndices = indexOfs + 4; pIndices++; *pIndices = indexOfs + 5; pIndices++; *pIndices = indexOfs + 7; pIndices++; *pIndices = indexOfs + 5; pIndices++; *pIndices = indexOfs + 6; pIndices++; *pIndices = indexOfs + 7; pIndices++; //bottom face *pIndices = indexOfs + 8; pIndices++; *pIndices = indexOfs + 9; pIndices++; *pIndices = indexOfs + 11; pIndices++; *pIndices = indexOfs + 9; pIndices++; *pIndices = indexOfs + 10; pIndices++; *pIndices = indexOfs + 11; pIndices++; //left face *pIndices = indexOfs + 12; pIndices++; *pIndices = indexOfs + 13; pIndices++; *pIndices = indexOfs + 15; pIndices++; *pIndices = indexOfs + 13; pIndices++; *pIndices = indexOfs + 14; pIndices++; *pIndices = indexOfs + 15; pIndices++; //right face *pIndices = indexOfs + 16; pIndices++; *pIndices = indexOfs + 17; pIndices++; *pIndices = indexOfs + 19; pIndices++; *pIndices = indexOfs + 17; pIndices++; *pIndices = indexOfs + 18; pIndices++; *pIndices = indexOfs + 19; pIndices++; //back face *pIndices = indexOfs + 20; pIndices++; *pIndices = indexOfs + 21; pIndices++; *pIndices = indexOfs + 23; pIndices++; *pIndices = indexOfs + 21; pIndices++; *pIndices = indexOfs + 22; pIndices++; *pIndices = indexOfs + 23; pIndices++; } } } void BlockWorldClient::AddRenderTask(BlockRenderTask* pRenderTask) { GetRenderQueueByPass(pRenderTask->GetTemplate()->GetRenderPass())->push_back(pRenderTask); } IndexBufferDevicePtr_type BlockWorldClient::GetIndexBuffer() { if (!m_sharedIndexBuffer.IsValid()) { // at most 6 indices per face (2 triangles) const int face_count = BlockConfig::g_maxFaceCountPerBatch; int32_t bufferSize = sizeof(uint16_t) * 6 * face_count; // D3DFMT_INDEX16 boundary check PE_ASSERT((face_count * 4) <= 0xffff); m_sharedIndexBuffer.CreateBuffer(bufferSize, D3DFMT_INDEX16, 0); uint16_t* pIndices; if (m_sharedIndexBuffer.Lock((void**)&pIndices, 0, 0)) { for (int i = 0; i < face_count; i++) { uint16_t indexOfs = 4 * i; *pIndices = indexOfs + 0; pIndices++; *pIndices = indexOfs + 1; pIndices++; *pIndices = indexOfs + 3; pIndices++; *pIndices = indexOfs + 1; pIndices++; *pIndices = indexOfs + 2; pIndices++; *pIndices = indexOfs + 3; pIndices++; } m_sharedIndexBuffer.Unlock(); } } return m_sharedIndexBuffer.GetDevicePointer(); } VertexDeclarationPtr BlockWorldClient::GetVertexLayout() { return CGlobals::GetEffectManager()->GetVertexDeclaration(EffectManager::S0_POS_NORM_TEX0_COLOR0_COLOR1); } VertexDeclarationPtr BlockWorldClient::GetSelectBlockVertexLayout() { return CGlobals::GetEffectManager()->GetVertexDeclaration(EffectManager::S0_POS_TEX0); } void BlockWorldClient::DeleteDeviceObjects() { m_sharedIndexBuffer.ReleaseBuffer(); for (uint32_t i = 0; i < m_activeChunks.size(); i++) m_activeChunks[i]->DeleteDeviceObjects(); m_pMultiFrameRenderer->DeleteDeviceObjects(); m_alphaTestRenderTasks.clear(); m_solidRenderTasks.clear(); m_alphaBlendRenderTasks.clear(); m_reflectedWaterRenderTasks.clear(); } void BlockWorldClient::RendererRecreated() { m_sharedIndexBuffer.RendererRecreated(); for (uint32_t i = 0; i < m_activeChunks.size(); i++) m_activeChunks[i]->RendererRecreated(); m_pMultiFrameRenderer->RendererRecreated(); m_alphaTestRenderTasks.clear(); m_solidRenderTasks.clear(); m_alphaBlendRenderTasks.clear(); m_reflectedWaterRenderTasks.clear(); if (IsInBlockWorld()) UpdateAllActiveChunks(); } void BlockWorldClient::SetDamagedBlock(uint16_t x, uint16_t y, uint16_t z) { m_damagedBlockId.x = x; m_damagedBlockId.y = y; m_damagedBlockId.z = z; } void BlockWorldClient::SetDamagedBlockDegree(float degree) { m_damageDegree = degree; } void BlockWorldClient::SetSelectionTexture(const char* textureName) { if (textureName) { char c = textureName[0]; int nIndex = 0; if (textureName[1] == ':' && c >= '0' && c <= '9') { nIndex = c - '0'; textureName += 2; } if (nIndex < BLOCK_GROUP_ID_MAX) { if (m_highLightTextures[nIndex]) { if (m_highLightTextures[nIndex]->GetKey() == textureName) { return; } } m_highLightTextures[nIndex] = CGlobals::GetAssetManager()->LoadTexture("", textureName, TextureEntity::StaticTexture); } } } std::string BlockWorldClient::GetSelectionTexture() { if (m_highLightTextures[0]) { return (m_highLightTextures[0]->GetKey()); } return ""; } void BlockWorldClient::SetDamageTexture(const char* textureName) { if (m_damangeTexture) { if (m_damangeTexture->GetKey() == textureName) { return; } } m_damangeTexture = CGlobals::GetAssetManager()->LoadTexture("", textureName, TextureEntity::StaticTexture); } std::string BlockWorldClient::GetDamageTexture() { if (m_damangeTexture) { return (m_damangeTexture->GetKey()); } return ""; } bool BlockWorldClient::IsPointUnderWater(const Vector3& vPos) { if (IsInBlockWorld()) { // first check block world and then check real world uint16_t block_id = GetBlockTemplateId(vPos.x, vPos.y, vPos.z); if (block_id > 0) { BlockTemplate* pBlockTemplate = GetBlockTemplate(block_id); if (pBlockTemplate != 0 && pBlockTemplate->IsMatchAttribute(BlockTemplate::batt_liquid)) { return true; } } #ifdef USE_DIRECTX_RENDERER return CGlobals::GetOceanManager()->IsPointUnderWater(vPos); #else return false; #endif } else { #ifdef USE_DIRECTX_RENDERER return CGlobals::GetOceanManager()->IsPointUnderWater(vPos); #else return false; #endif } } float BlockWorldClient::GetWaterLevel(float x, float y, float z, int nRayLength) { float fWaterLevel = -1000.f; #ifdef USE_DIRECTX_RENDERER if (m_isInWorld) { Uint16x3 blockIdx; BlockCommon::ConvertToBlockIndex(x, y, z, blockIdx.x, blockIdx.y, blockIdx.z); if (blockIdx.y < BlockConfig::g_regionBlockDimY) { for (int i = 0; i < nRayLength; i++) { uint16_t block_id = GetBlockTemplateIdByIdx(blockIdx.x, blockIdx.y - i, blockIdx.z); if (block_id > 0) { BlockTemplate* pBlockTemplate = GetBlockTemplate(block_id); if (pBlockTemplate != 0 && (pBlockTemplate->IsMatchAttribute(BlockTemplate::batt_liquid) && !pBlockTemplate->IsMatchAttribute(BlockTemplate::batt_solid))) { Vector3 vPos = BlockCommon::ConvertToRealPosition(blockIdx.x, blockIdx.y - i, blockIdx.z, 4); fWaterLevel = vPos.y - BlockConfig::g_blockSize *0.2f; } break; } } } if (CGlobals::GetOceanManager()->OceanEnabled()) { float fLevel = CGlobals::GetOceanManager()->GetWaterLevel(); if (fLevel > fWaterLevel) fWaterLevel = fLevel; } } #endif return fWaterLevel; } void BlockWorldClient::SetBlockRenderMethod(BlockRenderMethod method) { #ifdef USE_DIRECTX_RENDERER if (m_dwBlockRenderMethod != method) { if (method == BLOCK_RENDER_FANCY_SHADER) { if (CGlobals::GetSettings().GetMultiSampleType() != 0) { OUTPUT_LOG("BLOCK_RENDER_FANCY_SHADER can not be set with AA\n"); return; } // check for device compatibilities if (CanUseAdvancedShading()) { // just ensure that game effect set is not too low. if (CGlobals::GetSettings().GetGameEffectSet() >= 1024) { CGlobals::GetSettings().LoadGameEffectSet(0); } // disable glow effect since we are using our own. CGlobals::GetScene()->EnableFullScreenGlow(false); } else { OUTPUT_LOG("warning: your device is too low to use deferred shading. \n"); return; } CShadowMap* pShadowMap = CGlobals::GetEffectManager()->GetShadowMap(); if (pShadowMap != NULL) { if (GetUseSunlightShadowMap()) CGlobals::GetScene()->SetShadow(true); else CGlobals::GetScene()->SetShadow(false); } // always disable instancing CGlobals::GetScene()->EnableInstancing(false); // replacing shader to support multiple render target. if (m_terrain_fancy) { CGlobals::GetEffectManager()->MapHandleToEffect(TECH_TERRAIN, m_terrain_fancy.get()); } if (m_normal_mesh_effect_fancy) { CGlobals::GetEffectManager()->MapHandleToEffect(TECH_SIMPLE_MESH_NORMAL, m_normal_mesh_effect_fancy.get()); CGlobals::GetEffectManager()->MapHandleToEffect(TECH_CHARACTER, m_normal_mesh_effect_fancy.get()); } if (m_bmax_model_effect_fancy) { CGlobals::GetEffectManager()->MapHandleToEffect(TECH_BMAX_MODEL, m_bmax_model_effect_fancy.get()); } } else { // reset effect mapping to default values. CGlobals::GetSettings().LoadGameEffectSet(CGlobals::GetSettings().GetGameEffectSet()); } if (m_dwBlockRenderMethod == BLOCK_RENDER_FANCY_SHADER) { // if switching from fancy shader to plain shader // remove all surfaces SAFE_RELEASE(m_render_target_block_info_surface); SAFE_RELEASE(m_render_target_depth_tex_surface); SAFE_RELEASE(m_render_target_normal_surface); SAFE_RELEASE(m_pDepthStencilSurface); m_render_target_color_hdr.reset(); m_render_target_color.reset(); m_render_target_block_info.reset(); m_render_target_depth_tex.reset(); m_render_target_normal.reset(); CGlobals::GetRenderDevice()->SetRenderTarget(1, NULL); CGlobals::GetRenderDevice()->SetRenderTarget(2, NULL); CGlobals::GetRenderDevice()->SetRenderTarget(3, NULL); } m_dwBlockRenderMethod = method; ClearBlockRenderCache(); } #elif defined(USE_OPENGL_RENDERER) CGlobals::GetSettings().LoadGameEffectSet(0); #endif } void BlockWorldClient::ClearBlockRenderCache() { if (IsInBlockWorld()) { for (int x = 0; x < m_activeChunkDim; x++) { for (int z = 0; z < m_activeChunkDim; z++) { for (int y = 0; y < m_activeChunkDim; y++) { RenderableChunk& chunk = GetActiveChunk(x, y, z); if (!chunk.IsEmptyChunk()) { chunk.SetChunkDirty(true); } } } } } } void BlockWorldClient::SetBlockLightColor(const LinearColor& color) { m_vBlockLightColor = color; } LinearColor BlockWorldClient::GetBlockLightColor() { return m_vBlockLightColor; } bool BlockWorldClient::CompareRenderOrder(BlockRenderTask* v0, BlockRenderTask* v1) { return (v0->GetRenderOrder() < v1->GetRenderOrder()); } bool BlockWorldClient::GetUsePointTextureFiltering() { return m_bUsePointTextureFiltering; } void BlockWorldClient::SetUsePointTextureFiltering(bool bUse) { m_bUsePointTextureFiltering = bUse; } void BlockWorldClient::InitDeviceObjects() { if (IsInBlockWorld()) UpdateAllActiveChunks(); } void BlockWorldClient::RestoreDeviceObjects() { } void BlockWorldClient::InvalidateDeviceObjects() { #ifdef USE_DIRECTX_RENDERER SAFE_RELEASE(m_render_target_block_info_surface); SAFE_RELEASE(m_render_target_depth_tex_surface); SAFE_RELEASE(m_render_target_normal_surface); SAFE_RELEASE(m_pDepthStencilSurface); m_render_target_color_hdr.reset(); m_render_target_color.reset(); m_render_target_block_info.reset(); m_render_target_depth_tex.reset(); m_render_target_normal.reset(); #endif } void BlockWorldClient::RestoreNormalShader() { // restore effect to old one. EffectManager* pEffectManager = CGlobals::GetEffectManager(); pEffectManager->EndEffect(); auto* pEffect = pEffectManager->GetEffectByName("simple_mesh_normal"); if (pEffect) { pEffect->LoadAsset(); pEffectManager->MapHandleToEffect(TECH_SIMPLE_MESH_NORMAL, pEffect); pEffectManager->MapHandleToEffect(TECH_CHARACTER, pEffect); } pEffect = pEffectManager->GetEffectByName("BMaxModel"); if (pEffect) { pEffect->LoadAsset(); pEffectManager->MapHandleToEffect(TECH_BMAX_MODEL, pEffect); } CGlobals::GetSceneState()->SetDeferredShading(true); } void BlockWorldClient::DoPostRenderingProcessing(BlockRenderPass nRenderPass) { #ifdef USE_DIRECTX_RENDERER if (IsInBlockWorld() && GetBlockRenderMethod() == BLOCK_RENDER_FANCY_SHADER) { if (nRenderPass == BlockRenderPass_Opaque) { if (!m_sPostProcessorCallbackScript.empty()) CGlobals::GetNPLRuntime()->GetMainRuntimeState()->DoString(m_sPostProcessorCallbackScript.c_str(), (int)m_sPostProcessorCallbackScript.size()); RenderDynamicBlocks(); RestoreNormalShader(); } else if (nRenderPass == BlockRenderPass_AlphaBlended) { if (!m_sPostProcessorAlphaCallbackScript.empty()) CGlobals::GetNPLRuntime()->GetMainRuntimeState()->DoString(m_sPostProcessorAlphaCallbackScript.c_str(), (int)m_sPostProcessorAlphaCallbackScript.size()); } } #endif } bool BlockWorldClient::PrepareAllRenderTargets(bool bSetRenderTarget /*= true*/) { #ifdef USE_DIRECTX_RENDERER if (GetBlockRenderMethod() == BLOCK_RENDER_FANCY_SHADER) { RenderDevicePtr pDevice = CGlobals::GetRenderDevice(); if (m_block_effect_fancy == 0) { m_block_effect_fancy = CGlobals::GetAssetManager()->LoadEffectFile("blockFancy", "script/apps/Aries/Creator/Game/Shaders/mrt_blocks.fxo"); m_block_effect_fancy->LoadAsset(); if (!m_block_effect_fancy->IsValid()) { // try a lower shader other than fancy return false; } } else if (!m_block_effect_fancy->IsValid()) { // try a lower shader other than fancy return false; } if (!IsInBlockWorld()) { RestoreNormalShader(); return false; } if (m_render_target_block_info == 0) { m_render_target_block_info = CGlobals::GetAssetManager()->LoadTexture("_BlockInfoRT", "_BlockInfoRT", TextureEntity::RenderTarget); m_render_target_block_info->LoadAsset(); SAFE_RELEASE(m_render_target_block_info_surface); m_render_target_block_info->GetTexture()->GetSurfaceLevel(0, &m_render_target_block_info_surface); } if (m_render_target_depth_tex == 0) { m_render_target_depth_tex = CGlobals::GetAssetManager()->LoadTexture("_DepthTexRT_R32F", "_DepthTexRT_R32F", TextureEntity::RenderTarget); m_render_target_depth_tex->LoadAsset(); SAFE_RELEASE(m_render_target_depth_tex_surface); m_render_target_depth_tex->GetTexture()->GetSurfaceLevel(0, &m_render_target_depth_tex_surface); } if (m_render_target_normal == 0) { m_render_target_normal = CGlobals::GetAssetManager()->LoadTexture("_NormalRT", "_NormalRT", TextureEntity::RenderTarget); m_render_target_normal->LoadAsset(); SAFE_RELEASE(m_render_target_normal_surface); m_render_target_normal->GetTexture()->GetSurfaceLevel(0, &m_render_target_normal_surface); } CGlobals::GetEffectManager()->MapHandleToEffect(TECH_BLOCK_FANCY, m_block_effect_fancy.get()); if (m_normal_mesh_effect_fancy == 0) { m_normal_mesh_effect_fancy = CGlobals::GetAssetManager()->LoadEffectFile("mesh_normal_fancy", "script/apps/Aries/Creator/Game/Shaders/mrt_mesh_normal.fxo"); m_normal_mesh_effect_fancy->LoadAsset(); if (!m_normal_mesh_effect_fancy->IsValid()) { // try a lower shader other than fancy return false; } } CGlobals::GetEffectManager()->MapHandleToEffect(TECH_SIMPLE_MESH_NORMAL, m_normal_mesh_effect_fancy.get()); CGlobals::GetEffectManager()->MapHandleToEffect(TECH_CHARACTER, m_normal_mesh_effect_fancy.get()); if (m_effect_light_point == 0) { m_effect_light_point = CGlobals::GetAssetManager()->LoadEffectFile("m_effect_light_point", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingPointLighting.fxo"); m_effect_light_point->LoadAsset(); } if (m_effect_light_spot == 0) { m_effect_light_spot = CGlobals::GetAssetManager()->LoadEffectFile("m_effect_light_spot", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingSpotLighting.fxo"); m_effect_light_spot->LoadAsset(); } if (m_effect_light_directional == 0) { m_effect_light_directional = CGlobals::GetAssetManager()->LoadEffectFile("m_effect_light_directional", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingDirectionalLighting.fxo"); m_effect_light_directional->LoadAsset(); } CGlobals::GetEffectManager()->MapHandleToEffect(TECH_LIGHT_POINT, m_effect_light_point.get()); CGlobals::GetEffectManager()->MapHandleToEffect(TECH_LIGHT_SPOT, m_effect_light_spot.get()); CGlobals::GetEffectManager()->MapHandleToEffect(TECH_LIGHT_DIRECTIONAL, m_effect_light_directional.get()); /*if (m_effect_deferred_lighting == 0) { m_effect_deferred_lighting = CGlobals::GetAssetManager()->LoadEffectFile("m_effect_deferred_lighting", "script/apps/Aries/Creator/Game/Shaders/DeferredLighting.fxo"); m_effect_deferred_lighting->LoadAsset(); } CGlobals::GetEffectManager()->MapHandleToEffect(TECH_DEFERRED_LIGHTING, m_effect_deferred_lighting.get());*/ if (m_bmax_model_effect_fancy == 0) { m_bmax_model_effect_fancy = CGlobals::GetAssetManager()->LoadEffectFile("bmax_model_effect_fancy", "script/apps/Aries/Creator/Game/Shaders/mrt_bmax_model.fxo"); m_bmax_model_effect_fancy->LoadAsset(); if (!m_bmax_model_effect_fancy->IsValid()) { // try a lower shader other than fancy return false; } } CGlobals::GetEffectManager()->MapHandleToEffect(TECH_BMAX_MODEL, m_bmax_model_effect_fancy.get()); if (m_terrain_fancy == 0) { m_terrain_fancy = CGlobals::GetAssetManager()->LoadEffectFile("terrain_normal_fancy", "script/apps/Aries/Creator/Game/Shaders/mrt_terrain_normal.fxo"); m_terrain_fancy->LoadAsset(); if (!m_terrain_fancy->IsValid()) { // try a lower shader other than fancy return false; } } CGlobals::GetEffectManager()->MapHandleToEffect(TECH_TERRAIN, m_terrain_fancy.get()); if (bSetRenderTarget) { if (FAILED(pDevice->SetRenderTarget(1, m_render_target_depth_tex_surface)) || FAILED(pDevice->SetRenderTarget(2, m_render_target_block_info_surface)) || FAILED(pDevice->SetRenderTarget(3, m_render_target_normal_surface))) { return false; } CGlobals::GetSceneState()->SetDeferredShading(true); // clear all other render targets to zero. { static int nLastFrameCount = 0; if (nLastFrameCount != CGlobals::GetSceneState()->GetRenderFrameCount()) { nLastFrameCount = CGlobals::GetSceneState()->GetRenderFrameCount(); LPDIRECT3DSURFACE9 pOldRenderTarget = NULL; pOldRenderTarget = CGlobals::GetDirectXEngine().GetRenderTarget(); pDevice->SetRenderTarget(3, NULL); pDevice->SetRenderTarget(0, m_render_target_normal_surface); pDevice->Clear(0L, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0L); pDevice->SetRenderTarget(0, pOldRenderTarget); pDevice->SetRenderTarget(3, m_render_target_normal_surface); } CGlobals::GetViewportManager()->GetActiveViewPort()->ApplyViewport(); } } } #endif return true; } bool BlockWorldClient::DrawMultiFrameBlockWorld() { if (m_pMultiFrameRenderer) return m_pMultiFrameRenderer->Draw(); return false; } void BlockWorldClient::SetPostProcessingScript(const char* sCallbackScript) { m_sPostProcessorCallbackScript = sCallbackScript; } void BlockWorldClient::SetPostProcessingAlphaScript(const char* sCallbackScript) { m_sPostProcessorAlphaCallbackScript = sCallbackScript; } bool BlockWorldClient::CanUseAdvancedShading() { #ifdef USE_DIRECTX_RENDERER if (CGlobals::GetDirectXEngine().GetVertexShaderVersion() >= 3 && CGlobals::GetDirectXEngine().GetPixelShaderVersion() >= 3 && CGlobals::GetDirectXEngine().m_d3dCaps.NumSimultaneousRTs >= 3) { return true; } #endif return false; } void BlockWorldClient::SetUseSunlightShadowMap(bool bEnable) { m_bUseSunlightShadowMap = bEnable; #ifdef USE_DIRECTX_RENDERER if (GetBlockRenderMethod() == BLOCK_RENDER_FANCY_SHADER) { CShadowMap* pShadowMap = CGlobals::GetEffectManager()->GetShadowMap(); if (pShadowMap != NULL) { CGlobals::GetScene()->SetShadow(m_bUseSunlightShadowMap); } } #endif } bool BlockWorldClient::HasSunlightShadowMap() { return GetUseSunlightShadowMap() && CGlobals::GetScene()->IsShadowMapEnabled(); } bool BlockWorldClient::GetUseSunlightShadowMap() { return m_bUseSunlightShadowMap; } void BlockWorldClient::SetUseWaterReflection(bool bEnable) { m_bUseWaterReflection = bEnable; } bool BlockWorldClient::GetUseWaterReflection() { return m_bUseWaterReflection; } void BlockWorldClient::PrepareShadowCasters(CShadowMap* pShadowMap) { #ifdef USE_DIRECTX_RENDERER if (GetBlockRenderMethod() == BLOCK_RENDER_FANCY_SHADER && GetUseSunlightShadowMap()) { // TODO: add all shadow caster chunks within shadow radius. CShapeAABB aabb; Vector3 camWorldPos = CGlobals::GetSceneState()->vEye; Vector3 renderOrig = CGlobals::GetScene()->GetRenderOrigin(); Vector3 vCenter = camWorldPos - renderOrig; float fRadius = min(CGlobals::GetScene()->GetShadowRadius(), 50.f); Vector3 vExtent(fRadius, fRadius, fRadius); aabb.SetCenterExtents(vCenter, vExtent); pShadowMap->AddShadowCasterPoint(aabb); } #endif } void BlockWorldClient::RenderDynamicBlocks() { // no need to lock int nCount = (int)m_selectedBlockMap.size(); for (int i = 0; i < nCount; ++i) { auto& select_group = m_selectedBlockMap[i]; if (select_group.GetBlocks().size() > 0) { if (select_group.m_bWireFrame) RenderWireFrameBlock(i, select_group.m_fScaling, &select_group.m_color); else RenderSelectionBlock(i, select_group.m_fScaling, &select_group.m_color, select_group.m_bEnableBling); } } if (m_damageDegree > 0) RenderDamagedBlock(); } BlockWorldClient* BlockWorldClient::GetInstance() { return g_pInstance; } void BlockWorldClient::GetMaxBlockHeightWatchingSky(uint16_t blockX_ws, uint16_t blockZ_ws, ChunkMaxHeight* pResult) { CBlockWorld::GetMaxBlockHeightWatchingSky(blockX_ws, blockZ_ws, pResult); #ifdef PARAENGINE_CLIENT ParaTerrain::CGlobalTerrain *pTerrain = CGlobals::GetGlobalTerrain(); uint16_t mask = 0; if (pTerrain->TerrainRenderingEnabled()) { for (int i = 0; i < 5; i++) { float x, z; if (i == 0) { x = blockX_ws * BlockConfig::g_blockSize; z = blockZ_ws * BlockConfig::g_blockSize; } else if (i == 1) { x = (blockX_ws + 1) * BlockConfig::g_blockSize; z = blockZ_ws * BlockConfig::g_blockSize; } else if (i == 2) { x = (blockX_ws - 1) * BlockConfig::g_blockSize; z = blockZ_ws * BlockConfig::g_blockSize; } else if (i == 3) { x = blockX_ws * BlockConfig::g_blockSize; z = (blockZ_ws + 1) * BlockConfig::g_blockSize; } else { x = blockX_ws * BlockConfig::g_blockSize; z = (blockZ_ws - 1) * BlockConfig::g_blockSize; } float elevation = pTerrain->GetElevation(x, z); if (elevation != -FLOAT_POS_INFINITY) { elevation -= GetVerticalOffset(); int32 terrainBlockHeight = (int32)(elevation / BlockConfig::g_blockSize); if (terrainBlockHeight < 0) terrainBlockHeight = 0; if (terrainBlockHeight > BlockConfig::g_regionBlockDimY) terrainBlockHeight = BlockConfig::g_regionBlockDimY; if (terrainBlockHeight > pResult[i].GetMaxHeight()) { pResult[i].SetHeight((int16)terrainBlockHeight); mask |= (1 << i); } } } } pResult[5].SetHeight(mask); #endif } void BlockWorldClient::UpdateVisibleChunks(bool bIsShadowPass /*= false*/) { m_visibleChunks.clear(); // bool is_perspective = CGlobals::GetScene()->GetCurrentCamera()->IsPerspectiveView(); Vector3 camWorldPos = CGlobals::GetSceneState()->vEye; Vector3 renderOrig = CGlobals::GetScene()->GetRenderOrigin(); int nRenderFrameCount = CGlobals::GetSceneState()->GetRenderFrameCount(); CCameraFrustum* frustum; static CCameraFrustum caster_frustum; Vector3 camMin; Vector3 camMax; if (bIsShadowPass) { #ifdef USE_DIRECTX_RENDERER frustum = &caster_frustum; Vector3 vCenter = camWorldPos - renderOrig; float fRadius = min(CGlobals::GetScene()->GetShadowRadius(), 50.f); frustum->UpdateFrustum(CGlobals::GetEffectManager()->GetShadowMap()->GetViewProjMatrix()); camMin = Vector3(vCenter.x - fRadius, vCenter.y - fRadius, vCenter.z - fRadius); camMax = Vector3(vCenter.x + fRadius, vCenter.y + fRadius, vCenter.z + fRadius); #else return; #endif } else { frustum = CGlobals::GetScene()->GetCurrentCamera()->GetFrustum(); // calculate aabb for frustum Vector3* frusCorner = frustum->vecFrustum; camMin = frusCorner[0]; camMax = frusCorner[0]; for (int i = 1; i < 8; i++) { Vector3& v = frusCorner[i]; if (camMin.x > v.x) camMin.x = v.x; if (camMin.y > v.y) camMin.y = v.y; if (camMin.z > v.z) camMin.z = v.z; if (camMax.x < v.x) camMax.x = v.x; if (camMax.y < v.y) camMax.y = v.y; if (camMax.z < v.z) camMax.z = v.z; } } camMax += renderOrig; camMin += renderOrig; Uint16x3 camBlockPos; BlockCommon::ConvertToBlockIndex(camWorldPos.x, camWorldPos.y, camWorldPos.z, camBlockPos.x, camBlockPos.y, camBlockPos.z); SetEyeBlockId(camBlockPos); Uint16x3 startIdx, endIdx; BlockCommon::ConvertToBlockIndex(camMin.x, camMin.y, camMin.z, startIdx.x, startIdx.y, startIdx.z); startIdx.x /= 16; startIdx.y /= 16; startIdx.z /= 16; startIdx.x = startIdx.x > 0 ? startIdx.x - 1 : 0; if (m_minActiveChunkId_ws.x > startIdx.x) startIdx.x = m_minActiveChunkId_ws.x; startIdx.y = startIdx.y > 0 ? (startIdx.y <= 15 ? startIdx.y - 1 : 15) : 0; startIdx.z = startIdx.z > 0 ? startIdx.z - 1 : 0; if (m_minActiveChunkId_ws.z > startIdx.z) startIdx.z = m_minActiveChunkId_ws.z; BlockCommon::ConvertToBlockIndex(camMax.x, camMax.y, camMax.z, endIdx.x, endIdx.y, endIdx.z); endIdx.x /= 16; endIdx.y /= 16; endIdx.z /= 16; if ((m_minActiveChunkId_ws.x + m_activeChunkDim) < endIdx.x) endIdx.x = m_minActiveChunkId_ws.x + m_activeChunkDim; endIdx.y = endIdx.y < 15 ? endIdx.y + 1 : 15; if ((m_minActiveChunkId_ws.z + m_activeChunkDim) < endIdx.z) endIdx.z = m_minActiveChunkId_ws.z + m_activeChunkDim; //float fRenderDist = (std::max)(GetRenderDist(), 16) * BlockConfig::g_blockSize; float fRenderDist = GetRenderDist() * BlockConfig::g_blockSize; CShapeSphere sEyeSphere(camWorldPos, fRenderDist); // cull and update each chunk // we will add using a spiral rectangle path from the center. int32 nIndex = 0; int32 dx = 0; int32 dz = 0; int32 chunkX = GetEyeChunkId().x; int32 chunkY = GetEyeChunkId().y; int32 chunkZ = GetEyeChunkId().z; int32 chunkViewRadius = (std::max)((int)(GetRenderDist() / 16), 1); int32 chunkViewSize = chunkViewRadius * 2; Vector3 vChunkSize(BlockConfig::g_chunkSize, BlockConfig::g_chunkSize, BlockConfig::g_chunkSize); // OUTPUT_LOG("---------------cx %d, cz %d\n", chunkX, chunkZ); for (uint16 y = startIdx.y; y <= endIdx.y; y++) { uint16 x = (uint16)(chunkX); uint16 z = (uint16)(chunkZ); RenderableChunk& chunk = GetActiveChunk(x, y, z); if (x >= startIdx.x && x <= endIdx.x && z >= startIdx.z && z <= endIdx.z && chunk.IsIntersect(sEyeSphere)) { Vector3 vMin = BlockCommon::ConvertToRealPosition(x * 16, y * 16, z * 16, 7); vMin -= renderOrig; Vector3 vMax = vMin + vChunkSize; CShapeAABB box; box.SetMinMax(vMin, vMax); if (frustum->TestBox(&box) && chunk.IsNearbyChunksLoaded()) { AddToVisibleChunk(chunk, 0, nRenderFrameCount); } } } for (int32 length = 1; length <= chunkViewSize; ++length) { for (int32 k = 1; k <= 2; ++k) { int32* dir = &(BlockCommon::g_xzDirectionsConst[(nIndex % 4)][0]); nIndex++; for (int32 i = 0; i < length; ++i) { dx = dx + dir[0]; dz = dz + dir[1]; //OUTPUT_LOG("%d, %d\n", dx, dz); for (uint16 y = startIdx.y; y <= endIdx.y; y++) { uint16 x = (uint16)(chunkX + dx); uint16 z = (uint16)(chunkZ + dz); RenderableChunk& chunk = GetActiveChunk(x, y, z); if (x >= startIdx.x && x <= endIdx.x && z >= startIdx.z && z <= endIdx.z && chunk.IsIntersect(sEyeSphere)) { Vector3 vMin = BlockCommon::ConvertToRealPosition(x * 16, y * 16, z * 16, 7); vMin -= renderOrig; Vector3 vMax = vMin + vChunkSize; CShapeAABB box; box.SetMinMax(vMin, vMax); if (frustum->TestBox(&box) && chunk.IsNearbyChunksLoaded()) { AddToVisibleChunk(chunk, length, nRenderFrameCount); } } } } } } nIndex = (nIndex % 4); for (int32 i = 1; i <= chunkViewSize; ++i) { dx = dx + BlockCommon::g_xzDirectionsConst[nIndex][0]; dz = dz + BlockCommon::g_xzDirectionsConst[nIndex][1]; for (uint16_t y = startIdx.y; y <= endIdx.y; y++) { uint16 x = (uint16)(chunkX + dx); uint16 z = (uint16)(chunkZ + dz); RenderableChunk& chunk = GetActiveChunk(x, y, z); if (x >= startIdx.x && x <= endIdx.x && z >= startIdx.z && z <= endIdx.z && chunk.IsIntersect(sEyeSphere)) { Vector3 vMin = BlockCommon::ConvertToRealPosition(x * 16, y * 16, z * 16, 7); vMin -= renderOrig; Vector3 vMax = vMin + vChunkSize; CShapeAABB box; box.SetMinMax(vMin, vMax); if (frustum->TestBox(&box) && chunk.IsNearbyChunksLoaded()) { AddToVisibleChunk(chunk, chunkViewSize, nRenderFrameCount); } } } } if (!bIsShadowPass) m_isVisibleChunkDirty = false; } void BlockWorldClient::AddToVisibleChunk(RenderableChunk &chunk, int nViewDist, int nRenderFrameCount) { chunk.SetChunkViewDistance((int16)nViewDist); chunk.SetViewIndex((int16)m_visibleChunks.size()); chunk.SetRenderFrameCount(nRenderFrameCount); m_visibleChunks.push_back(&chunk); } void BlockWorldClient::ClearVisibleChunksToByteLimit(bool bIsShadowPass) { int nMaxChunkIndex = (int)m_visibleChunks.size(); if (!bIsShadowPass) { int nCurrentVertexBufferSize = 0; for (int i = 0; i < nMaxChunkIndex; i++) { RenderableChunk* pRenderChunk = m_visibleChunks[i]; int nBufferSize = pRenderChunk->GetLastBufferBytes(); nCurrentVertexBufferSize += nBufferSize; if (nCurrentVertexBufferSize > GetMaxVisibleVertexBufferBytes()) { nMaxChunkIndex = i + 1; m_visibleChunks.resize(nMaxChunkIndex); break; } } } } int BlockWorldClient::ClearActiveChunksToMemLimit(bool bIsShadowPass) { int nMaxChunkIndex = (int)m_visibleChunks.size(); int nUsedBytes = (int)(RenderableChunk::GetVertexBufferPool()->GetTotalBufferBytes()); int nBytesToRemove = nUsedBytes - GetVertexBufferSizeLimit(); if (nBytesToRemove > 0) { if (bIsShadowPass) return 0; static std::set<RenderableChunk*> m_safeVisibleChunks; static std::deque<RenderableChunk*> m_removableChunks; m_safeVisibleChunks.clear(); m_removableChunks.clear(); int nCurrentRenderFrame = (m_visibleChunks.size() > 0) ? m_visibleChunks[0]->GetRenderFrameCount() : 0; if (GetAlwaysInVertexBufferChunkRadius() > 0) { // add all always in cache chunks to safe chunks. int32 chunkX = GetEyeChunkId().x; int32 chunkY = GetEyeChunkId().y; int32 chunkZ = GetEyeChunkId().z; int32 nCacheRadius = GetAlwaysInVertexBufferChunkRadius(); for (int x = chunkX - nCacheRadius; x <= (chunkX + nCacheRadius); x++) { for (int y = chunkY - nCacheRadius; y <= (chunkY + nCacheRadius); y++) { for (int z = chunkZ - nCacheRadius; z <= (chunkZ + nCacheRadius); z++) { if (x >= 0 && y >= 0 && z >= 0) { RenderableChunk& chunk = GetActiveChunk((uint16)x, (uint16)y, (uint16)z); m_safeVisibleChunks.insert(&chunk); } } } } } int nCurrentVertexBufferSize = 0; for (int i = 0; i < nMaxChunkIndex; i++) { RenderableChunk* pRenderChunk = m_visibleChunks[i]; int nBufferSize = pRenderChunk->GetLastBufferBytes(); nCurrentVertexBufferSize += nBufferSize; m_safeVisibleChunks.insert(pRenderChunk); if (nCurrentVertexBufferSize > GetVertexBufferSizeLimit()) { nMaxChunkIndex = i + 1; // if memory is tight, remove chunks that is out of memory range. ChunkVertexBuilderManager::GetInstance().RemovePendingChunks(&m_safeVisibleChunks); break; } } for (int z = 0; z < m_activeChunkDim; z++) { int16_t curChunkWZ = m_minActiveChunkId_ws.z + z; for (int x = 0; x < m_activeChunkDim; x++) { int16_t curChunkWX = m_minActiveChunkId_ws.x + x; { for (int y = 0; y < m_activeChunkDimY; y++) { int16_t curChunkWY = m_minActiveChunkId_ws.y + y; RenderableChunk* pChunk = &GetActiveChunk(curChunkWX, curChunkWY, curChunkWZ); int nBufferSize = pChunk->GetVertexBufferBytes(); if (nBufferSize > 0 && m_safeVisibleChunks.find(pChunk) == m_safeVisibleChunks.end()) { if (nCurrentVertexBufferSize < GetVertexBufferSizeLimit()) { // visible chunks has not exceed memory limit, we will put unused chunks to a sorted queue according to render frame count. if (m_removableChunks.empty() || m_removableChunks.back()->GetRenderFrameCount() > pChunk->GetRenderFrameCount() || (nCurrentRenderFrame == pChunk->GetRenderFrameCount() && m_removableChunks.back()->GetChunkViewDistance() < pChunk->GetChunkViewDistance())) m_removableChunks.push_back(pChunk); else m_removableChunks.push_front(pChunk); } else { // visible chunks already consumes too much memory, we will remove everything else if (nBytesToRemove > nBufferSize) { nBytesToRemove -= nBufferSize; pChunk->ClearChunkData(); } } } } } } } // m_removableChunks is sorted from newest chunk to oldest chunk. // we will remove oldest chunks first. while (!m_removableChunks.empty()) { RenderableChunk* pChunk = m_removableChunks.back(); int nBufferSize = pChunk->GetVertexBufferBytes(); if (nBytesToRemove > nBufferSize) { nBytesToRemove -= nBufferSize; pChunk->ClearChunkData(); m_removableChunks.pop_back(); } else break; } m_removableChunks.clear(); } return nMaxChunkIndex; } void BlockWorldClient::CheckRebuildVisibleChunks(bool bAsyncMode, bool bIsShadowPass) { int nMaxChunkIndex = ClearActiveChunksToMemLimit(bIsShadowPass); m_tempDirtyChunks.clear(); for (int i = 0; i < nMaxChunkIndex; i++) { RenderableChunk* pRenderChunk = m_visibleChunks[i]; BlockChunk* pChunk = pRenderChunk->GetChunk(); if (pChunk/* && pChunk->IsLightingInitialized()*/) { if (pRenderChunk->ShouldRebuildRenderBuffer(this, true, false)) { // new buffer first int nLastDelayTick = pRenderChunk->GetDelayedRebuildTick(); int nViewDist = pRenderChunk->GetChunkViewDistance(); if (nViewDist <= m_nNearCameraChunkDist) pRenderChunk->SetDelayedRebuildTick(nLastDelayTick + 3); else pRenderChunk->SetDelayedRebuildTick(nLastDelayTick + 1); m_tempDirtyChunks.push_back(pRenderChunk); } else if (pRenderChunk->ShouldRebuildRenderBuffer(this, false, true)) { // check update buffer. int nLastDelayTick = pRenderChunk->GetDelayedRebuildTick(); int nViewDist = pRenderChunk->GetChunkViewDistance(); if (nViewDist <= m_nNearCameraChunkDist) pRenderChunk->SetDelayedRebuildTick(nLastDelayTick + 2); else pRenderChunk->SetDelayedRebuildTick(nLastDelayTick + 1); m_tempDirtyChunks.push_back(pRenderChunk); } } } std::stable_sort(m_tempDirtyChunks.begin(), m_tempDirtyChunks.end(), [](RenderableChunk* a, RenderableChunk* b) { return (a->GetDelayedRebuildTick() > b->GetDelayedRebuildTick()); }); int nMaxBufferRebuildPerTick = GetMaxBufferRebuildPerTick(); for (RenderableChunk * pRenderChunk : m_tempDirtyChunks) { if (pRenderChunk->RebuildRenderBuffer(this, bAsyncMode)) { #ifdef PRINT_CHUNK_LOG if (pRenderChunk->IsDirty()) OUTPUT_LOG("rebuild New chunk: pos(%d %d %d) ViewDist:%d DelayCount:%d\n", pRenderChunk->GetChunkPosWs().x, pRenderChunk->GetChunkPosWs().y, pRenderChunk->GetChunkPosWs().z, pRenderChunk->GetChunkViewDistance(), pRenderChunk->GetDelayedRebuildTick()); else OUTPUT_LOG("rebuild chunk: pos(%d %d %d) ViewDist:%d DelayCount:%d\n", pRenderChunk->GetChunkPosWs().x, pRenderChunk->GetChunkPosWs().y, pRenderChunk->GetChunkPosWs().z, pRenderChunk->GetChunkViewDistance(), pRenderChunk->GetDelayedRebuildTick()); #endif m_nBufferRebuildCountThisTick++; if (pRenderChunk->GetChunkViewDistance() > GetNearCameraChunkDist()) { // for far away blocks, we will only rebuild 1 per tick, instead of 3. just in case the view distance is set really high. nMaxBufferRebuildPerTick = GetMaxBufferRebuildPerTick_FarChunk(); } if (bAsyncMode && m_nBufferRebuildCountThisTick >= nMaxBufferRebuildPerTick) break; } else break; } m_tempDirtyChunks.clear(); } std::vector<BlockRenderTask*>* BlockWorldClient::GetRenderQueueByPass(BlockRenderPass nRenderPass) { if (nRenderPass == BlockRenderPass_Opaque) return &m_solidRenderTasks; else if (nRenderPass == BlockRenderPass_AlphaTest) return &m_alphaTestRenderTasks; else if (nRenderPass == BlockRenderPass_ReflectedWater) return &m_reflectedWaterRenderTasks; else return &m_alphaBlendRenderTasks; } bool BlockWorldClient::IsMovieOutputMode() const { return m_bMovieOutputMode; } void BlockWorldClient::EnableMovieOutputMode(bool val) { #ifdef WIN32 if (m_bMovieOutputMode != val) { static int s_lastMaxCacheRegionCount = m_maxCacheRegionCount; static int s_nMaxBufferRebuildPerTick = m_nMaxBufferRebuildPerTick; static int s_nNearCameraChunkDist = m_nNearCameraChunkDist; static int s_nMaxBufferRebuildPerTick_FarChunk = m_nMaxBufferRebuildPerTick_FarChunk; m_bMovieOutputMode = val; if (m_bMovieOutputMode) { s_lastMaxCacheRegionCount = m_maxCacheRegionCount; s_nMaxBufferRebuildPerTick = m_nMaxBufferRebuildPerTick; s_nNearCameraChunkDist = m_nNearCameraChunkDist; s_nMaxBufferRebuildPerTick_FarChunk = m_nMaxBufferRebuildPerTick_FarChunk; m_maxCacheRegionCount = 64; m_nMaxBufferRebuildPerTick = 100; m_nNearCameraChunkDist = 20; m_nMaxBufferRebuildPerTick_FarChunk = 100; ChunkVertexBuilderManager::GetInstance().m_nMaxPendingChunks = 100; ChunkVertexBuilderManager::GetInstance().m_nMaxUploadingChunks = 100; ChunkVertexBuilderManager::GetInstance().m_nMaxChunksToUploadPerTick = 100; OUTPUT_LOG("movie output mode is on\n"); } else { m_maxCacheRegionCount = s_lastMaxCacheRegionCount; m_nMaxBufferRebuildPerTick = s_nMaxBufferRebuildPerTick; m_nNearCameraChunkDist = s_nNearCameraChunkDist; m_nMaxBufferRebuildPerTick_FarChunk = s_nMaxBufferRebuildPerTick_FarChunk; ChunkVertexBuilderManager::GetInstance().m_nMaxPendingChunks = 4; ChunkVertexBuilderManager::GetInstance().m_nMaxUploadingChunks = 4; ChunkVertexBuilderManager::GetInstance().m_nMaxChunksToUploadPerTick = 8; OUTPUT_LOG("movie output mode is off\n"); } } #endif } void BlockWorldClient::UpdateActiveChunk() { CBlockWorld::UpdateActiveChunk(); } int BlockWorldClient::GetVertexBufferSizeLimit() const { return m_nVertexBufferSizeLimit; } void BlockWorldClient::SetVertexBufferSizeLimit(int val) { m_nVertexBufferSizeLimit = val; } IAttributeFields* BlockWorldClient::GetChildAttributeObject(const std::string& sName) { if (sName == "ChunkVertexBuilderManager") { return &(ChunkVertexBuilderManager::GetInstance()); } else if (sName == "LightGrid") { return &(GetLightGrid()); } else if (sName == "CMultiFrameBlockWorldRenderer") { return m_pMultiFrameRenderer; } else return CBlockWorld::GetChildAttributeObject(sName); } int BlockWorldClient::GetChildAttributeColumnCount() { return 2; } IAttributeFields* BlockWorldClient::GetChildAttributeObject(int nRowIndex, int nColumnIndex /*= 0*/) { if (nColumnIndex == 1) { if (nRowIndex == 0) return &(GetLightGrid()); else if (nRowIndex == 1) return &(ChunkVertexBuilderManager::GetInstance()); else if (nRowIndex == 2) return m_pMultiFrameRenderer; } return CBlockWorld::GetChildAttributeObject(nRowIndex, nColumnIndex); } int BlockWorldClient::GetChildAttributeObjectCount(int nColumnIndex /*= 0*/) { if (nColumnIndex == 1) { return 3; } return CBlockWorld::GetChildAttributeObjectCount(nColumnIndex); } int BlockWorldClient::GetAlwaysInVertexBufferChunkRadius() const { return m_nAlwaysInVertexBufferChunkRadius; } void BlockWorldClient::SetAlwaysInVertexBufferChunkRadius(int val) { m_nAlwaysInVertexBufferChunkRadius = val; } int BlockWorldClient::GetMaxVisibleVertexBufferBytes() const { return m_nMaxVisibleVertexBufferBytes; } void BlockWorldClient::SetMaxVisibleVertexBufferBytes(int val) { m_nMaxVisibleVertexBufferBytes = val; } bool BlockWorldClient::IsAsyncChunkMode() const { return m_bAsyncChunkMode; } void BlockWorldClient::SetAsyncChunkMode(bool val) { if (m_bAsyncChunkMode != val) { m_bAsyncChunkMode = val; if (!m_bAsyncChunkMode) { } } } int BlockWorldClient::GetMaxBufferRebuildPerTick() const { return m_nMaxBufferRebuildPerTick; } void BlockWorldClient::SetMaxBufferRebuildPerTick(int val) { m_nMaxBufferRebuildPerTick = val; } int BlockWorldClient::GetNearCameraChunkDist() const { return m_nNearCameraChunkDist; } void BlockWorldClient::SetNearCameraChunkDist(int val) { m_nNearCameraChunkDist = val; } int BlockWorldClient::GetMaxBufferRebuildPerTick_FarChunk() const { return m_nMaxBufferRebuildPerTick_FarChunk; } void BlockWorldClient::SetMaxBufferRebuildPerTick_FarChunk(int val) { m_nMaxBufferRebuildPerTick_FarChunk = val; if (m_nMaxBufferRebuildPerTick_FarChunk > GetMaxBufferRebuildPerTick()) SetMaxBufferRebuildPerTick(m_nMaxBufferRebuildPerTick_FarChunk); } bool BlockWorldClient::DrawMultiFrameBlockWorldOnSky() { return m_pMultiFrameRenderer->DrawToSkybox(); } void BlockWorldClient::RenderDeferredLightsMesh() { return; #ifdef USE_DIRECTX_RENDERER SceneState* sceneState = CGlobals::GetSceneState(); if (!sceneState->IsDeferredShading() || sceneState->listDeferredLightObjects.empty()) return; // sort by light type std::sort(sceneState->listDeferredLightObjects.begin(), sceneState->listDeferredLightObjects.end(), [](CLightObject* a, CLightObject* b) { return (a->GetLightType() < b->GetLightType()); }); // setup shader here for (int i = 0; i < 3; i++) { if (m_lightgeometry_effects[i] == 0) { if (i == 0) m_lightgeometry_effects[i] = CGlobals::GetAssetManager()->LoadEffectFile("blockFancy", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingPointLighting.fxo"); else if (i == 2) m_lightgeometry_effects[i] = CGlobals::GetAssetManager()->LoadEffectFile("blockFancy", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingSpotLighting.fxo"); else m_lightgeometry_effects[i] = CGlobals::GetAssetManager()->LoadEffectFile("blockFancy", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingDirectionalLighting.fxo"); m_lightgeometry_effects[i]->LoadAsset(); } if (!m_lightgeometry_effects[i] || !m_lightgeometry_effects[i]->IsValid()) return; } // sort by type and render light geometry int nLastType = -1; CGlobals::GetEffectManager()->EndEffect(); CEffectFile* pEffectFile = NULL; for (CLightObject* lightObject : sceneState->listDeferredLightObjects) { if (lightObject->GetLightType() != nLastType) { if (pEffectFile) { pEffectFile->end(); } else { // first time, we will switch to declaration auto pDecl = CGlobals::GetEffectManager()->GetVertexDeclaration(EffectManager::S0_POS); if (pDecl) CGlobals::GetRenderDevice()->SetVertexDeclaration(pDecl); } pEffectFile = m_lightgeometry_effects[lightObject->GetLightType() - 1].get(); pEffectFile->begin(); } lightObject->RenderDeferredLightMesh(sceneState); } if (pEffectFile) { pEffectFile->end(); } #endif } void BlockWorldClient::RenderDeferredLighting() { #ifdef USE_DIRECTX_RENDERER SceneState* sceneState = CGlobals::GetSceneState(); if (!sceneState->IsDeferredShading() || sceneState->listDeferredLightObjects.empty()) return; CGlobals::GetEffectManager()->EndEffect(); auto pDevice = sceneState->GetRenderDevice(); ParaScripting::ParaAsset::LoadEffectFile("deferred_point_lighting", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingPointLighting.fxo"); ParaScripting::ParaAsset::LoadEffectFile("deferred_spot_lighting", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingSpotLighting.fxo"); ParaScripting::ParaAsset::LoadEffectFile("deferred_directional_lighting", "script/apps/Aries/Creator/Game/Shaders/DeferredShadingDirectionalLighting.fxo"); ParaScripting::ParaAssetObject effect = NULL; VertexDeclarationPtr pDecl = NULL; ID3DXMesh * pObject = NULL; for (CLightObject* lightObject : sceneState->listDeferredLightObjects) { auto light_param = lightObject->GetLightParams(); auto light_type = light_param->Type; auto light_diffuse = light_param->Diffuse; auto light_specular = light_param->Specular; auto light_ambient = light_param->Ambient; auto light_position = light_param->Position; auto light_direction = lightObject->GetDirection(); auto light_range = light_param->Range; auto light_falloff = light_param->Falloff; auto light_attenuation0 = light_param->Attenuation0; auto light_attenuation1 = light_param->Attenuation1; auto light_attenuation2 = light_param->Attenuation2; auto light_theta = light_param->Theta; auto light_phi = light_param->Phi; // how complicated the mesh is int mesh_slice_num = 50; switch (light_type) { case D3DLIGHT_POINT: effect = ParaScripting::ParaAsset::GetEffectFile("deferred_point_lighting"); D3DXCreateSphere(pDevice, light_range, mesh_slice_num, mesh_slice_num, &pObject, 0); pDecl = CGlobals::GetEffectManager()->GetVertexDeclaration(EffectManager::S0_POS); break; case D3DLIGHT_SPOT: effect = ParaScripting::ParaAsset::GetEffectFile("deferred_spot_lighting"); // FIXME: how to draw a spherical cone but a normal cone //D3DXCreateCylinder(pDevice, 0.0f, 2.0f, 5.0f, 100, 100, &pObject, 0); D3DXCreateSphere(pDevice, light_range, mesh_slice_num, mesh_slice_num, &pObject, 0); pDecl = CGlobals::GetEffectManager()->GetVertexDeclaration(EffectManager::S0_POS); break; case D3DLIGHT_DIRECTIONAL: effect = ParaScripting::ParaAsset::GetEffectFile("deferred_directional_lighting"); pDecl = CGlobals::GetEffectManager()->GetVertexDeclaration(EffectManager::S0_POS_TEX0); break; } if (pDecl) pDevice->SetVertexDeclaration(pDecl); effect.Begin(); auto params = effect.GetParamBlock(); params.SetParam("ViewAspect", "floatViewAspect"); params.SetParam("TanHalfFOV", "floatTanHalfFOV"); params.SetParam("screenParam", "vec2ScreenSize"); params.SetParam("viewportOffset", "vec2ViewportOffset"); params.SetParam("viewportScale", "vec2ViewportScale"); Matrix4 mxWorld; lightObject->GetRenderMatrix(mxWorld); CGlobals::GetWorldMatrixStack().push(mxWorld); params.SetParam("matWorld", "mat4World"); CGlobals::GetWorldMatrixStack().pop(); params.SetParam("matView", "mat4View"); params.SetParam("matProj", "mat4Projection"); params.SetVector4("light_diffuse", light_diffuse.r, light_diffuse.g, light_diffuse.b, light_diffuse.a); params.SetVector4("light_specular", light_specular.r, light_specular.g, light_specular.b, light_specular.a); params.SetVector4("light_ambient", light_ambient.r, light_ambient.g, light_ambient.b, light_ambient.a); params.SetVector3("light_position", light_position.x, light_position.y, light_position.z); params.SetVector3("light_direction", light_direction.x, light_direction.y, light_direction.z); params.SetFloat("light_range", light_range); params.SetFloat("light_falloff", light_falloff); params.SetFloat("light_attenuation0", light_attenuation0); params.SetFloat("light_attenuation1", light_attenuation1); params.SetFloat("light_attenuation2", light_attenuation2); params.SetFloat("light_theta", light_theta); params.SetFloat("light_phi", light_phi); auto _ColorRT = ParaScripting::ParaAsset::LoadTexture("_ColorRT", "_ColorRT", 0); auto originRT = ParaScripting::CParaEngine::GetRenderTarget(); ParaScripting::CParaEngine::StretchRect(originRT, _ColorRT); ParaScripting::CParaEngine::SetRenderTarget(originRT); params.SetTextureObj(0, _ColorRT); params.SetTextureObj(2, ParaScripting::ParaAsset::LoadTexture("_DepthTexRT_R32F", "_DepthTexRT_R32F", 0)); params.SetTextureObj(3, ParaScripting::ParaAsset::LoadTexture("_NormalRT", "_NormalRT", 0)); effect.CommitChanges(); pDevice->Clear(0, 0, D3DCLEAR_STENCIL, 0, 1.0f, 0); switch (light_type) { case D3DLIGHT_POINT: case D3DLIGHT_SPOT: for (int pass = 0; pass < 2; pass++) { if (effect.BeginPass(pass)) { pObject->DrawSubset(0); effect.EndPass(); } } pObject->Release(); break; case D3DLIGHT_DIRECTIONAL: if (effect.BeginPass(0)) { ParaScripting::CParaEngine::DrawQuad(); effect.EndPass(); } break; } effect.End(); } #endif } int BlockWorldClient::InstallFields(CAttributeClass* pClass, bool bOverride) { // install parent fields if there are any. Please replace CBlockWorld with your parent class name. CBlockWorld::InstallFields(pClass, bOverride); PE_ASSERT(pClass != NULL); pClass->AddField("BlockLightColor", FieldType_Vector3, (void*)SetBlockLightColor_s, (void*)GetBlockLightColor_s, NULL, NULL, bOverride); pClass->AddField("PostProcessingScript", FieldType_String, (void*)SetPostProcessingScript_s, NULL, NULL, NULL, bOverride); pClass->AddField("PostProcessingAlphaScript", FieldType_String, (void*)SetPostProcessingAlphaScript_s, NULL, NULL, NULL, bOverride); pClass->AddField("HasSunlightShadowMap", FieldType_Bool, (void*)0, (void*)HasSunlightShadowMap_s, NULL, NULL, bOverride); pClass->AddField("UseSunlightShadowMap", FieldType_Bool, (void*)SetUseSunlightShadowMap_s, (void*)GetUseSunlightShadowMap_s, NULL, NULL, bOverride); pClass->AddField("UseWaterReflection", FieldType_Bool, (void*)SetUseWaterReflection_s, (void*)GetUseWaterReflection_s, NULL, NULL, bOverride); pClass->AddField("CanUseAdvancedShading", FieldType_Bool, NULL, (void*)CanUseAdvancedShading_s, NULL, NULL, bOverride); pClass->AddField("MovieOutputMode", FieldType_Bool, (void*)EnableMovieOutputMode_s, (void*)IsMovieOutputMode_s, NULL, NULL, bOverride); pClass->AddField("AsyncChunkMode", FieldType_Bool, (void*)SetAsyncChunkMode_s, (void*)IsAsyncChunkMode_s, NULL, NULL, bOverride); pClass->AddField("VertexBufferSizeLimit", FieldType_Int, (void*)SetVertexBufferSizeLimit_s, (void*)GetVertexBufferSizeLimit_s, NULL, NULL, bOverride); pClass->AddField("AlwaysInVertexBufferChunkRadius", FieldType_Int, (void*)SetAlwaysInVertexBufferChunkRadius_s, (void*)GetAlwaysInVertexBufferChunkRadius_s, NULL, NULL, bOverride); pClass->AddField("MaxVisibleVertexBufferBytes", FieldType_Int, (void*)SetMaxVisibleVertexBufferBytes_s, (void*)GetMaxVisibleVertexBufferBytes_s, NULL, NULL, bOverride); pClass->AddField("NearCameraChunkDist", FieldType_Int, (void*)SetNearCameraChunkDist_s, (void*)GetNearCameraChunkDist_s, NULL, NULL, bOverride); pClass->AddField("MaxBufferRebuildPerTick", FieldType_Int, (void*)SetMaxBufferRebuildPerTick_s, (void*)GetMaxBufferRebuildPerTick_s, NULL, NULL, bOverride); pClass->AddField("MaxBufferRebuildPerTick_FarChunk", FieldType_Int, (void*)SetMaxBufferRebuildPerTick_FarChunk_s, (void*)GetMaxBufferRebuildPerTick_FarChunk_s, NULL, NULL, bOverride); pClass->AddField("UsePointTextureFiltering", FieldType_Bool, (void*)SetUsePointTextureFiltering_s, (void*)GetUsePointTextureFiltering_s, NULL, NULL, bOverride); return S_OK; } }
LiXizhi/NPLRuntime
Client/trunk/ParaEngineClient/BlockEngine/BlockWorldClient.cpp
C++
gpl-2.0
113,122
from re import compile as re_compile from os import path as os_path, listdir from MenuList import MenuList from Components.Harddisk import harddiskmanager from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename, fileExists from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \ eServiceReference, eServiceCenter, gFont from Tools.LoadPixmap import LoadPixmap EXTENSIONS = { "m4a": "music", "mp2": "music", "mp3": "music", "wav": "music", "ogg": "music", "flac": "music", "jpg": "picture", "jpeg": "picture", "png": "picture", "bmp": "picture", "ts": "movie", "avi": "movie", "divx": "movie", "m4v": "movie", "mpg": "movie", "mpeg": "movie", "mkv": "movie", "mp4": "movie", "mov": "movie", "m2ts": "movie", } def FileEntryComponent(name, absolute = None, isDir = False): res = [ (absolute, isDir) ] res.append((eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 470, 20, 0, RT_HALIGN_LEFT, name)) if isDir: png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png")) else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png")) else: png = None if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 2, 20, 20, png)) return res class FileList(MenuList): def __init__(self, directory, showDirectories = True, showFiles = True, showMountpoints = True, matchingPattern = None, useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None): MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) self.additional_extensions = additionalExtensions self.mountpoints = [] self.current_directory = None self.current_mountpoint = None self.useServiceRef = useServiceRef self.showDirectories = showDirectories self.showMountpoints = showMountpoints self.showFiles = showFiles self.isTop = isTop # example: matching .nfi and .ts files: "^.*\.(nfi|ts)" self.matchingPattern = matchingPattern self.inhibitDirs = inhibitDirs or [] self.inhibitMounts = inhibitMounts or [] self.refreshMountpoints() self.changeDir(directory) self.l.setFont(0, gFont("Regular", 18)) self.l.setItemHeight(23) self.serviceHandler = eServiceCenter.getInstance() def refreshMountpoints(self): self.mountpoints = [os_path.join(p.mountpoint, "") for p in harddiskmanager.getMountedPartitions()] self.mountpoints.sort(reverse = True) def getMountpoint(self, file): file = os_path.join(os_path.realpath(file), "") for m in self.mountpoints: if file.startswith(m): return m return False def getMountpointLink(self, file): if os_path.realpath(file) == file: return self.getMountpoint(file) else: if file[-1] == "/": file = file[:-1] mp = self.getMountpoint(file) last = file file = os_path.dirname(file) while last != "/" and mp == self.getMountpoint(file): last = file file = os_path.dirname(file) return os_path.join(last, "") def getSelection(self): if self.l.getCurrentSelection() is None: return None return self.l.getCurrentSelection()[0] def getCurrentEvent(self): l = self.l.getCurrentSelection() if not l or l[0][1] == True: return None else: return self.serviceHandler.info(l[0][0]).getEvent(l[0][0]) def getFileList(self): return self.list def inParentDirs(self, dir, parents): dir = os_path.realpath(dir) for p in parents: if dir.startswith(p): return True return False def changeDir(self, directory, select = None): self.list = [] # if we are just entering from the list of mount points: if self.current_directory is None: if directory and self.showMountpoints: self.current_mountpoint = self.getMountpointLink(directory) else: self.current_mountpoint = None self.current_directory = directory directories = [] files = [] if directory is None and self.showMountpoints: # present available mountpoints for p in harddiskmanager.getMountedPartitions(): path = os_path.join(p.mountpoint, "") if path not in self.inhibitMounts and not self.inParentDirs(path, self.inhibitDirs): self.list.append(FileEntryComponent(name = p.description, absolute = path, isDir = True)) files = [ ] directories = [ ] elif directory is None: files = [ ] directories = [ ] elif self.useServiceRef: # we should not use the 'eServiceReference(string)' constructor, because it doesn't allow ':' in the directoryname root = eServiceReference(2, 0, directory) if self.additional_extensions: root.setName(self.additional_extensions) serviceHandler = eServiceCenter.getInstance() list = serviceHandler.list(root) while 1: s = list.getNext() if not s.valid(): del list break if s.flags & s.mustDescent: directories.append(s.getPath()) else: files.append(s) directories.sort() files.sort() else: if fileExists(directory): try: files = listdir(directory) except: files = [] files.sort() tmpfiles = files[:] for x in tmpfiles: if os_path.isdir(directory + x): directories.append(directory + x + "/") files.remove(x) if directory is not None and self.showDirectories and not self.isTop: if directory == self.current_mountpoint and self.showMountpoints: self.list.append(FileEntryComponent(name = "<" +_("List of Storage Devices") + ">", absolute = None, isDir = True)) elif (directory != "/") and not (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts): self.list.append(FileEntryComponent(name = "<" +_("Parent Directory") + ">", absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True)) if self.showDirectories: for x in directories: if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs): name = x.split('/')[-2] self.list.append(FileEntryComponent(name = name, absolute = x, isDir = True)) if self.showFiles: for x in files: if self.useServiceRef: path = x.getPath() name = path.split('/')[-1] else: path = directory + x name = x if (self.matchingPattern is None) or re_compile(self.matchingPattern).search(path): self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False)) if self.showMountpoints and len(self.list) == 0: self.list.append(FileEntryComponent(name = _("nothing connected"), absolute = None, isDir = False)) self.l.setList(self.list) if select is not None: i = 0 self.moveToIndex(0) for x in self.list: p = x[0][0] if isinstance(p, eServiceReference): p = p.getPath() if p == select: self.moveToIndex(i) i += 1 def getCurrentDirectory(self): return self.current_directory def canDescent(self): if self.getSelection() is None: return False return self.getSelection()[1] def descent(self): if self.getSelection() is None: return self.changeDir(self.getSelection()[0], select = self.current_directory) def getFilename(self): if self.getSelection() is None: return None x = self.getSelection()[0] if isinstance(x, eServiceReference): x = x.getPath() return x def getServiceRef(self): if self.getSelection() is None: return None x = self.getSelection()[0] if isinstance(x, eServiceReference): return x return None def execBegin(self): harddiskmanager.on_partition_list_change.append(self.partitionListChanged) def execEnd(self): harddiskmanager.on_partition_list_change.remove(self.partitionListChanged) def refresh(self): self.changeDir(self.current_directory, self.getFilename()) def partitionListChanged(self, action, device): self.refreshMountpoints() if self.current_directory is None: self.refresh() def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected = False): res = [ (absolute, isDir, selected, name) ] res.append((eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name)) if isDir: png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png")) else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png")) else: png = None if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 30, 2, 20, 20, png)) if not name.startswith('<'): if selected is False: icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_off.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon)) else: icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon)) return res class MultiFileSelectList(FileList): def __init__(self, preselectedFiles, directory, showMountpoints = False, matchingPattern = None, showDirectories = True, showFiles = True, useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None): self.selectedFiles = preselectedFiles if self.selectedFiles is None: self.selectedFiles = [] FileList.__init__(self, directory, showMountpoints = showMountpoints, matchingPattern = matchingPattern, showDirectories = showDirectories, showFiles = showFiles, useServiceRef = useServiceRef, inhibitDirs = inhibitDirs, inhibitMounts = inhibitMounts, isTop = isTop, enableWrapAround = enableWrapAround, additionalExtensions = additionalExtensions) self.changeDir(directory) self.l.setItemHeight(25) self.l.setFont(0, gFont("Regular", 20)) self.onSelectionChanged = [ ] def selectionChanged(self): for f in self.onSelectionChanged: f() def changeSelectionState(self): idx = self.l.getCurrentSelectionIndex() count = 0 newList = [] for x in self.list: if idx == count: if x[0][3].startswith('<'): newList.append(x) else: if x[0][1] is True: realPathname = x[0][0] else: realPathname = self.current_directory + x[0][0] if x[0][2] == True: SelectState = False for entry in self.selectedFiles: if entry == realPathname: self.selectedFiles.remove(entry) else: SelectState = True alreadyinList = False for entry in self.selectedFiles: if entry == realPathname: alreadyinList = True if not alreadyinList: self.selectedFiles.append(realPathname) newList.append(MultiFileSelectEntryComponent(name = x[0][3], absolute = x[0][0], isDir = x[0][1], selected = SelectState )) else: newList.append(x) count += 1 self.list = newList self.l.setList(self.list) def getSelectedList(self): return self.selectedFiles def changeDir(self, directory, select = None): self.list = [] # if we are just entering from the list of mount points: if self.current_directory is None: if directory and self.showMountpoints: self.current_mountpoint = self.getMountpointLink(directory) else: self.current_mountpoint = None self.current_directory = directory directories = [] files = [] if directory is None and self.showMountpoints: # present available mountpoints for p in harddiskmanager.getMountedPartitions(): path = os_path.join(p.mountpoint, "") if path not in self.inhibitMounts and not self.inParentDirs(path, self.inhibitDirs): self.list.append(MultiFileSelectEntryComponent(name = p.description, absolute = path, isDir = True)) files = [ ] directories = [ ] elif directory is None: files = [ ] directories = [ ] elif self.useServiceRef: root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory) if self.additional_extensions: root.setName(self.additional_extensions) serviceHandler = eServiceCenter.getInstance() list = serviceHandler.list(root) while 1: s = list.getNext() if not s.valid(): del list break if s.flags & s.mustDescent: directories.append(s.getPath()) else: files.append(s) directories.sort() files.sort() else: if fileExists(directory): try: files = listdir(directory) except: files = [] files.sort() tmpfiles = files[:] for x in tmpfiles: if os_path.isdir(directory + x): directories.append(directory + x + "/") files.remove(x) if directory is not None and self.showDirectories and not self.isTop: if directory == self.current_mountpoint and self.showMountpoints: self.list.append(MultiFileSelectEntryComponent(name = "<" +_("List of Storage Devices") + ">", absolute = None, isDir = True)) elif (directory != "/") and not (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts): self.list.append(MultiFileSelectEntryComponent(name = "<" +_("Parent Directory") + ">", absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True)) if self.showDirectories: for x in directories: if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs): name = x.split('/')[-2] alreadySelected = False for entry in self.selectedFiles: if entry == x: alreadySelected = True if alreadySelected: self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x, isDir = True, selected = True)) else: self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x, isDir = True, selected = False)) if self.showFiles: for x in files: if self.useServiceRef: path = x.getPath() name = path.split('/')[-1] else: path = directory + x name = x if (self.matchingPattern is None) or re_compile(self.matchingPattern).search(path): alreadySelected = False for entry in self.selectedFiles: if os_path.basename(entry) == x: alreadySelected = True if alreadySelected: self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x , isDir = False, selected = True)) else: self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x , isDir = False, selected = False)) self.l.setList(self.list) if select is not None: i = 0 self.moveToIndex(0) for x in self.list: p = x[0][0] if isinstance(p, eServiceReference): p = p.getPath() if p == select: self.moveToIndex(i) i += 1
openpli-arm/enigma2-arm
lib/python/Components/FileList.py
Python
gpl-2.0
14,837
<?php /** * Form for translation managers to send a notification * to registered translators. * * @file * @author Amir E. Aharoni * @author Santhosh Thottingal * @author Niklas Laxström * @author Siebrand Mazeland * @copyright Copyright © 2012, Amir E. Aharoni, Santhosh Thottingal * @license GPL-2.0-or-later */ use MediaWiki\MediaWikiServices; /** * Form for translation managers to send a notification * to registered translators. * * @ingroup SpecialPage TranslateSpecialPage */ class SpecialNotifyTranslators extends FormSpecialPage { public static $right = 'translate-manage'; private $notificationText = ''; /** * @var Title */ private $translatablePageTitle; private $deadlineDate = ''; private $priority = ''; private $sourceLanguageCode = ''; public function __construct() { parent::__construct( 'NotifyTranslators', self::$right ); } public function doesWrites() { return true; } protected function getGroupName() { return 'translation'; } protected function getMessagePrefix() { return 'translationnotifications'; } protected function alterForm( HTMLForm $form ) { $form->setId( 'notifytranslators-form' ); $form->setSubmitID( 'translationnotifications-send-notification-button' ); $form->setSubmitTextMsg( 'translationnotifications-send-notification-button' ); $form->setWrapperLegend( false ); } /** * Get the form fields for use by the HTMLForm. * We also set up the JavaScript needed on the form here. * * @return array * @throws ErrorPageError if there is no translatable page on this wiki */ protected function getFormFields() { $this->getOutput()->addModules( 'ext.translationnotifications.notifytranslators' ); $formFields = []; $pages = $this->getTranslatablePages(); if ( count( $pages ) === 0 ) { throw new ErrorPageError( 'notifytranslators', 'translationnotifications-error-no-translatable-pages' ); } $formFields['TranslatablePage'] = [ 'name' => 'tpage', 'type' => 'select', 'label-message' => [ 'translationnotifications-translatablepage-title' ], 'options' => $pages, ]; $contLang = MediaWikiServices::getInstance()->getContentLanguage(); // Dummy dropdown, will be invisible. Used as data source for language name autocompletion. // @todo Implement a proper field with everything needed for this and make this less hackish $languageSelector = Xml::languageSelector( $contLang->getCode(), false, $this->getLanguage()->getCode(), [ 'style' => 'display: none;' ] ); $formFields['LanguagesList'] = [ 'type' => 'info', 'raw' => true, 'default' => $languageSelector[1], ]; // Languages to notify input box $formFields['LanguagesToNotify'] = [ 'type' => 'text', 'rows' => 20, 'cols' => 80, 'label-message' => 'translationnotifications-languages-to-notify-label', 'help-message' => 'translationnotifications-languages-to-notify-label-help-message', ]; // Priority dropdown $priorityOptions = []; $priorities = [ 'unset', 'high', 'medium', 'low' ]; foreach ( $priorities as $priority ) { $priorityMessage = NotificationMessageBuilder::getPriorityMessage( $priority ) ->setContext( $this->getContext() )->text(); $priorityOptions[$priorityMessage] = $priority; } $formFields['Priority'] = [ 'type' => 'select', 'label-message' => [ 'translationnotifications-priority' ], 'options' => $priorityOptions, 'default' => 'unset', ]; // Deadline date input box with datepicker $formFields['DeadlineDate'] = [ 'type' => 'text', 'size' => 20, 'label-message' => 'translationnotifications-deadline-label', ]; // Custom text $formFields['NotificationText'] = [ 'type' => 'textarea', 'rows' => 20, 'cols' => 80, 'label-message' => 'emailmessage', ]; return $formFields; } /** * @return array */ protected function getTranslatablePages() { $translatablePages = MessageGroups::getGroupsByType( 'WikiPageMessageGroup' ); usort( $translatablePages, [ 'MessageGroups', 'groupLabelSort' ] ); $titles = []; // Retrieving article id requires doing DB queries. // Make it more efficient by batching into one query. $lb = new LinkBatch(); /** * @var WikiPageMessageGroup $page */ foreach ( $translatablePages as $page ) { if ( MessageGroups::getPriority( $page ) === 'discouraged' ) { continue; } '@phan-var WikiPageMessageGroup $page'; $title = $page->getTitle(); $lb->addObj( $title ); $titles[] = $title; } $lb->execute(); $translatablePagesOptions = []; foreach ( $titles as $title ) { $translatablePagesOptions[$title->getPrefixedText()] = $title->getArticleID(); } return $translatablePagesOptions; } private function getSourceLanguage() { if ( $this->sourceLanguageCode === '' ) { $translatablePage = TranslatablePage::newFromTitle( $this->translatablePageTitle ); $this->sourceLanguageCode = $translatablePage->getMessageGroup()->getSourceLanguage(); } return $this->sourceLanguageCode; } /** * Callback for the submit button. * * @param array $formData * @return Status|bool * @todo Document */ public function onSubmit( array $formData ) { $this->translatablePageTitle = Title::newFromID( $formData['TranslatablePage'] ); $this->notificationText = $formData['NotificationText']; $this->priority = $formData['Priority']; $this->deadlineDate = $formData['DeadlineDate']; $languagesToNotify = explode( ',', $formData['LanguagesToNotify'] ); $languagesToNotify = array_filter( array_map( 'trim', $languagesToNotify ) ); $pageSourceLangCode = $this->getSourceLanguage(); $notificationLanguages = []; // The default is not to specify any languages and to send the notification to speakers of // all the languages except the source language. When no languages are specified, // an empty string will be sent here and an appropriate message will be shown in the log. if ( count( $languagesToNotify ) ) { // Filter out the source language foreach ( $languagesToNotify as $langCode ) { if ( $langCode !== $pageSourceLangCode ) { $notificationLanguages[] = $langCode; } } if ( $notificationLanguages === [] ) { return Status::newFatal( 'translationnotifications-sourcelang-only' ); } } $requestData = [ 'notificationText' => $this->notificationText, 'priority' => $this->priority, 'languagesToNotify' => $notificationLanguages, 'deadlineDate' => $this->deadlineDate ]; $job = TranslationNotificationsSubmitJob::newJob( $this->translatablePageTitle, $requestData, $this->getUser()->getId(), $this->getLanguage()->getCode() ); MediaWikiServices::getInstance()->getJobQueueGroup()->push( $job ); return true; } public function onSuccess() { $this->getOutput()->addWikiMsg( 'translationnotifications-submit-ok' ); } }
wikimedia/mediawiki-extensions-TranslationNotifications
includes/SpecialNotifyTranslators.php
PHP
gpl-2.0
6,870
<?php /** * Created by JetBrains PhpStorm. * User: gikach * Date: 4/4/13 * Time: 2:41 PM * To change this template use File | Settings | File Templates. */ class QS_Smallinvoice_Model_Receipts_Observer extends Mage_Core_Model_Abstract { protected $_catalogConfig; public function __construct() { parent::__construct(); $this->_catalogConfig = Mage::helper('qs_smallinvoice')->getConfigList(); } protected function _getDataReceipts($invoice) { $customer = Mage::getModel('customer/customer')->reset()->load($invoice->getCustomerId()); $smallInvoiceCustomerId = $customer->getSmallinvoiceCustomerid(); $smallInvoiceMainaddrId = $customer->getSmallinvoiceMainaddrid(); $items = $invoice->getAllItems(); $positions[] = array(); $i=0; foreach ($items as $item) { if($item->getData('parent_item_id')) { //NOTHING TO DO }else{ $positions[$i]['type'] = $this->_catalogConfig['producttype']; $positions[$i]['name'] = $item->getData('name'); $positions[$i]['description'] = $item->getData('description'); $positions[$i]['cost'] = $item->getData('price'); $positions[$i]['unit'] = $this->_catalogConfig['productunit'];// 1 - Hour from configuration, 7-Piece $positions[$i]['amount'] = $item->getData('qty_ordered'); $positions[$i]['vat'] = 0; $positions[$i]['discount'] = ''; $i++; } } $shipping = array( 'type'=>1, 'name'=>'Shipping & Handling', 'description'=>'', 'cost'=>$invoice->getData('shipping_amount'), 'unit'=>$this->_catalogConfig['productunit'], 'amount'=>1, 'vat'=>0, 'discount'=>'' ); $positions[] = $shipping; $tax = array( 'type'=>1, 'name'=>'Tax', 'description'=>'', 'cost'=>$invoice->getData('tax_amount'), 'unit'=>$this->_catalogConfig['productunit'], 'amount'=>1, 'vat'=>0, 'discount'=>'' ); $positions[] = $tax; if(abs($invoice->getData('discount_amount'))>0) { $discount = array( 'type'=>1, 'name'=>'Discount', 'description'=>$invoice->getData('discount_description'), 'cost'=>(0-$invoice->getData('discount_amount')),//must be negative 'unit'=>$this->_catalogConfig['productunit'], 'amount'=>1, 'vat'=>0, 'discount'=>'' ); $positions[] = $discount; } $storeId = $invoice->getStoreId(); $localeCode = Mage::getStoreConfig('general/locale/code', $storeId); $lang = explode('_',$localeCode); $dataReceipts = array( "client_id" => $smallInvoiceCustomerId, "client_address_id" => $smallInvoiceMainaddrId, "currency" => $invoice->getData('order_currency_code'), "title" => $this->_catalogConfig['titlereceipt'], "date" => date('Y-m-d'), "introduction"=>"", "conditions"=>"", "language"=>$lang[0], "vat_included"=>0,//tax_amount "positions"=> $positions ); return $dataReceipts; } public function invoiceSaveAfter(Varien_Event_Observer $observer) { $invoice = $observer->getEvent()->getInvoice(); $dataReceipts = json_encode($this->_getDataReceipts($invoice)); $customerid = $invoice->getCustomerId(); Mage::helper('qs_smallinvoice')->getClient('receipt','add', null, $dataReceipts, null, null, $customerid); } }
miegli/QS_Smallinvoice
app/code/local/QS/Smallinvoice/Model/Receipts/Observer.php
PHP
gpl-2.0
4,217
<?php // $Id$ /** * settingstree.php - Tells the admin menu that there are sub menu pages to * include for this activity. * * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ require_once($CFG->dirroot . '/mod/quiz/lib.php'); require_once($CFG->dirroot . '/mod/quiz/settingslib.php'); // First get a list of quiz reports with there own settings pages. If there none, // we use a simpler overall menu structure. $reportsbyname = array(); if ($reports = get_list_of_plugins('mod/quiz/report')) { foreach ($reports as $report) { if (file_exists($CFG->dirroot . "/mod/quiz/report/$report/settings.php")) { $strreportname = get_string($report . 'report', 'quiz_'.$report); // Deal with reports which are lacking the language string if ($strreportname[0] == '[') { $textlib = textlib_get_instance(); $strreportname = $textlib->strtotitle($report . ' report'); } $reportsbyname[$strreportname] = $report; } } ksort($reportsbyname); } // Create the quiz settings page. if (empty($reportsbyname)) { $pagetitle = get_string('modulename', 'quiz'); } else { $pagetitle = get_string('generalsettings', 'admin'); } $quizsettings = new admin_settingpage('modsettingquiz', $pagetitle, 'moodle/site:config'); // Introductory explanation that all the settings are defaults for the add quiz form. $quizsettings->add(new admin_setting_heading('quizintro', '', get_string('configintro', 'quiz'))); // Time limit $quizsettings->add(new admin_setting_text_with_advanced('quiz/timelimit', get_string('timelimitsec', 'quiz'), get_string('configtimelimitsec', 'quiz'), array('value' => '0', 'fix' => false), PARAM_INT)); // Number of attempts $options = array(get_string('unlimited')); for ($i = 1; $i <= QUIZ_MAX_ATTEMPT_OPTION; $i++) { $options[$i] = $i; } $quizsettings->add(new admin_setting_combo_with_advanced('quiz/attempts', get_string('attemptsallowed', 'quiz'), get_string('configattemptsallowed', 'quiz'), array('value' => 0, 'fix' => false), $options)); // Grading method. $quizsettings->add(new admin_setting_combo_with_advanced('quiz/grademethod', get_string('grademethod', 'quiz'), get_string('configgrademethod', 'quiz'), array('value' => QUIZ_GRADEHIGHEST, 'fix' => false), quiz_get_grading_options())); // Maximum grade $quizsettings->add(new admin_setting_configtext('quiz/maximumgrade', get_string('maximumgrade'), get_string('configmaximumgrade', 'quiz'), 10, PARAM_INT)); // Shuffle questions $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/shufflequestions', get_string('shufflequestions', 'quiz'), get_string('configshufflequestions', 'quiz'), array('value' => 0, 'fix' => false))); // Questions per page $perpage = array(); $perpage[0] = get_string('never'); $perpage[1] = get_string('aftereachquestion', 'quiz'); for ($i = 2; $i <= QUIZ_MAX_QPP_OPTION; ++$i) { $perpage[$i] = get_string('afternquestions', 'quiz', $i); } $quizsettings->add(new admin_setting_combo_with_advanced('quiz/questionsperpage', get_string('newpageevery', 'quiz'), get_string('confignewpageevery', 'quiz'), array('value' => 1, 'fix' => false), $perpage)); // Shuffle within questions $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/shuffleanswers', get_string('shufflewithin', 'quiz'), get_string('configshufflewithin', 'quiz'), array('value' => 1, 'fix' => false))); // Adaptive mode. $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/optionflags', get_string('adaptive', 'quiz'), get_string('configadaptive', 'quiz'), array('value' => 1, 'fix' => false))); // Apply penalties. $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/penaltyscheme', get_string('penaltyscheme', 'quiz'), get_string('configpenaltyscheme', 'quiz'), array('value' => 1, 'fix' => true))); // Each attempt builds on last. $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/attemptonlast', get_string('eachattemptbuildsonthelast', 'quiz'), get_string('configeachattemptbuildsonthelast', 'quiz'), array('value' => 0, 'fix' => true))); // Review options. $quizsettings->add(new admin_setting_quiz_reviewoptions('quiz/review', get_string('reviewoptions', 'quiz'), get_string('configreviewoptions', 'quiz'), array('value' => QUIZ_REVIEW_IMMEDIATELY | QUIZ_REVIEW_OPEN | QUIZ_REVIEW_CLOSED, 'fix' => false))); // Show the user's picture $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/showuserpicture', get_string('showuserpicture', 'quiz'), get_string('configshowuserpicture', 'quiz'), array('value' => 0, 'fix' => false))); // Decimal places for overall grades. $options = array(); for ($i = 0; $i <= QUIZ_MAX_DECIMAL_OPTION; $i++) { $options[$i] = $i; } $quizsettings->add(new admin_setting_combo_with_advanced('quiz/decimalpoints', get_string('decimalplaces', 'quiz'), get_string('configdecimalplaces', 'quiz'), array('value' => 2, 'fix' => false), $options)); // Decimal places for question grades. $options = array(-1 => get_string('sameasoverall', 'quiz')); for ($i = 0; $i <= QUIZ_MAX_Q_DECIMAL_OPTION; $i++) { $options[$i] = $i; } $quizsettings->add(new admin_setting_combo_with_advanced('quiz/questiondecimalpoints', get_string('decimalplacesquestion', 'quiz'), get_string('configdecimalplacesquestion', 'quiz'), array('value' => -1, 'fix' => true), $options)); // Password. $quizsettings->add(new admin_setting_text_with_advanced('quiz/password', get_string('requirepassword', 'quiz'), get_string('configrequirepassword', 'quiz'), array('value' => '', 'fix' => true), PARAM_TEXT)); // IP restrictions. $quizsettings->add(new admin_setting_text_with_advanced('quiz/subnet', get_string('requiresubnet', 'quiz'), get_string('configrequiresubnet', 'quiz'), array('value' => '', 'fix' => true), PARAM_TEXT)); // Enforced delay between attempts. $quizsettings->add(new admin_setting_text_with_advanced('quiz/delay1', get_string('delay1st2nd', 'quiz'), get_string('configdelay1st2nd', 'quiz'), array('value' => 0, 'fix' => true), PARAM_INTEGER)); $quizsettings->add(new admin_setting_text_with_advanced('quiz/delay2', get_string('delaylater', 'quiz'), get_string('configdelaylater', 'quiz'), array('value' => 0, 'fix' => true), PARAM_INTEGER)); // 'Secure' window. $quizsettings->add(new admin_setting_yesno_with_advanced('quiz/popup', get_string('showinsecurepopup', 'quiz'), get_string('configpopup', 'quiz'), array('value' => 0, 'fix' => true))); /// Now, depending on whether any reports have their own settings page, add /// the quiz setting page to the appropriate place in the tree. if (empty($reportsbyname)) { $ADMIN->add('modsettings', $quizsettings); } else { $ADMIN->add('modsettings', new admin_category('modsettingsquizcat', get_string('modulename', 'quiz'), !$module->visible)); $ADMIN->add('modsettingsquizcat', $quizsettings); /// Add the report pages for the settings.php files in sub directories of mod/quiz/report foreach ($reportsbyname as $strreportname => $report) { $reportname = $report; $settings = new admin_settingpage('modsettingsquizcat'.$reportname, $strreportname, 'moodle/site:config', !$module->visible); if ($ADMIN->fulltree) { include($CFG->dirroot."/mod/quiz/report/$reportname/settings.php"); } $ADMIN->add('modsettingsquizcat', $settings); } }
cwaclawik/moodle
mod/quiz/settingstree.php
PHP
gpl-2.0
7,689
/** * \file * <!-- * This file is part of BeRTOS. * * Bertos is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * As a special exception, you may use this file as part of a free software * library without restriction. Specifically, if other files instantiate * templates or use macros or inline functions from this file, or you compile * this file and link it with other files to produce an executable, this * file does not by itself cause the resulting executable to be covered by * the GNU General Public License. This exception does not however * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * * Copyright 2008 Develer S.r.l. (http://www.develer.com/) * * --> * * \brief Macro for SIPO_H * * * \version $Id: sipo.h 1398 2008-05-27 16:36:05Z asterix $ * * \author Andrea Grandi <andrea@develer.com> */ #ifndef SIPO_H #define SIPO_H #include "hw/hw_sipo.h" #include <avr/io.h> void sipo_init(void); void sipo_putchar(uint8_t c); #endif // SIPO_H
batt/sem
bertos/cpu/avr/drv/sipo.h
C
gpl-2.0
1,692
var isc_nb = 0; jQuery(function(){ /** * Hide/Show image list when post/page is loaded */ jQuery('.isc_image_list_title').click(function(){ isc_list = jQuery('.isc_image_list'); if ( isc_list.hasClass('isc-list-up') ) { jQuery('.isc_image_list_title').attr('title', (isc_jstext['hide_list'])); isc_list.toggleClass('isc-list-up isc-list-down'); isc_list.css({ visibility: 'hidden', height: '100%', }); max = isc_list.height(); isc_list.css({ height: '0px', visibility: 'visible' }).animate( {height: max + 'px'}, 1500 ); } else { jQuery('.isc_image_list_title').attr('title', (isc_jstext['show_list'])); isc_list.toggleClass('isc-list-up isc-list-down'); isc_list.animate( {height: 0}, 1500 ); } }); /** * Move caption into image */ jQuery('.isc-source').each(function(){ var main_id = jQuery(this).attr('id'); var att_number = main_id.split('_')[2]; var caption = jQuery(this).children().filter('.isc-source-text').html(); jQuery(this).find('.isc-source-text').remove(); jQuery(this).append(jQuery('<span />').addClass('isc-source-text').html(caption).css({ position: 'absolute', fontSize: '0.9em', backgroundColor: "#333", color: "#fff", opacity: "0.70", padding: '0 0.15em', textShadow: 'none', })); // Some themes handle the bottom padding of the attachment's div with the caption text (which is in between // the image and the bottom border) not with the div itself. The following line set the padding on the bottom equal to the top. jQuery(this).css('padding-bottom', jQuery(this).css('padding-top')); isc_update_captions_positions(); }); jQuery(window).resize(function(){ isc_update_captions_positions(); }); jQuery('.isc-source img').load(function(){ isc_update_captions_positions(); }); }); function isc_update_captions_positions() { jQuery('.isc-source').each(function(){ isc_update_caption_position(jQuery(this)); }); } function isc_update_caption_position(jQ_Obj) { var main_id = jQ_Obj.attr('id'); var att_number = main_id.split('_')[2]; var att = jQ_Obj.find('.wp-image-' + att_number); var attw = att.width(); var atth = att.height(); //relative position var l = att.position().left; //relative position var t = att.position().top; var caption = jQ_Obj.find('.isc-source-text'); //caption width + padding & margin (after moving onto image) var tw = caption.outerWidth(true); //caption height + padding (idem) var th = caption.outerHeight(true); var attpl = parseInt(att.css('padding-left').substring(0, att.css('padding-left').indexOf('px'))); var attml = parseInt(att.css('margin-left').substring(0, att.css('margin-left').indexOf('px'))); var attpt = parseInt(att.css('padding-top').substring(0, att.css('padding-top').indexOf('px'))); var attmt = parseInt(att.css('margin-top').substring(0, att.css('margin-top').indexOf('px'))); //caption horizontal margin var tml = 5; //caption vertical margin var tmt = 5; var pos = isc_front_data.caption_position; var posl = 0; var post = 0; switch (pos) { case 'top-left': posl = l + attpl + attml + tml; post = t + attpt + attmt + tmt; break; case 'top-center': posl = l + (Math.round(attw/2) - (Math.round(tw/2))) + attpl + attml; post = t + attpt + attmt + tmt; break; case 'top-right': posl = l - attpl + attml - tml + attw - tw; post = t + attpt + attmt + tmt; break; case 'center': posl = l + (Math.round(attw/2) - (Math.round(tw/2))) + attpl + attml; post = t + (Math.round(atth/2) - (Math.round(th/2))) + attpt + attmt; break; case 'bottom-left': posl = l + attpl + attml + tml; post = t - attpt + attmt - tmt - th + atth; break; case 'bottom-center': posl = l + (Math.round(attw/2) - (Math.round(tw/2))) + attpl + attml; post = t + attpt + attmt - tmt - th + atth; break; case 'bottom-right': posl = l - attpl + attml - tml + attw - tw; post = t + attpt + attmt - tmt - th + atth; break; } caption.css({ left: posl + 'px', top: post + 'px', zIndex: 9999, }); }
JornalExtraClasse/wordpress
wp-content/plugins/image-source-control-isc/js/front-js.js
JavaScript
gpl-2.0
4,876
/* Copyright_License { XCSoar Glide Computer - http://www.xcsoar.org/ Copyright (C) 2000-2021 The XCSoar Project A detailed list of copyright holders can be found in the file "AUTHORS". This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } */ #ifndef XCSOAR_DEVICE_ENUMERATOR_HPP #define XCSOAR_DEVICE_ENUMERATOR_HPP #include <dirent.h> /** * A class that can enumerate TTY devices on Linux and other POSIX * systems, by reading directory entries in /dev/. */ class TTYEnumerator { DIR *dir; char path[64]; public: #ifdef __linux__ /* on Linux, enumerate /sys/class/tty/ which is faster than /dev/ (searches only the TTY character devices) and shows only the ports that really exist */ /* but use /dev because there is no noticable downside, and it * allows for custom port mapping using udev file */ TTYEnumerator() :dir(opendir("/dev")) {} #else TTYEnumerator() :dir(opendir("/dev")) {} #endif ~TTYEnumerator() { if (dir != nullptr) closedir(dir); } /** * Has the constructor failed? */ bool HasFailed() const { return dir == nullptr; } /** * Find the next device (or the first one, if this method hasn't * been called so far). * * @return the absolute path of the device, or nullptr if there are * no more devices */ const char *Next(); }; #endif
sandrinr/XCSoar
src/Device/Port/TTYEnumerator.hpp
C++
gpl-2.0
2,005
/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, 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 GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #include "SDL_config.h" #ifndef _SDL_dibvideo_h #define _SDL_dibvideo_h #define WIN32_LEAN_AND_MEAN #include <windows.h> /* for PDA */ typedef enum { SDL_ORIENTATION_UP, SDL_ORIENTATION_DOWN, SDL_ORIENTATION_LEFT, SDL_ORIENTATION_RIGHT } SDL_ScreenOrientation; /* Private display data */ struct SDL_PrivateVideoData { HBITMAP screen_bmp; HPALETTE screen_pal; LOGPALETTE *screen_logpal; BOOL grab_palette; #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ int SDL_nummodes[NUM_MODELISTS]; SDL_Rect **SDL_modelist[NUM_MODELISTS]; SDL_ScreenOrientation orientation; #ifdef _WIN32_WCE int invert; /* do to remove, used by GAPI driver! */ char hiresFix; /* using hires mode without defining hires resource */ int supportRotation; /* for Pocket PC devices */ DWORD origRotation; /* for Pocket PC devices */ #endif /* Screensaver settings */ int allow_screensaver; }; /* Old variable names */ #define screen_bmp (this->hidden->screen_bmp) #define screen_pal (this->hidden->screen_pal) #define screen_logpal (this->hidden->screen_logpal) #define grab_palette (this->hidden->grab_palette) #define SDL_nummodes (this->hidden->SDL_nummodes) #define SDL_modelist (this->hidden->SDL_modelist) #define allow_screensaver (this->hidden->allow_screensaver) #endif /* _SDL_dibvideo_h */
tommythorn/yari
shared/SDL-1.2/src/video/windib/SDL_dibvideo.h
C
gpl-2.0
2,206
textarea { min-width:100%; min-height:100px; background:#fff; }
achyutdahal/1234
wp-content/plugins/wp-spry-menu/SpryAssets/admin-style.css
CSS
gpl-2.0
66
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0"> <context> <name>AboutDialog</name> <message> <source>About LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>Version %1 (%2/%3, Qt %4, %5)</source> <translation type="unfinished"></translation> </message> <message> <source>About</source> <translation type="unfinished">درباره</translation> </message> <message> <source>LMMS - easy music production for everyone</source> <translation type="unfinished"></translation> </message> <message> <source>Authors</source> <translation type="unfinished"></translation> </message> <message> <source>Translation</source> <translation type="unfinished"></translation> </message> <message> <source>Current language not translated (or native English). If you&apos;re interested in translating LMMS in another language or want to improve existing translations, you&apos;re welcome to help us! Simply contact the maintainer!</source> <translation type="unfinished"></translation> </message> <message> <source>License</source> <translation type="unfinished"></translation> </message> <message> <source>Copyright (c) 2004-2014, LMMS developers</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://lmms.io&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://lmms.io&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>Involved</source> <translation type="unfinished"></translation> </message> <message> <source>Contributors ordered by number of commits:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AmplifierControlDialog</name> <message> <source>VOL</source> <translation type="unfinished"></translation> </message> <message> <source>Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>PAN</source> <translation type="unfinished"></translation> </message> <message> <source>Panning:</source> <translation type="unfinished"></translation> </message> <message> <source>LEFT</source> <translation type="unfinished"></translation> </message> <message> <source>Left gain:</source> <translation type="unfinished"></translation> </message> <message> <source>RIGHT</source> <translation type="unfinished"></translation> </message> <message> <source>Right gain:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AmplifierControls</name> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Left gain</source> <translation type="unfinished"></translation> </message> <message> <source>Right gain</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioAlsa::setupWidget</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> <message> <source>CHANNELS</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioFileProcessorView</name> <message> <source>Open other sample</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to open another audio-file. A dialog will appear where you can select your file. Settings like looping-mode, start and end-points, amplify-value, and so on are not reset. So, it may not sound like the original sample.</source> <translation type="unfinished"></translation> </message> <message> <source>Reverse sample</source> <translation type="unfinished"></translation> </message> <message> <source>If you enable this button, the whole sample is reversed. This is useful for cool effects, e.g. a reversed crash.</source> <translation type="unfinished">اگر این دکمه را فعال کنید,تمام نمونه معکوس می شود.این برای جلوه های جالب مانند یک تصادف معکوس مناسب است.</translation> </message> <message> <source>Amplify:</source> <translation type="unfinished">تقویت:</translation> </message> <message> <source>With this knob you can set the amplify ratio. When you set a value of 100% your sample isn&apos;t changed. Otherwise it will be amplified up or down (your actual sample-file isn&apos;t touched!)</source> <translation type="unfinished"></translation> </message> <message> <source>Startpoint:</source> <translation type="unfinished">نقطه ی شروع:</translation> </message> <message> <source>Endpoint:</source> <translation type="unfinished">نقطه ی پایان:</translation> </message> <message> <source>Continue sample playback across notes</source> <translation type="unfinished"></translation> </message> <message> <source>Enabling this option makes the sample continue playing across different notes - if you change pitch, or the note length stops before the end of the sample, then the next note played will continue where it left off. To reset the playback to the start of the sample, insert a note at the bottom of the keyboard (&lt; 20 Hz)</source> <translation type="unfinished"></translation> </message> <message> <source>Disable loop</source> <translation type="unfinished"></translation> </message> <message> <source>This button disables looping. The sample plays only once from start to end. </source> <translation type="unfinished"></translation> </message> <message> <source>Enable loop</source> <translation type="unfinished"></translation> </message> <message> <source>This button enables forwards-looping. The sample loops between the end point and the loop point.</source> <translation type="unfinished"></translation> </message> <message> <source>This button enables ping-pong-looping. The sample loops backwards and forwards between the end point and the loop point.</source> <translation type="unfinished"></translation> </message> <message> <source>With this knob you can set the point where AudioFileProcessor should begin playing your sample. </source> <translation type="unfinished"></translation> </message> <message> <source>With this knob you can set the point where AudioFileProcessor should stop playing your sample. </source> <translation type="unfinished"></translation> </message> <message> <source>Loopback point:</source> <translation type="unfinished"></translation> </message> <message> <source>With this knob you can set the point where the loop starts. </source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioFileProcessorWaveView</name> <message> <source>Sample length:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioJack</name> <message> <source>JACK client restarted</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS was kicked by JACK for some reason. Therefore the JACK backend of LMMS has been restarted. You will have to make manual connections again.</source> <translation type="unfinished"></translation> </message> <message> <source>JACK server down</source> <translation type="unfinished"></translation> </message> <message> <source>The JACK server seems to have been shutdown and starting a new instance failed. Therefore LMMS is unable to proceed. You should save your project and restart JACK and LMMS.</source> <translation type="unfinished"></translation> </message> <message> <source>CLIENT-NAME</source> <translation type="unfinished"></translation> </message> <message> <source>CHANNELS</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioOss::setupWidget</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> <message> <source>CHANNELS</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioPortAudio::setupWidget</name> <message> <source>BACKEND</source> <translation type="unfinished"></translation> </message> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioPulseAudio::setupWidget</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> <message> <source>CHANNELS</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AudioSdl::setupWidget</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AutomatableModel</name> <message> <source>&amp;Reset (%1%2)</source> <translation type="unfinished">&amp;باز نشانی (%1%2)</translation> </message> <message> <source>&amp;Copy value (%1%2)</source> <translation type="unfinished">کپی &amp;مقدار (%1%2)</translation> </message> <message> <source>&amp;Paste value (%1%2)</source> <translation type="unfinished">چسباندن &amp;مقدار (%1%2)</translation> </message> <message> <source>Edit song-global automation</source> <translation type="unfinished"></translation> </message> <message> <source>Connected to %1</source> <translation type="unfinished"></translation> </message> <message> <source>Connected to controller</source> <translation type="unfinished"></translation> </message> <message> <source>Edit connection...</source> <translation type="unfinished"></translation> </message> <message> <source>Remove connection</source> <translation type="unfinished"></translation> </message> <message> <source>Connect to controller...</source> <translation type="unfinished"></translation> </message> <message> <source>Remove song-global automation</source> <translation type="unfinished"></translation> </message> <message> <source>Remove all linked controls</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AutomationEditor</name> <message> <source>Please open an automation pattern with the context menu of a control!</source> <translation type="unfinished"></translation> </message> <message> <source>Values copied</source> <translation type="unfinished"></translation> </message> <message> <source>All selected values were copied to the clipboard.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AutomationEditorWindow</name> <message> <source>Play/pause current pattern (Space)</source> <translation type="unfinished">پخش/مکث الگوی جاری (فاصله)</translation> </message> <message> <source>Click here if you want to play the current pattern. This is useful while editing it. The pattern is automatically looped when the end is reached.</source> <translation type="unfinished"></translation> </message> <message> <source>Stop playing of current pattern (Space)</source> <translation type="unfinished">توقف پخش الگوی جاری (فاصله)</translation> </message> <message> <source>Click here if you want to stop playing of the current pattern.</source> <translation type="unfinished"></translation> </message> <message> <source>Draw mode (Shift+D)</source> <translation type="unfinished"></translation> </message> <message> <source>Erase mode (Shift+E)</source> <translation type="unfinished"></translation> </message> <message> <source>Flip vertically</source> <translation type="unfinished"></translation> </message> <message> <source>Flip horizontally</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and the pattern will be inverted.The points are flipped in the y direction. </source> <translation type="unfinished"></translation> </message> <message> <source>Click here and the pattern will be reversed. The points are flipped in the x direction.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and draw-mode will be activated. In this mode you can add and move single values. This is the default mode which is used most of the time. You can also press &apos;Shift+D&apos; on your keyboard to activate this mode.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and erase-mode will be activated. In this mode you can erase single values. You can also press &apos;Shift+E&apos; on your keyboard to activate this mode.</source> <translation type="unfinished"></translation> </message> <message> <source>Discrete progression</source> <translation type="unfinished"></translation> </message> <message> <source>Linear progression</source> <translation type="unfinished"></translation> </message> <message> <source>Cubic Hermite progression</source> <translation type="unfinished"></translation> </message> <message> <source>Tension value for spline</source> <translation type="unfinished"></translation> </message> <message> <source>A higher tension value may make a smoother curve but overshoot some values. A low tension value will cause the slope of the curve to level off at each control point.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to choose discrete progressions for this automation pattern. The value of the connected object will remain constant between control points and be set immediately to the new value when each control point is reached.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to choose linear progressions for this automation pattern. The value of the connected object will change at a steady rate over time between control points to reach the correct value at each control point without a sudden change.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to choose cubic hermite progressions for this automation pattern. The value of the connected object will change in a smooth curve and ease in to the peaks and valleys.</source> <translation type="unfinished"></translation> </message> <message> <source>Cut selected values (Ctrl+X)</source> <translation type="unfinished"></translation> </message> <message> <source>Copy selected values (Ctrl+C)</source> <translation type="unfinished"></translation> </message> <message> <source>Paste values from clipboard Ctrl+V)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and selected values will be cut into the clipboard. You can paste them anywhere in any pattern by clicking on the paste button.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and selected values will be copied into the clipboard. You can paste them anywhere in any pattern by clicking on the paste button.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and the values from the clipboard will be pasted at the first visible measure.</source> <translation type="unfinished"></translation> </message> <message> <source>Tension: </source> <translation type="unfinished"></translation> </message> <message> <source>Automation Editor - no pattern</source> <translation type="unfinished"></translation> </message> <message> <source>Automation Editor - %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AutomationPattern</name> <message> <source>Drag a control while pressing &lt;Ctrl&gt;</source> <translation type="unfinished"></translation> </message> <message> <source>Model is already connected to this pattern.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AutomationPatternView</name> <message> <source>double-click to open this pattern in automation editor</source> <translation type="unfinished"></translation> </message> <message> <source>Open in Automation editor</source> <translation type="unfinished"></translation> </message> <message> <source>Clear</source> <translation type="unfinished"></translation> </message> <message> <source>Reset name</source> <translation type="unfinished">باز نشانی نام</translation> </message> <message> <source>Change name</source> <translation type="unfinished">تغییر نام</translation> </message> <message> <source>%1 Connections</source> <translation type="unfinished"></translation> </message> <message> <source>Disconnect &quot;%1&quot;</source> <translation type="unfinished"></translation> </message> <message> <source>Set/clear record</source> <translation type="unfinished"></translation> </message> <message> <source>Flip Vertically (Visible)</source> <translation type="unfinished"></translation> </message> <message> <source>Flip Horizontally (Visible)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AutomationTrack</name> <message> <source>Automation track</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BBEditor</name> <message> <source>Beat+Bassline Editor</source> <translation type="unfinished">ویرایشگر خط-بم/تپش</translation> </message> <message> <source>Play/pause current beat/bassline (Space)</source> <translation type="unfinished">پخش/درنگ خط-بم/تپش جاری(فاصله)</translation> </message> <message> <source>Stop playback of current beat/bassline (Space)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to play the current beat/bassline. The beat/bassline is automatically looped when its end is reached.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to stop playing of current beat/bassline.</source> <translation type="unfinished"></translation> </message> <message> <source>Add beat/bassline</source> <translation type="unfinished">اضافه ی خط بم/تپش (beat/baseline)</translation> </message> <message> <source>Add automation-track</source> <translation type="unfinished"></translation> </message> <message> <source>Remove steps</source> <translation type="unfinished"></translation> </message> <message> <source>Add steps</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BBTCOView</name> <message> <source>Open in Beat+Bassline-Editor</source> <translation type="unfinished">در ویرایشگر خط-بم/تپش باز کن</translation> </message> <message> <source>Reset name</source> <translation type="unfinished">باز نشانی نام</translation> </message> <message> <source>Change name</source> <translation type="unfinished">تغییر نام</translation> </message> <message> <source>Change color</source> <translation type="unfinished">تغییر رنگ</translation> </message> <message> <source>Reset color to default</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BBTrack</name> <message> <source>Beat/Bassline %1</source> <translation type="unfinished">خط-بم/تپش %1</translation> </message> <message> <source>Clone of %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BassBoosterControlDialog</name> <message> <source>FREQ</source> <translation type="unfinished"></translation> </message> <message> <source>Frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>GAIN</source> <translation type="unfinished"></translation> </message> <message> <source>Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>RATIO</source> <translation type="unfinished"></translation> </message> <message> <source>Ratio:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BassBoosterControls</name> <message> <source>Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Ratio</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BitcrushControlDialog</name> <message> <source>IN</source> <translation type="unfinished"></translation> </message> <message> <source>OUT</source> <translation type="unfinished"></translation> </message> <message> <source>GAIN</source> <translation type="unfinished"></translation> </message> <message> <source>Input Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>NOIS</source> <translation type="unfinished"></translation> </message> <message> <source>Input Noise:</source> <translation type="unfinished"></translation> </message> <message> <source>Output Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>CLIP</source> <translation type="unfinished"></translation> </message> <message> <source>Output Clip:</source> <translation type="unfinished"></translation> </message> <message> <source>Rate</source> <translation type="unfinished"></translation> </message> <message> <source>Rate Enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Enable samplerate-crushing</source> <translation type="unfinished"></translation> </message> <message> <source>Depth</source> <translation type="unfinished"></translation> </message> <message> <source>Depth Enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Enable bitdepth-crushing</source> <translation type="unfinished"></translation> </message> <message> <source>Sample rate:</source> <translation type="unfinished"></translation> </message> <message> <source>STD</source> <translation type="unfinished"></translation> </message> <message> <source>Stereo difference:</source> <translation type="unfinished"></translation> </message> <message> <source>Levels</source> <translation type="unfinished"></translation> </message> <message> <source>Levels:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>CaptionMenu</name> <message> <source>&amp;Help</source> <translation type="unfinished">&amp;راهنما</translation> </message> <message> <source>Help (not available)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>CarlaInstrumentView</name> <message> <source>Show GUI</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the graphical user interface (GUI) of Carla.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Controller</name> <message> <source>Controller %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ControllerConnectionDialog</name> <message> <source>Connection Settings</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI CONTROLLER</source> <translation type="unfinished"></translation> </message> <message> <source>Input channel</source> <translation type="unfinished"></translation> </message> <message> <source>CHANNEL</source> <translation type="unfinished"></translation> </message> <message> <source>Input controller</source> <translation type="unfinished"></translation> </message> <message> <source>CONTROLLER</source> <translation type="unfinished"></translation> </message> <message> <source>Auto Detect</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI-devices to receive MIDI-events from</source> <translation type="unfinished"></translation> </message> <message> <source>USER CONTROLLER</source> <translation type="unfinished"></translation> </message> <message> <source>MAPPING FUNCTION</source> <translation type="unfinished"></translation> </message> <message> <source>OK</source> <translation type="unfinished"></translation> </message> <message> <source>Cancel</source> <translation type="unfinished">لغو</translation> </message> <message> <source>LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>Cycle Detected.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ControllerRackView</name> <message> <source>Controller Rack</source> <translation type="unfinished"></translation> </message> <message> <source>Add</source> <translation type="unfinished"></translation> </message> <message> <source>Confirm Delete</source> <translation type="unfinished"></translation> </message> <message> <source>Confirm delete? There are existing connection(s) associted with this controller. There is no way to undo.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ControllerView</name> <message> <source>Controls</source> <translation type="unfinished"></translation> </message> <message> <source>Controllers are able to automate the value of a knob, slider, and other controls.</source> <translation type="unfinished"></translation> </message> <message> <source>Rename controller</source> <translation type="unfinished"></translation> </message> <message> <source>Enter the new name for this controller</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Remove this plugin</source> <translation type="unfinished"></translation> </message> </context> <context> <name>CrossoverEQControlDialog</name> <message> <source>Band 1/2 Crossover:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 2/3 Crossover:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 3/4 Crossover:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 1 Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 2 Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 3 Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 4 Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Band 1 Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Mute Band 1</source> <translation type="unfinished"></translation> </message> <message> <source>Band 2 Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Mute Band 2</source> <translation type="unfinished"></translation> </message> <message> <source>Band 3 Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Mute Band 3</source> <translation type="unfinished"></translation> </message> <message> <source>Band 4 Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Mute Band 4</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DelayControls</name> <message> <source>Delay Samples</source> <translation type="unfinished"></translation> </message> <message> <source>Feedback</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo Amount</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DelayControlsDialog</name> <message> <source>Delay</source> <translation type="unfinished"></translation> </message> <message> <source>Delay Time</source> <translation type="unfinished"></translation> </message> <message> <source>Regen</source> <translation type="unfinished"></translation> </message> <message> <source>Feedback Amount</source> <translation type="unfinished"></translation> </message> <message> <source>Rate</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo Amt</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DetuningHelper</name> <message> <source>Note detuning</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DualFilterControlDialog</name> <message> <source>Filter 1 enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Filter 2 enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Click to enable/disable Filter 1</source> <translation type="unfinished"></translation> </message> <message> <source>Click to enable/disable Filter 2</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DualFilterControls</name> <message> <source>Filter 1 enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Filter 1 type</source> <translation type="unfinished"></translation> </message> <message> <source>Cutoff 1 frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Q/Resonance 1</source> <translation type="unfinished"></translation> </message> <message> <source>Gain 1</source> <translation type="unfinished"></translation> </message> <message> <source>Mix</source> <translation type="unfinished"></translation> </message> <message> <source>Filter 2 enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Filter 2 type</source> <translation type="unfinished"></translation> </message> <message> <source>Cutoff 2 frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Q/Resonance 2</source> <translation type="unfinished"></translation> </message> <message> <source>Gain 2</source> <translation type="unfinished"></translation> </message> <message> <source>LowPass</source> <translation type="unfinished">پایین گذر</translation> </message> <message> <source>HiPass</source> <translation type="unfinished">بالا گذر</translation> </message> <message> <source>BandPass csg</source> <translation type="unfinished">میان گذر csg</translation> </message> <message> <source>BandPass czpg</source> <translation type="unfinished">میان گذر czpg</translation> </message> <message> <source>Notch</source> <translation type="unfinished">نچ</translation> </message> <message> <source>Allpass</source> <translation type="unfinished">تمام گذر</translation> </message> <message> <source>Moog</source> <translation type="unfinished">موگ Moog</translation> </message> <message> <source>2x LowPass</source> <translation type="unfinished">پایین گذر 2x</translation> </message> <message> <source>RC LowPass 12dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC BandPass 12dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC HighPass 12dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC LowPass 24dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC BandPass 24dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC HighPass 24dB</source> <translation type="unfinished"></translation> </message> <message> <source>Vocal Formant Filter</source> <translation type="unfinished"></translation> </message> <message> <source>2x Moog</source> <translation type="unfinished"></translation> </message> <message> <source>SV LowPass</source> <translation type="unfinished"></translation> </message> <message> <source>SV BandPass</source> <translation type="unfinished"></translation> </message> <message> <source>SV HighPass</source> <translation type="unfinished"></translation> </message> <message> <source>SV Notch</source> <translation type="unfinished"></translation> </message> <message> <source>Fast Formant</source> <translation type="unfinished"></translation> </message> <message> <source>Tripole</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DummyEffect</name> <message> <source>NOT FOUND</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Editor</name> <message> <source>Play (Space)</source> <translation type="unfinished"></translation> </message> <message> <source>Stop (Space)</source> <translation type="unfinished"></translation> </message> <message> <source>Record</source> <translation type="unfinished"></translation> </message> <message> <source>Record while playing</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Effect</name> <message> <source>Effect enabled</source> <translation type="unfinished"></translation> </message> <message> <source>Wet/Dry mix</source> <translation type="unfinished"></translation> </message> <message> <source>Gate</source> <translation type="unfinished">مدخل</translation> </message> <message> <source>Decay</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EffectChain</name> <message> <source>Effects enabled</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EffectRackView</name> <message> <source>EFFECTS CHAIN</source> <translation type="unfinished"></translation> </message> <message> <source>Add effect</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EffectSelectDialog</name> <message> <source>Add effect</source> <translation type="unfinished"></translation> </message> <message> <source>Plugin description</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EffectView</name> <message> <source>Toggles the effect on or off.</source> <translation type="unfinished"></translation> </message> <message> <source>On/Off</source> <translation type="unfinished"></translation> </message> <message> <source>W/D</source> <translation type="unfinished"></translation> </message> <message> <source>Wet Level:</source> <translation type="unfinished"></translation> </message> <message> <source>The Wet/Dry knob sets the ratio between the input signal and the effect signal that forms the output.</source> <translation type="unfinished"></translation> </message> <message> <source>DECAY</source> <translation type="unfinished">محو-DECAY</translation> </message> <message> <source>Time:</source> <translation type="unfinished"></translation> </message> <message> <source>The Decay knob controls how many buffers of silence must pass before the plugin stops processing. Smaller values will reduce the CPU overhead but run the risk of clipping the tail on delay and reverb effects.</source> <translation type="unfinished"></translation> </message> <message> <source>GATE</source> <translation type="unfinished"></translation> </message> <message> <source>Gate:</source> <translation type="unfinished"></translation> </message> <message> <source>The Gate knob controls the signal level that is considered to be &apos;silence&apos; while deciding when to stop processing signals.</source> <translation type="unfinished"></translation> </message> <message> <source>Controls</source> <translation type="unfinished"></translation> </message> <message> <source>Effect plugins function as a chained series of effects where the signal will be processed from top to bottom. The On/Off switch allows you to bypass a given plugin at any point in time. The Wet/Dry knob controls the balance between the input signal and the effected signal that is the resulting output from the effect. The input for the stage is the output from the previous stage. So, the &apos;dry&apos; signal for effects lower in the chain contains all of the previous effects. The Decay knob controls how long the signal will continue to be processed after the notes have been released. The effect will stop processing signals when the volume has dropped below a given threshold for a given length of time. This knob sets the &apos;given length of time&apos;. Longer times will require more CPU, so this number should be set low for most effects. It needs to be bumped up for effects that produce lengthy periods of silence, e.g. delays. The Gate knob controls the &apos;given threshold&apos; for the effect&apos;s auto shutdown. The clock for the &apos;given length of time&apos; will begin as soon as the processed signal level drops below the level specified with this knob. The Controls button opens a dialog for editing the effect&apos;s parameters. Right clicking will bring up a context menu where you can change the order in which the effects are processed or delete an effect altogether.</source> <translation type="unfinished"></translation> </message> <message> <source>Move &amp;up</source> <translation type="unfinished"></translation> </message> <message> <source>Move &amp;down</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Remove this plugin</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EnvelopeAndLfoParameters</name> <message> <source>Predelay</source> <translation type="unfinished"></translation> </message> <message> <source>Attack</source> <translation type="unfinished"></translation> </message> <message> <source>Hold</source> <translation type="unfinished"></translation> </message> <message> <source>Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Sustain</source> <translation type="unfinished"></translation> </message> <message> <source>Release</source> <translation type="unfinished"></translation> </message> <message> <source>Modulation</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Predelay</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Attack</source> <translation type="unfinished"></translation> </message> <message> <source>LFO speed</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Modulation</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Wave Shape</source> <translation type="unfinished"></translation> </message> <message> <source>Freq x 100</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate Env-Amount</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EnvelopeAndLfoView</name> <message> <source>DEL</source> <translation type="unfinished"></translation> </message> <message> <source>Predelay:</source> <translation type="unfinished">پبش تاخیر(Predelay):</translation> </message> <message> <source>Use this knob for setting predelay of the current envelope. The bigger this value the longer the time before start of actual envelope.</source> <translation type="unfinished">از این دستگیره برای تنظیم پیش تاخیر پاکت جاری استفاده کنید.هرچه این مقدار بیشتر باشد زمان بیشتری قبل از شروع واقعی پاکت طول می کشد.</translation> </message> <message> <source>ATT</source> <translation type="unfinished"></translation> </message> <message> <source>Attack:</source> <translation type="unfinished">تهاجم(Attack):</translation> </message> <message> <source>Use this knob for setting attack-time of the current envelope. The bigger this value the longer the envelope needs to increase to attack-level. Choose a small value for instruments like pianos and a big value for strings.</source> <translation type="unfinished">از این دستگیره برای تنظیم زمان تهاجم پاکت جاری استفاده کنید.هرچه این مقدار بیشتر باشد پاکت زمان بیشتزی برای افزایش تا سطح تهاجم نیاز دازد.مقدار کم را برای دستگاه هایی مانند پیانو و مقدار زیاد را برای زهی استفاده کنید.</translation> </message> <message> <source>HOLD</source> <translation type="unfinished">نگهداری-HOLD</translation> </message> <message> <source>Hold:</source> <translation type="unfinished">نگهداری(Hold):</translation> </message> <message> <source>Use this knob for setting hold-time of the current envelope. The bigger this value the longer the envelope holds attack-level before it begins to decrease to sustain-level.</source> <translation type="unfinished">از این دستگیره برای تنظیم زمان تامل پاکت جاری استفاده کنید.هرچه این مقدار بیشتر باشد بیشتر طول می کشد تا پاکت سطح تهاجم را قبل از کاهش یه سطح تقویت(sustain-level) نگهدارد.</translation> </message> <message> <source>DEC</source> <translation type="unfinished"></translation> </message> <message> <source>Decay:</source> <translation type="unfinished">محو شدن(Decay):</translation> </message> <message> <source>Use this knob for setting decay-time of the current envelope. The bigger this value the longer the envelope needs to decrease from attack-level to sustain-level. Choose a small value for instruments like pianos.</source> <translation type="unfinished">از این دستگیره برای تنظیم زمان محو شدن پاکت جاری استفاده کنید. هرچه این مقدار بیشتر باشد زمان بیشتری برای کاهش از سطح تهاجم به سطح تقویت طول کشد.مقدار کمی را برای دستگاه هایی مانند پیانو انتخاب کنید.</translation> </message> <message> <source>SUST</source> <translation type="unfinished"></translation> </message> <message> <source>Sustain:</source> <translation type="unfinished">تقویت(Sustain):</translation> </message> <message> <source>Use this knob for setting sustain-level of the current envelope. The bigger this value the higher the level on which the envelope stays before going down to zero.</source> <translation type="unfinished">از این دستگیره برای تنظیم سطح تقویت(Sustain Level) پاکت جاری استفاده کنید. هرچه این مقدار بیشتر باشد پاکت در سطح بالاتری قبل از نزول به صفر قرار می گیرد.</translation> </message> <message> <source>REL</source> <translation type="unfinished"></translation> </message> <message> <source>Release:</source> <translation type="unfinished">رهایی(Release):</translation> </message> <message> <source>Use this knob for setting release-time of the current envelope. The bigger this value the longer the envelope needs to decrease from sustain-level to zero. Choose a big value for soft instruments like strings.</source> <translation type="unfinished">از این دستگیره برای تنظیم زمان رهایی پاکت جاری استفاده کنید. هرچه این مقدار بیشتر باشد زمان بیشتری برای کاهش از سطح تقویت به صفر طول کشد.مقدار زیاد را برای دستگاه های زهی انتخاب کنید.</translation> </message> <message> <source>AMT</source> <translation type="unfinished"></translation> </message> <message> <source>Modulation amount:</source> <translation type="unfinished">میزان مدولاسیون:</translation> </message> <message> <source>Use this knob for setting modulation amount of the current envelope. The bigger this value the more the according size (e.g. volume or cutoff-frequency) will be influenced by this envelope.</source> <translation type="unfinished">از این دسته برای تنظیم مقدار مذولاسیون پاکت جاری استفاده کنید.هرچه این مقدار بیشتر باشد اندازه ی منتخب بیشتری(برای مثال حجم یا فرکانس گوشه ای) تحت تاثیر این پاکت قرار می گیرد.</translation> </message> <message> <source>LFO predelay:</source> <translation type="unfinished"></translation> </message> <message> <source>Use this knob for setting predelay-time of the current LFO. The bigger this value the the time until the LFO starts to oscillate.</source> <translation type="unfinished">ار این دستگیره برای تنظیم زمان پیش تاخیر LFO جاری استفاده کنید.هرچه این مقدار بیشتر باشد زمان بیشتزی تا شروع نوسان LFO طول می کشد.</translation> </message> <message> <source>LFO- attack:</source> <translation type="unfinished"></translation> </message> <message> <source>Use this knob for setting attack-time of the current LFO. The bigger this value the longer the LFO needs to increase its amplitude to maximum.</source> <translation type="unfinished">از این دستگیره برای تنظیم زمان تهاجم LFO جاری استفاده کنید.هرچه این مقدار بیشتر باشد LFO زمان بیشتزی برای افزایش دامنه به مقدار ماکزیمم نیاز دازد.</translation> </message> <message> <source>SPD</source> <translation type="unfinished"></translation> </message> <message> <source>LFO speed:</source> <translation type="unfinished"></translation> </message> <message> <source>Use this knob for setting speed of the current LFO. The bigger this value the faster the LFO oscillates and the faster will be your effect.</source> <translation type="unfinished">از این دستگیره برای تنظیم سرعت LFO استفاده کنید. هرچه این مقدار بیشتر باشد LFO سریع تر نوسان می کند و جلوه ی شما سریع تر خواهد بود.</translation> </message> <message> <source>Use this knob for setting modulation amount of the current LFO. The bigger this value the more the selected size (e.g. volume or cutoff-frequency) will be influenced by this LFO.</source> <translation type="unfinished">از این دسته برای تنظیم مقدار مذولاسیون LFO جاری استفاده کنید.هرچه این مقدار بیشتر باشد اندازه ی منتخب بیشتری(برای مثال حجم یا فرکانس گوشه ای) تحت تاثیر این LFO قرار می گیرد.</translation> </message> <message> <source>Click here for a sine-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a triangle-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a saw-wave for current.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a square-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a user-defined wave. Afterwards, drag an according sample-file onto the LFO graph.</source> <translation type="unfinished"></translation> </message> <message> <source>FREQ x 100</source> <translation type="unfinished"></translation> </message> <message> <source>Click here if the frequency of this LFO should be multiplied by 100.</source> <translation type="unfinished"></translation> </message> <message> <source>multiply LFO-frequency by 100</source> <translation type="unfinished"></translation> </message> <message> <source>MODULATE ENV-AMOUNT</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to make the envelope-amount controlled by this LFO.</source> <translation type="unfinished">برای اینکه میزان پاکت توسط این LFO کنترل شود اینجا را کلیک کنید.</translation> </message> <message> <source>control envelope-amount by this LFO</source> <translation type="unfinished">کنترل مقدار پاکت توسط این LFO</translation> </message> <message> <source>ms/LFO:</source> <translation type="unfinished">ms/LFO:</translation> </message> <message> <source>Hint</source> <translation type="unfinished"></translation> </message> <message> <source>Drag a sample from somewhere and drop it in this window.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for random wave.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EqControls</name> <message> <source>Input gain</source> <translation type="unfinished"></translation> </message> <message> <source>Output gain</source> <translation type="unfinished"></translation> </message> <message> <source>Low shelf gain</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 1 gain</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 2 gain</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 3 gain</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 4 gain</source> <translation type="unfinished"></translation> </message> <message> <source>High Shelf gain</source> <translation type="unfinished"></translation> </message> <message> <source>HP res</source> <translation type="unfinished"></translation> </message> <message> <source>Low Shelf res</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 1 BW</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 2 BW</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 3 BW</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 4 BW</source> <translation type="unfinished"></translation> </message> <message> <source>High Shelf res</source> <translation type="unfinished"></translation> </message> <message> <source>LP res</source> <translation type="unfinished"></translation> </message> <message> <source>HP freq</source> <translation type="unfinished"></translation> </message> <message> <source>Low Shelf freq</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 1 freq</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 2 freq</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 3 freq</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 4 freq</source> <translation type="unfinished"></translation> </message> <message> <source>High shelf freq</source> <translation type="unfinished"></translation> </message> <message> <source>LP freq</source> <translation type="unfinished"></translation> </message> <message> <source>HP active</source> <translation type="unfinished"></translation> </message> <message> <source>Low shelf active</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 1 active</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 2 active</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 3 active</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 4 active</source> <translation type="unfinished"></translation> </message> <message> <source>High shelf active</source> <translation type="unfinished"></translation> </message> <message> <source>LP active</source> <translation type="unfinished"></translation> </message> <message> <source>LP 12</source> <translation type="unfinished"></translation> </message> <message> <source>LP 24</source> <translation type="unfinished"></translation> </message> <message> <source>LP 48</source> <translation type="unfinished"></translation> </message> <message> <source>HP 12</source> <translation type="unfinished"></translation> </message> <message> <source>HP 24</source> <translation type="unfinished"></translation> </message> <message> <source>HP 48</source> <translation type="unfinished"></translation> </message> <message> <source>low pass type</source> <translation type="unfinished"></translation> </message> <message> <source>high pass type</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EqControlsDialog</name> <message> <source>HP</source> <translation type="unfinished"></translation> </message> <message> <source>Low Shelf</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 1</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 2</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 3</source> <translation type="unfinished"></translation> </message> <message> <source>Peak 4</source> <translation type="unfinished"></translation> </message> <message> <source>High Shelf</source> <translation type="unfinished"></translation> </message> <message> <source>LP</source> <translation type="unfinished"></translation> </message> <message> <source>In Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Out Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Bandwidth: </source> <translation type="unfinished"></translation> </message> <message> <source>Resonance : </source> <translation type="unfinished"></translation> </message> <message> <source>Frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>12dB</source> <translation type="unfinished"></translation> </message> <message> <source>24dB</source> <translation type="unfinished"></translation> </message> <message> <source>48dB</source> <translation type="unfinished"></translation> </message> <message> <source>lp grp</source> <translation type="unfinished"></translation> </message> <message> <source>hp grp</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EqParameterWidget</name> <message> <source>Hz </source> <translation type="unfinished"></translation> </message> </context> <context> <name>ExportProjectDialog</name> <message> <source>Export project</source> <translation type="unfinished"></translation> </message> <message> <source>Output</source> <translation type="unfinished"></translation> </message> <message> <source>File format:</source> <translation type="unfinished"></translation> </message> <message> <source>Samplerate:</source> <translation type="unfinished"></translation> </message> <message> <source>44100 Hz</source> <translation type="unfinished"></translation> </message> <message> <source>48000 Hz</source> <translation type="unfinished"></translation> </message> <message> <source>88200 Hz</source> <translation type="unfinished"></translation> </message> <message> <source>96000 Hz</source> <translation type="unfinished"></translation> </message> <message> <source>192000 Hz</source> <translation type="unfinished"></translation> </message> <message> <source>Bitrate:</source> <translation type="unfinished"></translation> </message> <message> <source>64 KBit/s</source> <translation type="unfinished"></translation> </message> <message> <source>128 KBit/s</source> <translation type="unfinished"></translation> </message> <message> <source>160 KBit/s</source> <translation type="unfinished"></translation> </message> <message> <source>192 KBit/s</source> <translation type="unfinished"></translation> </message> <message> <source>256 KBit/s</source> <translation type="unfinished"></translation> </message> <message> <source>320 KBit/s</source> <translation type="unfinished"></translation> </message> <message> <source>Depth:</source> <translation type="unfinished"></translation> </message> <message> <source>16 Bit Integer</source> <translation type="unfinished"></translation> </message> <message> <source>32 Bit Float</source> <translation type="unfinished"></translation> </message> <message> <source>Please note that not all of the parameters above apply for all file formats.</source> <translation type="unfinished"></translation> </message> <message> <source>Quality settings</source> <translation type="unfinished"></translation> </message> <message> <source>Interpolation:</source> <translation type="unfinished"></translation> </message> <message> <source>Zero Order Hold</source> <translation type="unfinished"></translation> </message> <message> <source>Sinc Fastest</source> <translation type="unfinished"></translation> </message> <message> <source>Sinc Medium (recommended)</source> <translation type="unfinished"></translation> </message> <message> <source>Sinc Best (very slow!)</source> <translation type="unfinished"></translation> </message> <message> <source>Oversampling (use with care!):</source> <translation type="unfinished"></translation> </message> <message> <source>1x (None)</source> <translation type="unfinished"></translation> </message> <message> <source>2x</source> <translation type="unfinished"></translation> </message> <message> <source>4x</source> <translation type="unfinished"></translation> </message> <message> <source>8x</source> <translation type="unfinished"></translation> </message> <message> <source>Start</source> <translation type="unfinished"></translation> </message> <message> <source>Cancel</source> <translation type="unfinished">لغو</translation> </message> <message> <source>Export as loop (remove end silence)</source> <translation type="unfinished"></translation> </message> <message> <source>Export between loop markers</source> <translation type="unfinished"></translation> </message> <message> <source>Could not open file</source> <translation type="unfinished">پرونده باز نشد</translation> </message> <message> <source>Could not open file %1 for writing. Please make sure you have write-permission to the file and the directory containing the file and try again!</source> <translation type="unfinished"></translation> </message> <message> <source>Export project to %1</source> <translation type="unfinished">استخراج پرونده به %1</translation> </message> <message> <source>Error</source> <translation type="unfinished"></translation> </message> <message> <source>Error while determining file-encoder device. Please try to choose a different output format.</source> <translation type="unfinished"></translation> </message> <message> <source>Rendering: %1%</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Fader</name> <message> <source>Please enter a new value between %1 and %2:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FileBrowser</name> <message> <source>Browser</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FileBrowserTreeWidget</name> <message> <source>Send to active instrument-track</source> <translation type="unfinished"></translation> </message> <message> <source>Open in new instrument-track/Song-Editor</source> <translation type="unfinished"></translation> </message> <message> <source>Open in new instrument-track/B+B Editor</source> <translation type="unfinished"></translation> </message> <message> <source>Loading sample</source> <translation type="unfinished"></translation> </message> <message> <source>Please wait, loading sample for preview...</source> <translation type="unfinished"></translation> </message> <message> <source>--- Factory files ---</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FlangerControls</name> <message> <source>Delay Samples</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Seconds</source> <translation type="unfinished"></translation> </message> <message> <source>Regen</source> <translation type="unfinished"></translation> </message> <message> <source>Noise</source> <translation type="unfinished"></translation> </message> <message> <source>Invert</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FlangerControlsDialog</name> <message> <source>Delay</source> <translation type="unfinished"></translation> </message> <message> <source>Delay Time:</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo Hz</source> <translation type="unfinished"></translation> </message> <message> <source>Lfo:</source> <translation type="unfinished"></translation> </message> <message> <source>Amt</source> <translation type="unfinished"></translation> </message> <message> <source>Amt:</source> <translation type="unfinished"></translation> </message> <message> <source>Regen</source> <translation type="unfinished"></translation> </message> <message> <source>Feedback Amount:</source> <translation type="unfinished"></translation> </message> <message> <source>Noise</source> <translation type="unfinished"></translation> </message> <message> <source>White Noise Amount:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FxLine</name> <message> <source>Channel send amount</source> <translation type="unfinished"></translation> </message> <message> <source>The FX channel receives input from one or more instrument tracks. It in turn can be routed to multiple other FX channels. LMMS automatically takes care of preventing infinite loops for you and doesn&apos;t allow making a connection that would result in an infinite loop. In order to route the channel to another channel, select the FX channel and click on the &quot;send&quot; button on the channel you want to send to. The knob under the send button controls the level of signal that is sent to the channel. You can remove and move FX channels in the context menu, which is accessed by right-clicking the FX channel. </source> <translation type="unfinished"></translation> </message> <message> <source>Move &amp;left</source> <translation type="unfinished"></translation> </message> <message> <source>Move &amp;right</source> <translation type="unfinished"></translation> </message> <message> <source>Rename &amp;channel</source> <translation type="unfinished"></translation> </message> <message> <source>R&amp;emove channel</source> <translation type="unfinished"></translation> </message> <message> <source>Remove &amp;unused channels</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FxMixer</name> <message> <source>Master</source> <translation type="unfinished"></translation> </message> <message> <source>FX %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FxMixerView</name> <message> <source>Rename FX channel</source> <translation type="unfinished"></translation> </message> <message> <source>Enter the new name for this FX channel</source> <translation type="unfinished"></translation> </message> <message> <source>FX-Mixer</source> <translation type="unfinished"></translation> </message> <message> <source>FX Fader %1</source> <translation type="unfinished"></translation> </message> <message> <source>Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Mute this FX channel</source> <translation type="unfinished"></translation> </message> <message> <source>Solo</source> <translation type="unfinished"></translation> </message> <message> <source>Solo FX channel</source> <translation type="unfinished"></translation> </message> </context> <context> <name>FxRoute</name> <message> <source>Amount to send from channel %1 to channel %2</source> <translation type="unfinished"></translation> </message> </context> <context> <name>GigInstrument</name> <message> <source>Bank</source> <translation type="unfinished"></translation> </message> <message> <source>Patch</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> </context> <context> <name>GigInstrumentView</name> <message> <source>Open other GIG file</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to open another GIG file</source> <translation type="unfinished"></translation> </message> <message> <source>Choose the patch</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to change which patch of the GIG file to use</source> <translation type="unfinished"></translation> </message> <message> <source>Change which instrument of the GIG file is being played</source> <translation type="unfinished"></translation> </message> <message> <source>Which GIG file is currently being used</source> <translation type="unfinished"></translation> </message> <message> <source>Which patch of the GIG file is currently being used</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Factor to multiply samples by</source> <translation type="unfinished"></translation> </message> <message> <source>Open GIG file</source> <translation type="unfinished"></translation> </message> <message> <source>GIG Files (*.gig)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentFunctionArpeggio</name> <message> <source>Arpeggio</source> <translation type="unfinished">آرپگیو(Arpeggio)</translation> </message> <message> <source>Arpeggio type</source> <translation type="unfinished"></translation> </message> <message> <source>Arpeggio range</source> <translation type="unfinished">محدوده ی آرپگیو</translation> </message> <message> <source>Arpeggio time</source> <translation type="unfinished">زمان أرپگیو</translation> </message> <message> <source>Arpeggio gate</source> <translation type="unfinished">مدخل أرپگیو</translation> </message> <message> <source>Arpeggio direction</source> <translation type="unfinished"></translation> </message> <message> <source>Arpeggio mode</source> <translation type="unfinished"></translation> </message> <message> <source>Up</source> <translation type="unfinished"></translation> </message> <message> <source>Down</source> <translation type="unfinished"></translation> </message> <message> <source>Up and down</source> <translation type="unfinished"></translation> </message> <message> <source>Random</source> <translation type="unfinished"></translation> </message> <message> <source>Free</source> <translation type="unfinished"></translation> </message> <message> <source>Sort</source> <translation type="unfinished"></translation> </message> <message> <source>Sync</source> <translation type="unfinished"></translation> </message> <message> <source>Down and up</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentFunctionArpeggioView</name> <message> <source>ARPEGGIO</source> <translation type="unfinished"></translation> </message> <message> <source>An arpeggio is a method playing (especially plucked) instruments, which makes the music much livelier. The strings of such instruments (e.g. harps) are plucked like chords. The only difference is that this is done in a sequential order, so the notes are not played at the same time. Typical arpeggios are major or minor triads, but there are a lot of other possible chords, you can select.</source> <translation type="unfinished"></translation> </message> <message> <source>RANGE</source> <translation type="unfinished"></translation> </message> <message> <source>Arpeggio range:</source> <translation type="unfinished">محدوده ی أرپگیو:</translation> </message> <message> <source>octave(s)</source> <translation type="unfinished">نت (ها)</translation> </message> <message> <source>Use this knob for setting the arpeggio range in octaves. The selected arpeggio will be played within specified number of octaves.</source> <translation type="unfinished"></translation> </message> <message> <source>TIME</source> <translation type="unfinished"></translation> </message> <message> <source>Arpeggio time:</source> <translation type="unfinished">زمان آرپگیو:</translation> </message> <message> <source>ms</source> <translation type="unfinished">م ث</translation> </message> <message> <source>Use this knob for setting the arpeggio time in milliseconds. The arpeggio time specifies how long each arpeggio-tone should be played.</source> <translation type="unfinished">از این دستگیره برای تنظیم زمان در آرپگیو به میلی ثانیه استفاده کنید.زمان آرپگیو مشخص می کند که چه مدت هر آهنگ آرپگیو پخش شود.</translation> </message> <message> <source>GATE</source> <translation type="unfinished"></translation> </message> <message> <source>Arpeggio gate:</source> <translation type="unfinished">مدخل آرپگیو:</translation> </message> <message> <source>%</source> <translation type="unfinished">%</translation> </message> <message> <source>Use this knob for setting the arpeggio gate. The arpeggio gate specifies the percent of a whole arpeggio-tone that should be played. With this you can make cool staccato arpeggios.</source> <translation type="unfinished"></translation> </message> <message> <source>Chord:</source> <translation type="unfinished"></translation> </message> <message> <source>Direction:</source> <translation type="unfinished">جهت:</translation> </message> <message> <source>Mode:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentFunctionNoteStacking</name> <message> <source>octave</source> <translation type="unfinished">نت</translation> </message> <message> <source>Major</source> <translation type="unfinished">Major</translation> </message> <message> <source>Majb5</source> <translation type="unfinished">Majb5</translation> </message> <message> <source>minor</source> <translation type="unfinished">minor</translation> </message> <message> <source>minb5</source> <translation type="unfinished">mollb5</translation> </message> <message> <source>sus2</source> <translation type="unfinished">sus2</translation> </message> <message> <source>sus4</source> <translation type="unfinished">sus4</translation> </message> <message> <source>aug</source> <translation type="unfinished">aug</translation> </message> <message> <source>augsus4</source> <translation type="unfinished">augsus4</translation> </message> <message> <source>tri</source> <translation type="unfinished">tri</translation> </message> <message> <source>6</source> <translation type="unfinished">6</translation> </message> <message> <source>6sus4</source> <translation type="unfinished">6sus4</translation> </message> <message> <source>6add9</source> <translation type="unfinished">madd9</translation> </message> <message> <source>m6</source> <translation type="unfinished">m6</translation> </message> <message> <source>m6add9</source> <translation type="unfinished">m6add9</translation> </message> <message> <source>7</source> <translation type="unfinished">7</translation> </message> <message> <source>7sus4</source> <translation type="unfinished">7sus4</translation> </message> <message> <source>7#5</source> <translation type="unfinished">7#5</translation> </message> <message> <source>7b5</source> <translation type="unfinished">7b5</translation> </message> <message> <source>7#9</source> <translation type="unfinished">7#9</translation> </message> <message> <source>7b9</source> <translation type="unfinished">7b9</translation> </message> <message> <source>7#5#9</source> <translation type="unfinished">7#5#9</translation> </message> <message> <source>7#5b9</source> <translation type="unfinished">7#5b9</translation> </message> <message> <source>7b5b9</source> <translation type="unfinished">7b5b9</translation> </message> <message> <source>7add11</source> <translation type="unfinished">7add11</translation> </message> <message> <source>7add13</source> <translation type="unfinished">7add13</translation> </message> <message> <source>7#11</source> <translation type="unfinished">7#11</translation> </message> <message> <source>Maj7</source> <translation type="unfinished">Maj7</translation> </message> <message> <source>Maj7b5</source> <translation type="unfinished">Maj7b5</translation> </message> <message> <source>Maj7#5</source> <translation type="unfinished">Maj7#5</translation> </message> <message> <source>Maj7#11</source> <translation type="unfinished">Maj7#11</translation> </message> <message> <source>Maj7add13</source> <translation type="unfinished">Maj7add13</translation> </message> <message> <source>m7</source> <translation type="unfinished">m7</translation> </message> <message> <source>m7b5</source> <translation type="unfinished">m7b5</translation> </message> <message> <source>m7b9</source> <translation type="unfinished">m7b9</translation> </message> <message> <source>m7add11</source> <translation type="unfinished">m7add11</translation> </message> <message> <source>m7add13</source> <translation type="unfinished">m7add13</translation> </message> <message> <source>m-Maj7</source> <translation type="unfinished">m-Maj7</translation> </message> <message> <source>m-Maj7add11</source> <translation type="unfinished">m-Maj7add11</translation> </message> <message> <source>m-Maj7add13</source> <translation type="unfinished">m-Maj7add13</translation> </message> <message> <source>9</source> <translation type="unfinished">9</translation> </message> <message> <source>9sus4</source> <translation type="unfinished">9sus4</translation> </message> <message> <source>add9</source> <translation type="unfinished">add9</translation> </message> <message> <source>9#5</source> <translation type="unfinished">9#5</translation> </message> <message> <source>9b5</source> <translation type="unfinished">9b5</translation> </message> <message> <source>9#11</source> <translation type="unfinished">9#11</translation> </message> <message> <source>9b13</source> <translation type="unfinished">9b13</translation> </message> <message> <source>Maj9</source> <translation type="unfinished">Maj9</translation> </message> <message> <source>Maj9sus4</source> <translation type="unfinished">Maj9sus4</translation> </message> <message> <source>Maj9#5</source> <translation type="unfinished">Maj9#5</translation> </message> <message> <source>Maj9#11</source> <translation type="unfinished">Maj9#11</translation> </message> <message> <source>m9</source> <translation type="unfinished">m9</translation> </message> <message> <source>madd9</source> <translation type="unfinished">madd9</translation> </message> <message> <source>m9b5</source> <translation type="unfinished">m9b5</translation> </message> <message> <source>m9-Maj7</source> <translation type="unfinished">m9-Maj7</translation> </message> <message> <source>11</source> <translation type="unfinished">11</translation> </message> <message> <source>11b9</source> <translation type="unfinished">11b9</translation> </message> <message> <source>Maj11</source> <translation type="unfinished">Maj11</translation> </message> <message> <source>m11</source> <translation type="unfinished">m11</translation> </message> <message> <source>m-Maj11</source> <translation type="unfinished">m-Maj11</translation> </message> <message> <source>13</source> <translation type="unfinished">13</translation> </message> <message> <source>13#9</source> <translation type="unfinished">13#9</translation> </message> <message> <source>13b9</source> <translation type="unfinished">13b9</translation> </message> <message> <source>13b5b9</source> <translation type="unfinished">13b5b9</translation> </message> <message> <source>Maj13</source> <translation type="unfinished">Maj13</translation> </message> <message> <source>m13</source> <translation type="unfinished">m13</translation> </message> <message> <source>m-Maj13</source> <translation type="unfinished">m-Maj13</translation> </message> <message> <source>Harmonic minor</source> <translation type="unfinished">Harmonic minor</translation> </message> <message> <source>Melodic minor</source> <translation type="unfinished">Melodic minor</translation> </message> <message> <source>Whole tone</source> <translation type="unfinished">Whole tone</translation> </message> <message> <source>Diminished</source> <translation type="unfinished">Diminished</translation> </message> <message> <source>Major pentatonic</source> <translation type="unfinished">Major pentatonic</translation> </message> <message> <source>Minor pentatonic</source> <translation type="unfinished">Minor pentatonic</translation> </message> <message> <source>Jap in sen</source> <translation type="unfinished">Jap in sen</translation> </message> <message> <source>Major bebop</source> <translation type="unfinished">Major bebop</translation> </message> <message> <source>Dominant bebop</source> <translation type="unfinished">Dominant bebop</translation> </message> <message> <source>Blues</source> <translation type="unfinished">Blues</translation> </message> <message> <source>Arabic</source> <translation type="unfinished">Arabic</translation> </message> <message> <source>Enigmatic</source> <translation type="unfinished">Enigmatic</translation> </message> <message> <source>Neopolitan</source> <translation type="unfinished">Neopolitan</translation> </message> <message> <source>Neopolitan minor</source> <translation type="unfinished">Neopolitan minor</translation> </message> <message> <source>Hungarian minor</source> <translation type="unfinished">Hungarian minor</translation> </message> <message> <source>Dorian</source> <translation type="unfinished">Dorian</translation> </message> <message> <source>Phrygolydian</source> <translation type="unfinished">Phrygolydian</translation> </message> <message> <source>Lydian</source> <translation type="unfinished">Lydian</translation> </message> <message> <source>Mixolydian</source> <translation type="unfinished">Mixolydian</translation> </message> <message> <source>Aeolian</source> <translation type="unfinished">Aeolian</translation> </message> <message> <source>Locrian</source> <translation type="unfinished">Locrian</translation> </message> <message> <source>Chords</source> <translation type="unfinished">تار ها(Chords)</translation> </message> <message> <source>Chord type</source> <translation type="unfinished"></translation> </message> <message> <source>Chord range</source> <translation type="unfinished">محدوده ی تار</translation> </message> <message> <source>Minor</source> <translation type="unfinished"></translation> </message> <message> <source>Chromatic</source> <translation type="unfinished"></translation> </message> <message> <source>Half-Whole Diminished</source> <translation type="unfinished"></translation> </message> <message> <source>5</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentFunctionNoteStackingView</name> <message> <source>RANGE</source> <translation type="unfinished"></translation> </message> <message> <source>Chord range:</source> <translation type="unfinished">محدوده ی تار ها :</translation> </message> <message> <source>octave(s)</source> <translation type="unfinished">نت (ها)</translation> </message> <message> <source>Use this knob for setting the chord range in octaves. The selected chord will be played within specified number of octaves.</source> <translation type="unfinished"></translation> </message> <message> <source>STACKING</source> <translation type="unfinished"></translation> </message> <message> <source>Chord:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentMidiIOView</name> <message> <source>ENABLE MIDI INPUT</source> <translation type="unfinished"></translation> </message> <message> <source>CHANNEL</source> <translation type="unfinished"></translation> </message> <message> <source>VELOCITY</source> <translation type="unfinished"></translation> </message> <message> <source>ENABLE MIDI OUTPUT</source> <translation type="unfinished"></translation> </message> <message> <source>PROGRAM</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI devices to receive MIDI events from</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI devices to send MIDI events to</source> <translation type="unfinished"></translation> </message> <message> <source>NOTE</source> <translation type="unfinished"></translation> </message> <message> <source>CUSTOM BASE VELOCITY</source> <translation type="unfinished"></translation> </message> <message> <source>Specify the velocity normalization base for MIDI-based instruments at note volume 100%</source> <translation type="unfinished"></translation> </message> <message> <source>BASE VELOCITY</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentMiscView</name> <message> <source>MASTER PITCH</source> <translation type="unfinished"></translation> </message> <message> <source>Enables the use of Master Pitch</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentSoundShaping</name> <message> <source>VOLUME</source> <translation type="unfinished">حجم</translation> </message> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> <message> <source>CUTOFF</source> <translation type="unfinished"></translation> </message> <message> <source>Cutoff frequency</source> <translation type="unfinished"></translation> </message> <message> <source>RESO</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance</source> <translation type="unfinished"></translation> </message> <message> <source>Envelopes/LFOs</source> <translation type="unfinished"></translation> </message> <message> <source>Filter type</source> <translation type="unfinished"></translation> </message> <message> <source>Q/Resonance</source> <translation type="unfinished">Q/رزونانس</translation> </message> <message> <source>LowPass</source> <translation type="unfinished">پایین گذر</translation> </message> <message> <source>HiPass</source> <translation type="unfinished">بالا گذر</translation> </message> <message> <source>BandPass csg</source> <translation type="unfinished">میان گذر csg</translation> </message> <message> <source>BandPass czpg</source> <translation type="unfinished">میان گذر czpg</translation> </message> <message> <source>Notch</source> <translation type="unfinished">نچ</translation> </message> <message> <source>Allpass</source> <translation type="unfinished">تمام گذر</translation> </message> <message> <source>Moog</source> <translation type="unfinished">موگ Moog</translation> </message> <message> <source>2x LowPass</source> <translation type="unfinished">پایین گذر 2x</translation> </message> <message> <source>RC LowPass 12dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC BandPass 12dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC HighPass 12dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC LowPass 24dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC BandPass 24dB</source> <translation type="unfinished"></translation> </message> <message> <source>RC HighPass 24dB</source> <translation type="unfinished"></translation> </message> <message> <source>Vocal Formant Filter</source> <translation type="unfinished"></translation> </message> <message> <source>2x Moog</source> <translation type="unfinished"></translation> </message> <message> <source>SV LowPass</source> <translation type="unfinished"></translation> </message> <message> <source>SV BandPass</source> <translation type="unfinished"></translation> </message> <message> <source>SV HighPass</source> <translation type="unfinished"></translation> </message> <message> <source>SV Notch</source> <translation type="unfinished"></translation> </message> <message> <source>Fast Formant</source> <translation type="unfinished"></translation> </message> <message> <source>Tripole</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentSoundShapingView</name> <message> <source>TARGET</source> <translation type="unfinished"></translation> </message> <message> <source>These tabs contain envelopes. They&apos;re very important for modifying a sound, in that they are almost always necessary for substractive synthesis. For example if you have a volume envelope, you can set when the sound should have a specific volume. If you want to create some soft strings then your sound has to fade in and out very softly. This can be done by setting large attack and release times. It&apos;s the same for other envelope targets like panning, cutoff frequency for the used filter and so on. Just monkey around with it! You can really make cool sounds out of a saw-wave with just some envelopes...!</source> <translation type="unfinished"></translation> </message> <message> <source>FILTER</source> <translation type="unfinished"></translation> </message> <message> <source>Here you can select the built-in filter you want to use for this instrument-track. Filters are very important for changing the characteristics of a sound.</source> <translation type="unfinished"></translation> </message> <message> <source>Hz</source> <translation type="unfinished">Hz</translation> </message> <message> <source>Use this knob for setting the cutoff frequency for the selected filter. The cutoff frequency specifies the frequency for cutting the signal by a filter. For example a lowpass-filter cuts all frequencies above the cutoff frequency. A highpass-filter cuts all frequencies below cutoff frequency, and so on...</source> <translation type="unfinished"></translation> </message> <message> <source>RESO</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance:</source> <translation type="unfinished"></translation> </message> <message> <source>Use this knob for setting Q/Resonance for the selected filter. Q/Resonance tells the filter how much it should amplify frequencies near Cutoff-frequency.</source> <translation type="unfinished"></translation> </message> <message> <source>FREQ</source> <translation type="unfinished"></translation> </message> <message> <source>cutoff frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>Envelopes, LFOs and filters are not supported by the current instrument.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentTrack</name> <message> <source>unnamed_track</source> <translation type="unfinished"></translation> </message> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Pitch</source> <translation type="unfinished"></translation> </message> <message> <source>FX channel</source> <translation type="unfinished"></translation> </message> <message> <source>Default preset</source> <translation type="unfinished"></translation> </message> <message> <source>With this knob you can set the volume of the opened channel.</source> <translation type="unfinished">Mit diesem Knopf können Sie die Lautstärke des geöffneten Kanals ändern.</translation> </message> <message> <source>Base note</source> <translation type="unfinished"></translation> </message> <message> <source>Pitch range</source> <translation type="unfinished"></translation> </message> <message> <source>Master Pitch</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentTrackView</name> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>VOL</source> <translation type="unfinished"></translation> </message> <message> <source>Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Panning:</source> <translation type="unfinished"></translation> </message> <message> <source>PAN</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI</source> <translation type="unfinished"></translation> </message> <message> <source>Input</source> <translation type="unfinished"></translation> </message> <message> <source>Output</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InstrumentTrackWindow</name> <message> <source>GENERAL SETTINGS</source> <translation type="unfinished"></translation> </message> <message> <source>Instrument volume</source> <translation type="unfinished"></translation> </message> <message> <source>Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>VOL</source> <translation type="unfinished"></translation> </message> <message> <source>Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Panning:</source> <translation type="unfinished"></translation> </message> <message> <source>PAN</source> <translation type="unfinished"></translation> </message> <message> <source>Pitch</source> <translation type="unfinished"></translation> </message> <message> <source>Pitch:</source> <translation type="unfinished"></translation> </message> <message> <source>cents</source> <translation type="unfinished">درصد</translation> </message> <message> <source>PITCH</source> <translation type="unfinished"></translation> </message> <message> <source>FX channel</source> <translation type="unfinished"></translation> </message> <message> <source>ENV/LFO</source> <translation type="unfinished"></translation> </message> <message> <source>FUNC</source> <translation type="unfinished"></translation> </message> <message> <source>FX</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI</source> <translation type="unfinished"></translation> </message> <message> <source>Save preset</source> <translation type="unfinished"></translation> </message> <message> <source>XML preset file (*.xpf)</source> <translation type="unfinished"></translation> </message> <message> <source>PLUGIN</source> <translation type="unfinished">اضافات</translation> </message> <message> <source>Pitch range (semitones)</source> <translation type="unfinished"></translation> </message> <message> <source>RANGE</source> <translation type="unfinished"></translation> </message> <message> <source>Save current instrument track settings in a preset file</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to save current instrument track settings in a preset file. Later you can load this preset by double-clicking it in the preset-browser.</source> <translation type="unfinished"></translation> </message> <message> <source>MISC</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Knob</name> <message> <source>Set linear</source> <translation type="unfinished"></translation> </message> <message> <source>Set logarithmic</source> <translation type="unfinished"></translation> </message> <message> <source>Please enter a new value between -96.0 dBV and 6.0 dBV:</source> <translation type="unfinished"></translation> </message> <message> <source>Please enter a new value between %1 and %2:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LadspaControl</name> <message> <source>Link channels</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LadspaControlDialog</name> <message> <source>Link Channels</source> <translation type="unfinished"></translation> </message> <message> <source>Channel </source> <translation type="unfinished"></translation> </message> </context> <context> <name>LadspaControlView</name> <message> <source>Link channels</source> <translation type="unfinished"></translation> </message> <message> <source>Value:</source> <translation type="unfinished"></translation> </message> <message> <source>Sorry, no help available.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LadspaEffect</name> <message> <source>Unknown LADSPA plugin %1 requested.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LcdSpinBox</name> <message> <source>Please enter a new value between %1 and %2:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LfoController</name> <message> <source>LFO Controller</source> <translation type="unfinished"></translation> </message> <message> <source>Base value</source> <translation type="unfinished"></translation> </message> <message> <source>Oscillator speed</source> <translation type="unfinished"></translation> </message> <message> <source>Oscillator amount</source> <translation type="unfinished"></translation> </message> <message> <source>Oscillator phase</source> <translation type="unfinished"></translation> </message> <message> <source>Oscillator waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Frequency Multiplier</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LfoControllerDialog</name> <message> <source>LFO</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Controller</source> <translation type="unfinished"></translation> </message> <message> <source>BASE</source> <translation type="unfinished"></translation> </message> <message> <source>Base amount:</source> <translation type="unfinished"></translation> </message> <message> <source>todo</source> <translation type="unfinished"></translation> </message> <message> <source>SPD</source> <translation type="unfinished"></translation> </message> <message> <source>LFO-speed:</source> <translation type="unfinished">سرعت-LFO:</translation> </message> <message> <source>Use this knob for setting speed of the LFO. The bigger this value the faster the LFO oscillates and the faster the effect.</source> <translation type="unfinished"></translation> </message> <message> <source>AMT</source> <translation type="unfinished"></translation> </message> <message> <source>Modulation amount:</source> <translation type="unfinished">میزان مدولاسیون:</translation> </message> <message> <source>Use this knob for setting modulation amount of the LFO. The bigger this value, the more the connected control (e.g. volume or cutoff-frequency) will be influenced by the LFO.</source> <translation type="unfinished"></translation> </message> <message> <source>PHS</source> <translation type="unfinished"></translation> </message> <message> <source>Phase offset:</source> <translation type="unfinished"></translation> </message> <message> <source>degrees</source> <translation type="unfinished">درجه ها</translation> </message> <message> <source>With this knob you can set the phase offset of the LFO. That means you can move the point within an oscillation where the oscillator begins to oscillate. For example if you have a sine-wave and have a phase-offset of 180 degrees the wave will first go down. It&apos;s the same with a square-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a sine-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a triangle-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a saw-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a square-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for an exponential wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for white-noise.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a user-defined shape. Double click to pick a file.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a moog saw-wave.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MainWindow</name> <message> <source>Working directory</source> <translation type="unfinished"></translation> </message> <message> <source>The LMMS working directory %1 does not exist. Create it now? You can change the directory later via Edit -&gt; Settings.</source> <translation type="unfinished"></translation> </message> <message> <source>Could not save config-file</source> <translation type="unfinished">پرونده ی تنظیمات ذخیره نشد</translation> </message> <message> <source>Could not save configuration file %1. You&apos;re probably not permitted to write to this file. Please make sure you have write-access to the file and try again.</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;New</source> <translation type="unfinished">&amp;جدید</translation> </message> <message> <source>&amp;Open...</source> <translation type="unfinished">&amp;باز کن...</translation> </message> <message> <source>&amp;Save</source> <translation type="unfinished">&amp;ذخیره کن</translation> </message> <message> <source>Save &amp;As...</source> <translation type="unfinished">ذ&amp;خیره به صورت...</translation> </message> <message> <source>Import...</source> <translation type="unfinished"></translation> </message> <message> <source>E&amp;xport...</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Quit</source> <translation type="unfinished">&amp;خروج</translation> </message> <message> <source>&amp;Edit</source> <translation type="unfinished"></translation> </message> <message> <source>Settings</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Tools</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Help</source> <translation type="unfinished">&amp;راهنما</translation> </message> <message> <source>Help</source> <translation type="unfinished">راهنما</translation> </message> <message> <source>What&apos;s this?</source> <translation type="unfinished">این چیست؟</translation> </message> <message> <source>About</source> <translation type="unfinished">درباره</translation> </message> <message> <source>Create new project</source> <translation type="unfinished">ایجاد پروژه ی جدید</translation> </message> <message> <source>Create new project from template</source> <translation type="unfinished"></translation> </message> <message> <source>Open existing project</source> <translation type="unfinished">باز کردن پروژه ی موجود</translation> </message> <message> <source>Recently opened projects</source> <translation type="unfinished"></translation> </message> <message> <source>Save current project</source> <translation type="unfinished">ذخیره ی پروژه ی جاری</translation> </message> <message> <source>Export current project</source> <translation type="unfinished">استخراج پروژه ی جاری</translation> </message> <message> <source>Show/hide Song-Editor</source> <translation type="unfinished"></translation> </message> <message> <source>By pressing this button, you can show or hide the Song-Editor. With the help of the Song-Editor you can edit song-playlist and specify when which track should be played. You can also insert and move samples (e.g. rap samples) directly into the playlist.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide Beat+Bassline Editor</source> <translation type="unfinished"></translation> </message> <message> <source>By pressing this button, you can show or hide the Beat+Bassline Editor. The Beat+Bassline Editor is needed for creating beats, and for opening, adding, and removing channels, and for cutting, copying and pasting beat and bassline-patterns, and for other things like that.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide Piano-Roll</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the Piano-Roll. With the help of the Piano-Roll you can edit melodies in an easy way.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide Automation Editor</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the Automation Editor. With the help of the Automation Editor you can edit dynamic values in an easy way.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide FX Mixer</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the FX Mixer. The FX Mixer is a very powerful tool for managing effects for your song. You can insert effects into different effect-channels.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide project notes</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the project notes window. In this window you can put down your project notes.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide controller rack</source> <translation type="unfinished"></translation> </message> <message> <source>Untitled</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS %1</source> <translation type="unfinished">LMMS %1</translation> </message> <message> <source>Project not saved</source> <translation type="unfinished">پروژه ذخیره نشده</translation> </message> <message> <source>The current project was modified since last saving. Do you want to save it now?</source> <translation type="unfinished">پروژه جاری بعد از آخرین ذخیره تغییر یافته است.آیا اکنون مایل به ذخیره ی آن هستید؟</translation> </message> <message> <source>Help not available</source> <translation type="unfinished"></translation> </message> <message> <source>Currently there&apos;s no help available in LMMS. Please visit http://lmms.sf.net/wiki for documentation on LMMS.</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS (*.mmp *.mmpz)</source> <translation type="unfinished"></translation> </message> <message> <source>Version %1</source> <translation type="unfinished"></translation> </message> <message> <source>Configuration file</source> <translation type="unfinished"></translation> </message> <message> <source>Error while parsing configuration file at line %1:%2: %3</source> <translation type="unfinished"></translation> </message> <message> <source>Volumes</source> <translation type="unfinished"></translation> </message> <message> <source>Undo</source> <translation type="unfinished"></translation> </message> <message> <source>Redo</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS Project </source> <translation type="unfinished"></translation> </message> <message> <source>LMMS Project Template </source> <translation type="unfinished"></translation> </message> <message> <source>My Projects</source> <translation type="unfinished"></translation> </message> <message> <source>My Samples</source> <translation type="unfinished"></translation> </message> <message> <source>My Presets</source> <translation type="unfinished"></translation> </message> <message> <source>My Home</source> <translation type="unfinished"></translation> </message> <message> <source>My Computer</source> <translation type="unfinished"></translation> </message> <message> <source>Root Directory</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;File</source> <translation type="unfinished"></translation> </message> <message> <source>&amp;Recently Opened Projects</source> <translation type="unfinished"></translation> </message> <message> <source>Save as New &amp;Version</source> <translation type="unfinished"></translation> </message> <message> <source>E&amp;xport Tracks...</source> <translation type="unfinished"></translation> </message> <message> <source>Online Help</source> <translation type="unfinished"></translation> </message> <message> <source>What&apos;s This?</source> <translation type="unfinished"></translation> </message> <message> <source>Open Project</source> <translation type="unfinished"></translation> </message> <message> <source>Save Project</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MeterDialog</name> <message> <source>Meter Numerator</source> <translation type="unfinished"></translation> </message> <message> <source>Meter Denominator</source> <translation type="unfinished"></translation> </message> <message> <source>TIME SIG</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MeterModel</name> <message> <source>Numerator</source> <translation type="unfinished"></translation> </message> <message> <source>Denominator</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MidiAlsaRaw::setupWidget</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MidiAlsaSeq</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MidiController</name> <message> <source>MIDI Controller</source> <translation type="unfinished"></translation> </message> <message> <source>unnamed_midi_controller</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MidiImport</name> <message> <source>Setup incomplete</source> <translation type="unfinished"></translation> </message> <message> <source>You do not have set up a default soundfont in the settings dialog (Edit-&gt;Settings). Therefore no sound will be played back after importing this MIDI file. You should download a General MIDI soundfont, specify it in settings dialog and try again.</source> <translation type="unfinished"></translation> </message> <message> <source>You did not compile LMMS with support for SoundFont2 player, which is used to add default sound to imported MIDI files. Therefore no sound will be played back after importing this MIDI file.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MidiOss::setupWidget</name> <message> <source>DEVICE</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MidiPort</name> <message> <source>Input channel</source> <translation type="unfinished"></translation> </message> <message> <source>Output channel</source> <translation type="unfinished"></translation> </message> <message> <source>Input controller</source> <translation type="unfinished"></translation> </message> <message> <source>Output controller</source> <translation type="unfinished"></translation> </message> <message> <source>Fixed input velocity</source> <translation type="unfinished"></translation> </message> <message> <source>Fixed output velocity</source> <translation type="unfinished"></translation> </message> <message> <source>Output MIDI program</source> <translation type="unfinished"></translation> </message> <message> <source>Receive MIDI-events</source> <translation type="unfinished"></translation> </message> <message> <source>Send MIDI-events</source> <translation type="unfinished"></translation> </message> <message> <source>Fixed output note</source> <translation type="unfinished"></translation> </message> <message> <source>Base velocity</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MonstroInstrument</name> <message> <source>Osc 1 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Coarse detune</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Fine detune left</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Fine detune right</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Stereo phase offset</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Pulse width</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Sync send on rise</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 1 Sync send on fall</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Coarse detune</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Fine detune left</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Fine detune right</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Stereo phase offset</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Sync Hard</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 2 Sync Reverse</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Coarse detune</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Stereo phase offset</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Sub-oscillator mix</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Waveform 1</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Waveform 2</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Sync Hard</source> <translation type="unfinished"></translation> </message> <message> <source>Osc 3 Sync Reverse</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 1 Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 1 Attack</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 1 Rate</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 1 Phase</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 2 Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 2 Attack</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 2 Rate</source> <translation type="unfinished"></translation> </message> <message> <source>LFO 2 Phase</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Pre-delay</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Attack</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Hold</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Sustain</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Release</source> <translation type="unfinished"></translation> </message> <message> <source>Env 1 Slope</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Pre-delay</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Attack</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Hold</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Sustain</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Release</source> <translation type="unfinished"></translation> </message> <message> <source>Env 2 Slope</source> <translation type="unfinished"></translation> </message> <message> <source>Osc2-3 modulation</source> <translation type="unfinished"></translation> </message> <message> <source>Selected view</source> <translation type="unfinished"></translation> </message> <message> <source>Vol1-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Vol1-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Vol1-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Vol1-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Vol2-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Vol2-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Vol2-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Vol2-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Vol3-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Vol3-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Vol3-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Vol3-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Phs1-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Phs1-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Phs1-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Phs1-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Phs2-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Phs2-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Phs2-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Phs2-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Phs3-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Phs3-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Phs3-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Phs3-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Pit1-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Pit1-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Pit1-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Pit1-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Pit2-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Pit2-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Pit2-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Pit2-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Pit3-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Pit3-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Pit3-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Pit3-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>PW1-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>PW1-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>PW1-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>PW1-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Sub3-Env1</source> <translation type="unfinished"></translation> </message> <message> <source>Sub3-Env2</source> <translation type="unfinished"></translation> </message> <message> <source>Sub3-LFO1</source> <translation type="unfinished"></translation> </message> <message> <source>Sub3-LFO2</source> <translation type="unfinished"></translation> </message> <message> <source>Sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited Saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited Ramp wave</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited Moog saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Soft square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Absolute sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Exponential wave</source> <translation type="unfinished"></translation> </message> <message> <source>White noise</source> <translation type="unfinished"></translation> </message> <message> <source>Digital Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Digital Saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Digital Ramp wave</source> <translation type="unfinished"></translation> </message> <message> <source>Digital Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Digital Moog saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Ramp wave</source> <translation type="unfinished"></translation> </message> <message> <source>Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Moog saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Abs. sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Random</source> <translation type="unfinished"></translation> </message> <message> <source>Random smooth</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MonstroView</name> <message> <source>Operators view</source> <translation type="unfinished"></translation> </message> <message> <source>The Operators view contains all the operators. These include both audible operators (oscillators) and inaudible operators, or modulators: Low-frequency oscillators and Envelopes. Knobs and other widgets in the Operators view have their own what&apos;s this -texts, so you can get more specific help for them that way. </source> <translation type="unfinished"></translation> </message> <message> <source>Matrix view</source> <translation type="unfinished"></translation> </message> <message> <source>The Matrix view contains the modulation matrix. Here you can define the modulation relationships between the various operators: Each audible operator (oscillators 1-3) has 3-4 properties that can be modulated by any of the modulators. Using more modulations consumes more CPU power. The view is divided to modulation targets, grouped by the target oscillator. Available targets are volume, pitch, phase, pulse width and sub-osc ratio. Note: some targets are specific to one oscillator only. Each modulation target has 4 knobs, one for each modulator. By default the knobs are at 0, which means no modulation. Turning a knob to 1 causes that modulator to affect the modulation target as much as possible. Turning it to -1 does the same, but the modulation is inversed. </source> <translation type="unfinished"></translation> </message> <message> <source>Mix Osc2 with Osc3</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate amplitude of Osc3 with Osc2</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate frequency of Osc3 with Osc2</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate phase of Osc3 with Osc2</source> <translation type="unfinished"></translation> </message> <message> <source>The CRS knob changes the tuning of oscillator 1 in semitone steps. </source> <translation type="unfinished"></translation> </message> <message> <source>The CRS knob changes the tuning of oscillator 2 in semitone steps. </source> <translation type="unfinished"></translation> </message> <message> <source>The CRS knob changes the tuning of oscillator 3 in semitone steps. </source> <translation type="unfinished"></translation> </message> <message> <source>FTL and FTR change the finetuning of the oscillator for left and right channels respectively. These can add stereo-detuning to the oscillator which widens the stereo image and causes an illusion of space. </source> <translation type="unfinished"></translation> </message> <message> <source>The SPO knob modifies the difference in phase between left and right channels. Higher difference creates a wider stereo image. </source> <translation type="unfinished"></translation> </message> <message> <source>The PW knob controls the pulse width, also known as duty cycle, of oscillator 1. Oscillator 1 is a digital pulse wave oscillator, it doesn&apos;t produce bandlimited output, which means that you can use it as an audible oscillator but it will cause aliasing. You can also use it as an inaudible source of a sync signal, which can be used to synchronize oscillators 2 and 3. </source> <translation type="unfinished"></translation> </message> <message> <source>Send Sync on Rise: When enabled, the Sync signal is sent every time the state of oscillator 1 changes from low to high, ie. when the amplitude changes from -1 to 1. Oscillator 1&apos;s pitch, phase and pulse width may affect the timing of syncs, but its volume has no effect on them. Sync signals are sent independently for both left and right channels. </source> <translation type="unfinished"></translation> </message> <message> <source>Send Sync on Fall: When enabled, the Sync signal is sent every time the state of oscillator 1 changes from high to low, ie. when the amplitude changes from 1 to -1. Oscillator 1&apos;s pitch, phase and pulse width may affect the timing of syncs, but its volume has no effect on them. Sync signals are sent independently for both left and right channels. </source> <translation type="unfinished"></translation> </message> <message> <source>Hard sync: Every time the oscillator receives a sync signal from oscillator 1, its phase is reset to 0 + whatever its phase offset is. </source> <translation type="unfinished"></translation> </message> <message> <source>Reverse sync: Every time the oscillator receives a sync signal from oscillator 1, the amplitude of the oscillator gets inverted. </source> <translation type="unfinished"></translation> </message> <message> <source>Choose waveform for oscillator 2. </source> <translation type="unfinished"></translation> </message> <message> <source>Choose waveform for oscillator 3&apos;s first sub-osc. Oscillator 3 can smoothly interpolate between two different waveforms. </source> <translation type="unfinished"></translation> </message> <message> <source>Choose waveform for oscillator 3&apos;s second sub-osc. Oscillator 3 can smoothly interpolate between two different waveforms. </source> <translation type="unfinished"></translation> </message> <message> <source>The SUB knob changes the mixing ratio of the two sub-oscs of oscillator 3. Each sub-osc can be set to produce a different waveform, and oscillator 3 can smoothly interpolate between them. All incoming modulations to oscillator 3 are applied to both sub-oscs/waveforms in the exact same way. </source> <translation type="unfinished"></translation> </message> <message> <source>In addition to dedicated modulators, Monstro allows oscillator 3 to be modulated by the output of oscillator 2. Mix mode means no modulation: the outputs of the oscillators are simply mixed together. </source> <translation type="unfinished"></translation> </message> <message> <source>In addition to dedicated modulators, Monstro allows oscillator 3 to be modulated by the output of oscillator 2. AM means amplitude modulation: Oscillator 3&apos;s amplitude (volume) is modulated by oscillator 2. </source> <translation type="unfinished"></translation> </message> <message> <source>In addition to dedicated modulators, Monstro allows oscillator 3 to be modulated by the output of oscillator 2. FM means frequency modulation: Oscillator 3&apos;s frequency (pitch) is modulated by oscillator 2. The frequency modulation is implemented as phase modulation, which gives a more stable overall pitch than &quot;pure&quot; frequency modulation. </source> <translation type="unfinished"></translation> </message> <message> <source>In addition to dedicated modulators, Monstro allows oscillator 3 to be modulated by the output of oscillator 2. PM means phase modulation: Oscillator 3&apos;s phase is modulated by oscillator 2. It differs from frequency modulation in that the phase changes are not cumulative. </source> <translation type="unfinished"></translation> </message> <message> <source>Select the waveform for LFO 1. &quot;Random&quot; and &quot;Random smooth&quot; are special waveforms: they produce random output, where the rate of the LFO controls how often the state of the LFO changes. The smooth version interpolates between these states with cosine interpolation. These random modes can be used to give &quot;life&quot; to your presets - add some of that analog unpredictability... </source> <translation type="unfinished"></translation> </message> <message> <source>Select the waveform for LFO 2. &quot;Random&quot; and &quot;Random smooth&quot; are special waveforms: they produce random output, where the rate of the LFO controls how often the state of the LFO changes. The smooth version interpolates between these states with cosine interpolation. These random modes can be used to give &quot;life&quot; to your presets - add some of that analog unpredictability... </source> <translation type="unfinished"></translation> </message> <message> <source>Attack causes the LFO to come on gradually from the start of the note. </source> <translation type="unfinished"></translation> </message> <message> <source>Rate sets the speed of the LFO, measured in milliseconds per cycle. Can be synced to tempo. </source> <translation type="unfinished"></translation> </message> <message> <source>PHS controls the phase offset of the LFO. </source> <translation type="unfinished"></translation> </message> <message> <source>PRE, or pre-delay, delays the start of the envelope from the start of the note. 0 means no delay. </source> <translation type="unfinished"></translation> </message> <message> <source>ATT, or attack, controls how fast the envelope ramps up at start, measured in milliseconds. A value of 0 means instant. </source> <translation type="unfinished"></translation> </message> <message> <source>HOLD controls how long the envelope stays at peak after the attack phase. </source> <translation type="unfinished"></translation> </message> <message> <source>DEC, or decay, controls how fast the envelope falls off from its peak, measured in milliseconds it would take to go from peak to zero. The actual decay may be shorter if sustain is used. </source> <translation type="unfinished"></translation> </message> <message> <source>SUS, or sustain, controls the sustain level of the envelope. The decay phase will not go below this level as long as the note is held. </source> <translation type="unfinished"></translation> </message> <message> <source>REL, or release, controls how long the release is for the note, measured in how long it would take to fall from peak to zero. Actual release may be shorter, depending on at what phase the note is released. </source> <translation type="unfinished"></translation> </message> <message> <source>The slope knob controls the curve or shape of the envelope. A value of 0 creates straight rises and falls. Negative values create curves that start slowly, peak quickly and fall of slowly again. Positive values create curves that start and end quickly, and stay longer near the peaks. </source> <translation type="unfinished"></translation> </message> </context> <context> <name>MultitapEchoControlDialog</name> <message> <source>Length</source> <translation type="unfinished"></translation> </message> <message> <source>Step length:</source> <translation type="unfinished"></translation> </message> <message> <source>Dry</source> <translation type="unfinished"></translation> </message> <message> <source>Dry Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Stages</source> <translation type="unfinished"></translation> </message> <message> <source>Lowpass stages:</source> <translation type="unfinished"></translation> </message> <message> <source>Swap inputs</source> <translation type="unfinished"></translation> </message> <message> <source>Swap left and right input channel for reflections</source> <translation type="unfinished"></translation> </message> </context> <context> <name>NesInstrument</name> <message> <source>Channel 1 Coarse detune</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 Envelope length</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 Duty cycle</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 Sweep amount</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 Sweep rate</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 Coarse detune</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 Envelope length</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 Duty cycle</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 Sweep amount</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 Sweep rate</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 3 Coarse detune</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 3 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 Envelope length</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 Noise frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 Noise frequency sweep</source> <translation type="unfinished"></translation> </message> <message> <source>Master volume</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrato</source> <translation type="unfinished"></translation> </message> </context> <context> <name>OscillatorObject</name> <message> <source>Osc %1 volume</source> <translation type="unfinished">حجم نوسان ساز %1</translation> </message> <message> <source>Osc %1 panning</source> <translation type="unfinished">تراز نوسان ساز %1</translation> </message> <message> <source>Osc %1 coarse detuning</source> <translation type="unfinished">کوک زمختی نوسان ساز %1</translation> </message> <message> <source>Osc %1 fine detuning left</source> <translation type="unfinished">کوک دقیق چپ نوسان ساز %1</translation> </message> <message> <source>Osc %1 fine detuning right</source> <translation type="unfinished">کوک دقیق راست نوسان ساز %1</translation> </message> <message> <source>Osc %1 phase-offset</source> <translation type="unfinished">انحراف فاز نوسان ساز %1</translation> </message> <message> <source>Osc %1 stereo phase-detuning</source> <translation type="unfinished">کوک فاز استریوی نوسان ساز %1</translation> </message> <message> <source>Osc %1 wave shape</source> <translation type="unfinished"></translation> </message> <message> <source>Modulation type %1</source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 harmonic</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PatmanView</name> <message> <source>Open other patch</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to open another patch-file. Loop and Tune settings are not reset.</source> <translation type="unfinished"></translation> </message> <message> <source>Loop</source> <translation type="unfinished"></translation> </message> <message> <source>Loop mode</source> <translation type="unfinished"></translation> </message> <message> <source>Here you can toggle the Loop mode. If enabled, PatMan will use the loop information available in the file.</source> <translation type="unfinished"></translation> </message> <message> <source>Tune</source> <translation type="unfinished"></translation> </message> <message> <source>Tune mode</source> <translation type="unfinished"></translation> </message> <message> <source>Here you can toggle the Tune mode. If enabled, PatMan will tune the sample to match the note&apos;s frequency.</source> <translation type="unfinished"></translation> </message> <message> <source>No file selected</source> <translation type="unfinished"></translation> </message> <message> <source>Open patch file</source> <translation type="unfinished"></translation> </message> <message> <source>Patch-Files (*.pat)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PatternView</name> <message> <source>double-click to open this pattern in piano-roll use mouse wheel to set volume of a step</source> <translation type="unfinished"></translation> </message> <message> <source>Open in piano-roll</source> <translation type="unfinished">در غلتک پیانو باز کن</translation> </message> <message> <source>Clear all notes</source> <translation type="unfinished">پاک کردن تمامی نت ها</translation> </message> <message> <source>Reset name</source> <translation type="unfinished">باز نشانی نام</translation> </message> <message> <source>Change name</source> <translation type="unfinished">تغییر نام</translation> </message> <message> <source>Add steps</source> <translation type="unfinished"></translation> </message> <message> <source>Remove steps</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PeakController</name> <message> <source>Peak Controller</source> <translation type="unfinished"></translation> </message> <message> <source>Peak Controller Bug</source> <translation type="unfinished"></translation> </message> <message> <source>Due to a bug in older version of LMMS, the peak controllers may not be connect properly. Please ensure that peak controllers are connected properly and re-save this file. Sorry for any inconvenience caused.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PeakControllerDialog</name> <message> <source>PEAK</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Controller</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PeakControllerEffectControlDialog</name> <message> <source>BASE</source> <translation type="unfinished"></translation> </message> <message> <source>Base amount:</source> <translation type="unfinished"></translation> </message> <message> <source>Modulation amount:</source> <translation type="unfinished">میزان مدولاسیون:</translation> </message> <message> <source>Attack:</source> <translation type="unfinished">تهاجم(Attack):</translation> </message> <message> <source>Release:</source> <translation type="unfinished">رهایی(Release):</translation> </message> <message> <source>AMNT</source> <translation type="unfinished"></translation> </message> <message> <source>MULT</source> <translation type="unfinished"></translation> </message> <message> <source>Amount Multiplicator:</source> <translation type="unfinished"></translation> </message> <message> <source>ATCK</source> <translation type="unfinished"></translation> </message> <message> <source>DCAY</source> <translation type="unfinished"></translation> </message> <message> <source>TRES</source> <translation type="unfinished"></translation> </message> <message> <source>Treshold:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PeakControllerEffectControls</name> <message> <source>Base value</source> <translation type="unfinished"></translation> </message> <message> <source>Modulation amount</source> <translation type="unfinished">مقدار مدولاسیون</translation> </message> <message> <source>Mute output</source> <translation type="unfinished"></translation> </message> <message> <source>Attack</source> <translation type="unfinished"></translation> </message> <message> <source>Release</source> <translation type="unfinished"></translation> </message> <message> <source>Abs Value</source> <translation type="unfinished"></translation> </message> <message> <source>Amount Multiplicator</source> <translation type="unfinished"></translation> </message> <message> <source>Treshold</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PianoRoll</name> <message> <source>Piano-Roll - %1</source> <translation>غلتک پیانو - %1</translation> </message> <message> <source>Piano-Roll - no pattern</source> <translation>غلتک پیانو - بدون الگو</translation> </message> <message> <source>Please open a pattern by double-clicking on it!</source> <translation>لطفا یک الگو را با دوبار کلیک روی أن باز کنید!</translation> </message> <message> <source>Last note</source> <translation type="unfinished"></translation> </message> <message> <source>Note lock</source> <translation type="unfinished"></translation> </message> <message> <source>Note Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Note Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Mark/unmark current semitone</source> <translation type="unfinished"></translation> </message> <message> <source>Mark current scale</source> <translation type="unfinished"></translation> </message> <message> <source>Mark current chord</source> <translation type="unfinished"></translation> </message> <message> <source>Unmark all</source> <translation type="unfinished"></translation> </message> <message> <source>No scale</source> <translation type="unfinished"></translation> </message> <message> <source>No chord</source> <translation type="unfinished"></translation> </message> <message> <source>Volume: %1%</source> <translation type="unfinished"></translation> </message> <message> <source>Panning: %1% left</source> <translation type="unfinished"></translation> </message> <message> <source>Panning: %1% right</source> <translation type="unfinished"></translation> </message> <message> <source>Panning: center</source> <translation type="unfinished"></translation> </message> <message> <source>Please enter a new value between %1 and %2:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PianoRollWindow</name> <message> <source>Play/pause current pattern (Space)</source> <translation type="unfinished">پخش/مکث الگوی جاری (فاصله)</translation> </message> <message> <source>Record notes from MIDI-device/channel-piano</source> <translation type="unfinished"></translation> </message> <message> <source>Record notes from MIDI-device/channel-piano while playing song or BB track</source> <translation type="unfinished"></translation> </message> <message> <source>Stop playing of current pattern (Space)</source> <translation type="unfinished">توقف پخش الگوی جاری (فاصله)</translation> </message> <message> <source>Click here to play the current pattern. This is useful while editing it. The pattern is automatically looped when its end is reached.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to record notes from a MIDI-device or the virtual test-piano of the according channel-window to the current pattern. When recording all notes you play will be written to this pattern and you can play and edit them afterwards.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to record notes from a MIDI-device or the virtual test-piano of the according channel-window to the current pattern. When recording all notes you play will be written to this pattern and you will hear the song or BB track in the background.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to stop playback of current pattern.</source> <translation type="unfinished"></translation> </message> <message> <source>Draw mode (Shift+D)</source> <translation type="unfinished"></translation> </message> <message> <source>Erase mode (Shift+E)</source> <translation type="unfinished"></translation> </message> <message> <source>Select mode (Shift+S)</source> <translation type="unfinished"></translation> </message> <message> <source>Detune mode (Shift+T)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and draw mode will be activated. In this mode you can add, resize and move notes. This is the default mode which is used most of the time. You can also press &apos;Shift+D&apos; on your keyboard to activate this mode. In this mode, hold Ctrl to temporarily go into select mode.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and erase mode will be activated. In this mode you can erase notes. You can also press &apos;Shift+E&apos; on your keyboard to activate this mode.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and select mode will be activated. In this mode you can select notes. Alternatively, you can hold Ctrl in draw mode to temporarily use select mode.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and detune mode will be activated. In this mode you can click a note to open its automation detuning. You can utilize this to slide notes from one to another. You can also press &apos;Shift+T&apos; on your keyboard to activate this mode.</source> <translation type="unfinished"></translation> </message> <message> <source>Cut selected notes (Ctrl+X)</source> <translation type="unfinished">برش نت های انتخاب شده(Ctrl+X)</translation> </message> <message> <source>Copy selected notes (Ctrl+C)</source> <translation type="unfinished">کپی نت های انتخاب شده(Ctrl+C)</translation> </message> <message> <source>Paste notes from clipboard (Ctrl+V)</source> <translation type="unfinished">چسباندن نت ها از حافظه ی موقت(Ctrl+V)</translation> </message> <message> <source>Click here and the selected notes will be cut into the clipboard. You can paste them anywhere in any pattern by clicking on the paste button.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and the selected notes will be copied into the clipboard. You can paste them anywhere in any pattern by clicking on the paste button.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here and the notes from the clipboard will be pasted at the first visible measure.</source> <translation type="unfinished"></translation> </message> <message> <source>This controls the magnification of an axis. It can be helpful to choose magnification for a specific task. For ordinary editing, the magnification should be fitted to your smallest notes. </source> <translation type="unfinished"></translation> </message> <message> <source>The &apos;Q&apos; stands for quantization, and controls the grid size notes and control points snap to. With smaller quantization values, you can draw shorter notes in Piano Roll, and more exact control points in the Automation Editor.</source> <translation type="unfinished"></translation> </message> <message> <source>This lets you select the length of new notes. &apos;Last Note&apos; means that LMMS will use the note length of the note you last edited</source> <translation type="unfinished"></translation> </message> <message> <source>The feature is directly connected to the context-menu on the virtual keyboard, to the left in Piano Roll. After you have chosen the scale you want in this drop-down menu, you can right click on a desired key in the virtual keyboard, and then choose &apos;Mark current Scale&apos;. LMMS will highlight all notes that belongs to the chosen scale, and in the key you have selected!</source> <translation type="unfinished"></translation> </message> <message> <source>Let you select a chord which LMMS then can draw or highlight.You can find the most common chords in this drop-down menu. After you have selected a chord, click anywhere to place the chord, and right click on the virtual keyboard to open context menu and highlight the chord. To return to single note placement, you need to choose &apos;No chord&apos; in this drop-down menu.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PianoView</name> <message> <source>Base note</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Plugin</name> <message> <source>Plugin not found</source> <translation type="unfinished"></translation> </message> <message> <source>The plugin &quot;%1&quot; wasn&apos;t found or could not be loaded! Reason: &quot;%2&quot;</source> <translation type="unfinished"></translation> </message> <message> <source>Error while loading plugin</source> <translation type="unfinished">در بارگذاری اضافات اشتباه رخ داد</translation> </message> <message> <source>Failed to load plugin &quot;%1&quot;!</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS plugin %1 does not have a plugin descriptor named %2!</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PluginBrowser</name> <message> <source>Instrument plugins</source> <translation type="unfinished"></translation> </message> <message> <source>Instrument browser</source> <translation type="unfinished"></translation> </message> <message> <source>Drag an instrument into either the Song-Editor, the Beat+Bassline Editor or into an existing instrument track.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ProjectNotes</name> <message> <source>Project notes</source> <translation type="unfinished">یادداشت های پروژه</translation> </message> <message> <source>Put down your project notes here.</source> <translation type="unfinished">یادداشت های پروژه ی خود را اینجا قرار دهید.</translation> </message> <message> <source>Edit Actions</source> <translation type="unfinished">ویرایش کنش ها</translation> </message> <message> <source>&amp;Undo</source> <translation type="unfinished">&amp;واچینی</translation> </message> <message> <source>Ctrl+Z</source> <translation type="unfinished">Ctrl+Z</translation> </message> <message> <source>&amp;Redo</source> <translation type="unfinished">&amp;بازچینی</translation> </message> <message> <source>Ctrl+Y</source> <translation type="unfinished">Ctrl+Y</translation> </message> <message> <source>&amp;Copy</source> <translation type="unfinished">&amp;کپی</translation> </message> <message> <source>Ctrl+C</source> <translation type="unfinished">Ctrl+C</translation> </message> <message> <source>Cu&amp;t</source> <translation type="unfinished">&amp;برش</translation> </message> <message> <source>Ctrl+X</source> <translation type="unfinished">Ctrl+X</translation> </message> <message> <source>&amp;Paste</source> <translation type="unfinished">&amp;چسباندن</translation> </message> <message> <source>Ctrl+V</source> <translation type="unfinished">Ctrl+V</translation> </message> <message> <source>Format Actions</source> <translation type="unfinished">قالب بندی کنش ها</translation> </message> <message> <source>&amp;Bold</source> <translation type="unfinished">&amp;برجسته</translation> </message> <message> <source>Ctrl+B</source> <translation type="unfinished">Ctrl+B</translation> </message> <message> <source>&amp;Italic</source> <translation type="unfinished">&amp;خوابیده</translation> </message> <message> <source>Ctrl+I</source> <translation type="unfinished">Ctrl+I</translation> </message> <message> <source>&amp;Underline</source> <translation type="unfinished">&amp;زیرخط</translation> </message> <message> <source>Ctrl+U</source> <translation type="unfinished">Ctrl+U</translation> </message> <message> <source>&amp;Left</source> <translation type="unfinished">&amp;چپ</translation> </message> <message> <source>Ctrl+L</source> <translation type="unfinished">Ctrl+L</translation> </message> <message> <source>C&amp;enter</source> <translation type="unfinished">&amp;مرکز</translation> </message> <message> <source>Ctrl+E</source> <translation type="unfinished">Ctrl+E</translation> </message> <message> <source>&amp;Right</source> <translation type="unfinished">&amp;راست</translation> </message> <message> <source>Ctrl+R</source> <translation type="unfinished">Ctrl+R</translation> </message> <message> <source>&amp;Justify</source> <translation type="unfinished">&amp;تراز</translation> </message> <message> <source>Ctrl+J</source> <translation type="unfinished">Ctrl+J</translation> </message> <message> <source>&amp;Color...</source> <translation type="unfinished">&amp;رنگ...</translation> </message> </context> <context> <name>ProjectRenderer</name> <message> <source>WAV-File (*.wav)</source> <translation type="unfinished"></translation> </message> <message> <source>Compressed OGG-File (*.ogg)</source> <translation type="unfinished">پرونده ی OGG فشرده شده(*.ogg)</translation> </message> </context> <context> <name>QObject</name> <message> <source>C</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>Db</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>C#</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>D</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>Eb</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>D#</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>E</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>Fb</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>Gb</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>F#</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>G</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>Ab</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>G#</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>A</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>Bb</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>A#</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> <message> <source>B</source> <comment>Note name</comment> <translation type="unfinished"></translation> </message> </context> <context> <name>QWidget</name> <message> <source>Name: </source> <translation type="unfinished"></translation> </message> <message> <source>Maker: </source> <translation type="unfinished"></translation> </message> <message> <source>Copyright: </source> <translation type="unfinished"></translation> </message> <message> <source>Requires Real Time: </source> <translation type="unfinished"></translation> </message> <message> <source>Yes</source> <translation type="unfinished"></translation> </message> <message> <source>No</source> <translation type="unfinished"></translation> </message> <message> <source>Real Time Capable: </source> <translation type="unfinished"></translation> </message> <message> <source>In Place Broken: </source> <translation type="unfinished"></translation> </message> <message> <source>Channels In: </source> <translation type="unfinished"></translation> </message> <message> <source>Channels Out: </source> <translation type="unfinished"></translation> </message> <message> <source>File: </source> <translation type="unfinished"></translation> </message> <message> <source>File: %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>RenameDialog</name> <message> <source>Rename...</source> <translation type="unfinished">تغییر نام...</translation> </message> </context> <context> <name>SampleBuffer</name> <message> <source>Open audio file</source> <translation type="unfinished">باز کردن پرونده ی صوتی</translation> </message> <message> <source>Wave-Files (*.wav)</source> <translation type="unfinished"> Wave- پرونده های(*.wav)</translation> </message> <message> <source>OGG-Files (*.ogg)</source> <translation type="unfinished">OGG-پرونده های (*.ogg)</translation> </message> <message> <source>DrumSynth-Files (*.ds)</source> <translation type="unfinished"></translation> </message> <message> <source>FLAC-Files (*.flac)</source> <translation type="unfinished"></translation> </message> <message> <source>SPEEX-Files (*.spx)</source> <translation type="unfinished"></translation> </message> <message> <source>VOC-Files (*.voc)</source> <translation type="unfinished">VOC-پرونده های (*.voc)</translation> </message> <message> <source>AIFF-Files (*.aif *.aiff)</source> <translation type="unfinished">AIFF-پرونده های (*.aif *.aiff)</translation> </message> <message> <source>AU-Files (*.au)</source> <translation type="unfinished">AU-پرونده های (*.au)</translation> </message> <message> <source>RAW-Files (*.raw)</source> <translation type="unfinished">RAW-پرونده های (*.raw)</translation> </message> <message> <source>All Audio-Files (*.wav *.ogg *.ds *.flac *.spx *.voc *.aif *.aiff *.au *.raw)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SampleTCOView</name> <message> <source>double-click to select sample</source> <translation type="unfinished">برای انتخاب نمونه دوبار کلیک کنید</translation> </message> <message> <source>Delete (middle mousebutton)</source> <translation type="unfinished"></translation> </message> <message> <source>Cut</source> <translation type="unfinished">برش</translation> </message> <message> <source>Copy</source> <translation type="unfinished">کپی</translation> </message> <message> <source>Paste</source> <translation type="unfinished">چسباندن</translation> </message> <message> <source>Mute/unmute (&lt;Ctrl&gt; + middle click)</source> <translation type="unfinished"></translation> </message> <message> <source>Set/clear record</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SampleTrack</name> <message> <source>Sample track</source> <translation type="unfinished">تراک نمونه</translation> </message> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Panning</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SampleTrackView</name> <message> <source>Track volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel volume:</source> <translation type="unfinished">حجم کانال:</translation> </message> <message> <source>VOL</source> <translation type="unfinished"></translation> </message> <message> <source>Panning</source> <translation type="unfinished"></translation> </message> <message> <source>Panning:</source> <translation type="unfinished"></translation> </message> <message> <source>PAN</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SetupDialog</name> <message> <source>Setup LMMS</source> <translation type="unfinished">برپایی LMMS</translation> </message> <message> <source>General settings</source> <translation type="unfinished"></translation> </message> <message> <source>BUFFER SIZE</source> <translation type="unfinished"></translation> </message> <message> <source>Reset to default-value</source> <translation type="unfinished"></translation> </message> <message> <source>MISC</source> <translation type="unfinished"></translation> </message> <message> <source>Enable tooltips</source> <translation type="unfinished"></translation> </message> <message> <source>Show restart warning after changing settings</source> <translation type="unfinished"></translation> </message> <message> <source>Display volume as dBV </source> <translation type="unfinished"></translation> </message> <message> <source>Compress project files per default</source> <translation type="unfinished"></translation> </message> <message> <source>One instrument track window mode</source> <translation type="unfinished"></translation> </message> <message> <source>HQ-mode for output audio-device</source> <translation type="unfinished"></translation> </message> <message> <source>Compact track buttons</source> <translation type="unfinished"></translation> </message> <message> <source>Sync VST plugins to host playback</source> <translation type="unfinished"></translation> </message> <message> <source>Enable note labels in piano roll</source> <translation type="unfinished"></translation> </message> <message> <source>Enable waveform display by default</source> <translation type="unfinished"></translation> </message> <message> <source>Keep effects running even without input</source> <translation type="unfinished"></translation> </message> <message> <source>Create backup file when saving a project</source> <translation type="unfinished"></translation> </message> <message> <source>LANGUAGE</source> <translation type="unfinished"></translation> </message> <message> <source>Paths</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS working directory</source> <translation type="unfinished"></translation> </message> <message> <source>VST-plugin directory</source> <translation type="unfinished"></translation> </message> <message> <source>Artwork directory</source> <translation type="unfinished"></translation> </message> <message> <source>Background artwork</source> <translation type="unfinished"></translation> </message> <message> <source>FL Studio installation directory</source> <translation type="unfinished"></translation> </message> <message> <source>LADSPA plugin paths</source> <translation type="unfinished"></translation> </message> <message> <source>STK rawwave directory</source> <translation type="unfinished"></translation> </message> <message> <source>Default Soundfont File</source> <translation type="unfinished"></translation> </message> <message> <source>Performance settings</source> <translation type="unfinished"></translation> </message> <message> <source>UI effects vs. performance</source> <translation type="unfinished"></translation> </message> <message> <source>Smooth scroll in Song Editor</source> <translation type="unfinished"></translation> </message> <message> <source>Enable auto save feature</source> <translation type="unfinished"></translation> </message> <message> <source>Show playback cursor in AudioFileProcessor</source> <translation type="unfinished"></translation> </message> <message> <source>Audio settings</source> <translation type="unfinished"></translation> </message> <message> <source>AUDIO INTERFACE</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI settings</source> <translation type="unfinished"></translation> </message> <message> <source>MIDI INTERFACE</source> <translation type="unfinished"></translation> </message> <message> <source>OK</source> <translation type="unfinished"></translation> </message> <message> <source>Cancel</source> <translation type="unfinished">لغو</translation> </message> <message> <source>Restart LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>Please note that most changes won&apos;t take effect until you restart LMMS!</source> <translation type="unfinished"></translation> </message> <message> <source>Frames: %1 Latency: %2 ms</source> <translation type="unfinished"></translation> </message> <message> <source>Here you can setup the internal buffer-size used by LMMS. Smaller values result in a lower latency but also may cause unusable sound or bad performance, especially on older computers or systems with a non-realtime kernel.</source> <translation type="unfinished"></translation> </message> <message> <source>Choose LMMS working directory</source> <translation type="unfinished"></translation> </message> <message> <source>Choose your VST-plugin directory</source> <translation type="unfinished"></translation> </message> <message> <source>Choose artwork-theme directory</source> <translation type="unfinished"></translation> </message> <message> <source>Choose FL Studio installation directory</source> <translation type="unfinished"></translation> </message> <message> <source>Choose LADSPA plugin directory</source> <translation type="unfinished"></translation> </message> <message> <source>Choose STK rawwave directory</source> <translation type="unfinished"></translation> </message> <message> <source>Choose default SoundFont</source> <translation type="unfinished"></translation> </message> <message> <source>Choose background artwork</source> <translation type="unfinished"></translation> </message> <message> <source>Here you can select your preferred audio-interface. Depending on the configuration of your system during compilation time you can choose between ALSA, JACK, OSS and more. Below you see a box which offers controls to setup the selected audio-interface.</source> <translation type="unfinished"></translation> </message> <message> <source>Here you can select your preferred MIDI-interface. Depending on the configuration of your system during compilation time you can choose between ALSA, OSS and more. Below you see a box which offers controls to setup the selected MIDI-interface.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Song</name> <message> <source>Tempo</source> <translation type="unfinished"></translation> </message> <message> <source>Master volume</source> <translation type="unfinished"></translation> </message> <message> <source>Master pitch</source> <translation type="unfinished"></translation> </message> <message> <source>Project saved</source> <translation type="unfinished"></translation> </message> <message> <source>The project %1 is now saved.</source> <translation type="unfinished"></translation> </message> <message> <source>Project NOT saved.</source> <translation type="unfinished">پروژه ذخیره نشد.</translation> </message> <message> <source>The project %1 was not saved!</source> <translation type="unfinished"></translation> </message> <message> <source>Import file</source> <translation type="unfinished">وارد کردن پرونده</translation> </message> <message> <source>MIDI sequences</source> <translation type="unfinished"></translation> </message> <message> <source>FL Studio projects</source> <translation type="unfinished"></translation> </message> <message> <source>Hydrogen projects</source> <translation type="unfinished"></translation> </message> <message> <source>All file types</source> <translation type="unfinished"></translation> </message> <message> <source>Empty project</source> <translation type="unfinished"></translation> </message> <message> <source>This project is empty so exporting makes no sense. Please put some items into Song Editor first!</source> <translation type="unfinished"></translation> </message> <message> <source>Select directory for writing exported tracks...</source> <translation type="unfinished"></translation> </message> <message> <source>untitled</source> <translation type="unfinished">بدون نام</translation> </message> <message> <source>Select file for project-export...</source> <translation type="unfinished">پرونده را برای استخراج پروژه مشخص کنید...</translation> </message> <message> <source>The following errors occured while loading: </source> <translation type="unfinished"></translation> </message> </context> <context> <name>SongEditor</name> <message> <source>Could not open file</source> <translation>پرونده باز نشد</translation> </message> <message> <source>Could not write file</source> <translation>پرونده نوشته نشد</translation> </message> <message> <source>Could not open file %1. You probably have no permissions to read this file. Please make sure to have at least read permissions to the file and try again.</source> <translation type="unfinished"></translation> </message> <message> <source>Error in file</source> <translation type="unfinished"></translation> </message> <message> <source>The file %1 seems to contain errors and therefore can&apos;t be loaded.</source> <translation type="unfinished"></translation> </message> <message> <source>Tempo</source> <translation type="unfinished"></translation> </message> <message> <source>TEMPO/BPM</source> <translation type="unfinished"></translation> </message> <message> <source>tempo of song</source> <translation type="unfinished">گام ترانه(tempo)</translation> </message> <message> <source>The tempo of a song is specified in beats per minute (BPM). If you want to change the tempo of your song, change this value. Every measure has four beats, so the tempo in BPM specifies, how many measures / 4 should be played within a minute (or how many measures should be played within four minutes).</source> <translation type="unfinished"></translation> </message> <message> <source>High quality mode</source> <translation type="unfinished"></translation> </message> <message> <source>Master volume</source> <translation type="unfinished"></translation> </message> <message> <source>master volume</source> <translation type="unfinished"></translation> </message> <message> <source>Master pitch</source> <translation type="unfinished"></translation> </message> <message> <source>master pitch</source> <translation type="unfinished">دانگ صدا(Pitch)</translation> </message> <message> <source>Value: %1%</source> <translation type="unfinished"></translation> </message> <message> <source>Value: %1 semitones</source> <translation type="unfinished"></translation> </message> <message> <source>Could not open %1 for writing. You probably are not permitted to write to this file. Please make sure you have write-access to the file and try again.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SongEditorWindow</name> <message> <source>Song-Editor</source> <translation type="unfinished">ویرایشگر ترانه</translation> </message> <message> <source>Play song (Space)</source> <translation type="unfinished">پخش ترانه(فاصله)</translation> </message> <message> <source>Record samples from Audio-device</source> <translation type="unfinished"></translation> </message> <message> <source>Record samples from Audio-device while playing song or BB track</source> <translation type="unfinished"></translation> </message> <message> <source>Stop song (Space)</source> <translation type="unfinished">توقف ترانه (فاصله)</translation> </message> <message> <source>Add beat/bassline</source> <translation type="unfinished">اضافه ی خط بم/تپش (beat/baseline)</translation> </message> <message> <source>Add sample-track</source> <translation type="unfinished">اضافه ی باریکه ی نمونه</translation> </message> <message> <source>Add automation-track</source> <translation type="unfinished"></translation> </message> <message> <source>Draw mode</source> <translation type="unfinished"></translation> </message> <message> <source>Edit mode (select and move)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to play your whole song. Playing will be started at the song-position-marker (green). You can also move it while playing.</source> <translation type="unfinished">اگر می خواهید تمام ترانه ی خود را پخش کنید اینجا را کلیک کنید.پخش از محل سازنده ی موقعیت شروع خواهد شد(سبز).همچنین می توانید در حال پخش آن را جابجا کنید.</translation> </message> <message> <source>Click here, if you want to stop playing of your song. The song-position-marker will be set to the start of your song.</source> <translation type="unfinished">اگر می خواهید پخش ترانه ی خود را متوقف کنید اینجا را کلیک کنید.سازنده موقعیت ترانه به شروع ترانه تنظیم خواهد شد.</translation> </message> </context> <context> <name>SpectrumAnalyzerControlDialog</name> <message> <source>Linear spectrum</source> <translation type="unfinished"></translation> </message> <message> <source>Linear Y axis</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SpectrumAnalyzerControls</name> <message> <source>Linear spectrum</source> <translation type="unfinished"></translation> </message> <message> <source>Linear Y axis</source> <translation type="unfinished"></translation> </message> <message> <source>Channel mode</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TabWidget</name> <message> <source>Settings for %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TempoSyncKnob</name> <message> <source>Tempo Sync</source> <translation type="unfinished"></translation> </message> <message> <source>No Sync</source> <translation type="unfinished"></translation> </message> <message> <source>Eight beats</source> <translation type="unfinished"></translation> </message> <message> <source>Whole note</source> <translation type="unfinished"></translation> </message> <message> <source>Half note</source> <translation type="unfinished"></translation> </message> <message> <source>Quarter note</source> <translation type="unfinished"></translation> </message> <message> <source>8th note</source> <translation type="unfinished"></translation> </message> <message> <source>16th note</source> <translation type="unfinished"></translation> </message> <message> <source>32nd note</source> <translation type="unfinished"></translation> </message> <message> <source>Custom...</source> <translation type="unfinished"></translation> </message> <message> <source>Custom </source> <translation type="unfinished"></translation> </message> <message> <source>Synced to Eight Beats</source> <translation type="unfinished"></translation> </message> <message> <source>Synced to Whole Note</source> <translation type="unfinished"></translation> </message> <message> <source>Synced to Half Note</source> <translation type="unfinished"></translation> </message> <message> <source>Synced to Quarter Note</source> <translation type="unfinished"></translation> </message> <message> <source>Synced to 8th Note</source> <translation type="unfinished"></translation> </message> <message> <source>Synced to 16th Note</source> <translation type="unfinished"></translation> </message> <message> <source>Synced to 32nd Note</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TimeDisplayWidget</name> <message> <source>click to change time units</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TimeLineWidget</name> <message> <source>Enable/disable auto-scrolling</source> <translation type="unfinished"></translation> </message> <message> <source>Enable/disable loop-points</source> <translation type="unfinished"></translation> </message> <message> <source>After stopping go back to begin</source> <translation type="unfinished"></translation> </message> <message> <source>After stopping go back to position at which playing was started</source> <translation type="unfinished"></translation> </message> <message> <source>After stopping keep position</source> <translation type="unfinished"></translation> </message> <message> <source>Hint</source> <translation type="unfinished"></translation> </message> <message> <source>Press &lt;Ctrl&gt; to disable magnetic loop points.</source> <translation type="unfinished"></translation> </message> <message> <source>Hold &lt;Shift&gt; to move the begin loop point; Press &lt;Ctrl&gt; to disable magnetic loop points.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Track</name> <message> <source>Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Solo</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TrackContainer</name> <message> <source>Couldn&apos;t import file</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t find a filter for importing file %1. You should convert this file into a format supported by LMMS using another software.</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t open file</source> <translation type="unfinished"></translation> </message> <message> <source>Couldn&apos;t open file %1 for reading. Please make sure you have read-permission to the file and the directory containing the file and try again!</source> <translation type="unfinished"></translation> </message> <message> <source>Loading project...</source> <translation type="unfinished">بارگذاری پروژه...</translation> </message> <message> <source>Cancel</source> <translation type="unfinished">لغو</translation> </message> <message> <source>Please wait...</source> <translation type="unfinished">لطفا صبر کنید...</translation> </message> <message> <source>Importing MIDI-file...</source> <translation type="unfinished">وارد کردن پرونده ی MIDI...</translation> </message> <message> <source>Importing FLP-file...</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TrackContentObject</name> <message> <source>Muted</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TrackContentObjectView</name> <message> <source>Current position</source> <translation type="unfinished"></translation> </message> <message> <source>Hint</source> <translation type="unfinished"></translation> </message> <message> <source>Press &lt;Ctrl&gt; and drag to make a copy.</source> <translation type="unfinished"></translation> </message> <message> <source>Current length</source> <translation type="unfinished"></translation> </message> <message> <source>Press &lt;Ctrl&gt; for free resizing.</source> <translation type="unfinished"></translation> </message> <message> <source>%1:%2 (%3:%4 to %5:%6)</source> <translation type="unfinished"></translation> </message> <message> <source>Delete (middle mousebutton)</source> <translation type="unfinished"></translation> </message> <message> <source>Cut</source> <translation type="unfinished">برش</translation> </message> <message> <source>Copy</source> <translation type="unfinished">کپی</translation> </message> <message> <source>Paste</source> <translation type="unfinished">چسباندن</translation> </message> <message> <source>Mute/unmute (&lt;Ctrl&gt; + middle click)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TrackOperationsWidget</name> <message> <source>Press &lt;Ctrl&gt; while clicking on move-grip to begin a new drag&apos;n&apos;drop-action.</source> <translation type="unfinished"></translation> </message> <message> <source>Actions for this track</source> <translation type="unfinished"></translation> </message> <message> <source>Mute</source> <translation type="unfinished"></translation> </message> <message> <source>Solo</source> <translation type="unfinished"></translation> </message> <message> <source>Mute this track</source> <translation type="unfinished"></translation> </message> <message> <source>Clone this track</source> <translation type="unfinished">تکثیر این تراک</translation> </message> <message> <source>Remove this track</source> <translation type="unfinished"></translation> </message> <message> <source>Clear this track</source> <translation type="unfinished"></translation> </message> <message> <source>FX %1: %2</source> <translation type="unfinished"></translation> </message> <message> <source>Turn all recording on</source> <translation type="unfinished"></translation> </message> <message> <source>Turn all recording off</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TripleOscillatorView</name> <message> <source>Use phase modulation for modulating oscillator 2 with oscillator 1</source> <translation type="unfinished"></translation> </message> <message> <source>Use amplitude modulation for modulating oscillator 2 with oscillator 1</source> <translation type="unfinished"></translation> </message> <message> <source>Mix output of oscillator 1 &amp; 2</source> <translation type="unfinished"></translation> </message> <message> <source>Synchronize oscillator 1 with oscillator 2</source> <translation type="unfinished"></translation> </message> <message> <source>Use frequency modulation for modulating oscillator 2 with oscillator 1</source> <translation type="unfinished"></translation> </message> <message> <source>Use phase modulation for modulating oscillator 3 with oscillator 2</source> <translation type="unfinished"></translation> </message> <message> <source>Use amplitude modulation for modulating oscillator 3 with oscillator 2</source> <translation type="unfinished"></translation> </message> <message> <source>Mix output of oscillator 2 &amp; 3</source> <translation type="unfinished"></translation> </message> <message> <source>Synchronize oscillator 2 with oscillator 3</source> <translation type="unfinished"></translation> </message> <message> <source>Use frequency modulation for modulating oscillator 3 with oscillator 2</source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 volume:</source> <translation type="unfinished">حجم نوسان ساز %1:</translation> </message> <message> <source>With this knob you can set the volume of oscillator %1. When setting a value of 0 the oscillator is turned off. Otherwise you can hear the oscillator as loud as you set it here.</source> <translation type="unfinished">با این دستگیره می توانید حجم نوسان ساز %1 را تنظیم کنید.هنگام تنظیم به ۰ ,نوسان ساز خاموش است.در غیر این صورت همان قدر که تنظیم کنید صدای نوسان سار را بلند خواهید شنید.</translation> </message> <message> <source>Osc %1 panning:</source> <translation type="unfinished">تراز نوسان ساز %1:</translation> </message> <message> <source>With this knob you can set the panning of the oscillator %1. A value of -100 means 100% left and a value of 100 moves oscillator-output right.</source> <translation type="unfinished">با این دستگیره می توانید تراز نوسان ساز %1 را تنظیم کنید.مقدار ۱۰۰- یعنی ۱۰۰٪ چپ و مقدار ۱۰۰ خروجی نوسان ساز را به راست منتقل می کند.</translation> </message> <message> <source>Osc %1 coarse detuning:</source> <translation type="unfinished">کوک زمختی نوسان ساز %1:</translation> </message> <message> <source>semitones</source> <translation type="unfinished"></translation> </message> <message> <source>With this knob you can set the coarse detuning of oscillator %1. You can detune the oscillator 24 semitones (2 octaves) up and down. This is useful for creating sounds with a chord.</source> <translation type="unfinished">با این دستگیره می توانید کوک زمختی نوسان ساز %1 را تنظیم کنید.شما می توانید کوک نوسان ساز را در ۱۲ نیم صدا (۱ نت) بالا یا پایین کنید. این برای ایجاد صدا به همراه زه (Chord) مفید خواهد بود.</translation> </message> <message> <source>Osc %1 fine detuning left:</source> <translation type="unfinished">کوک دقیق چپ نوسان ساز %1:</translation> </message> <message> <source>cents</source> <translation type="unfinished">درصد</translation> </message> <message> <source>With this knob you can set the fine detuning of oscillator %1 for the left channel. The fine-detuning is ranged between -100 cents and +100 cents. This is useful for creating &quot;fat&quot; sounds.</source> <translation type="unfinished">با این دستگیره می توانید کانال چپ نوسان ساز %1 را کوک دقیق کنید.کوک دقیق بین ۱۰۰- در صد و ۱۰۰ در صد محدود شده است.این برای ایجاد صدا های چاق (fat) مفید است.</translation> </message> <message> <source>Osc %1 fine detuning right:</source> <translation type="unfinished">کوک دقیق راست نوسان ساز %1:</translation> </message> <message> <source>With this knob you can set the fine detuning of oscillator %1 for the right channel. The fine-detuning is ranged between -100 cents and +100 cents. This is useful for creating &quot;fat&quot; sounds.</source> <translation type="unfinished">با این دستگیره می توانید کانال راست نوسان ساز %1 را کوک دقیق کنید.کوک دقیق بین ۱۰۰- در صد و ۱۰۰ در صد محدود شده است.این برای ایجاد صدا های چاق (fat) مفید است.</translation> </message> <message> <source>Osc %1 phase-offset:</source> <translation type="unfinished">انحراف فاز نوسان ساز %1:</translation> </message> <message> <source>degrees</source> <translation type="unfinished">درجه ها</translation> </message> <message> <source>With this knob you can set the phase-offset of oscillator %1. That means you can move the point within an oscillation where the oscillator begins to oscillate. For example if you have a sine-wave and have a phase-offset of 180 degrees the wave will first go down. It&apos;s the same with a square-wave.</source> <translation type="unfinished">با این دستگیره می توانید انحراف فاز نوسان ساز %1 را تنظیم کنید.این یعنی اینکه شما می توانید نقطه ی شروع نوسان نوسان ساز را جابجا کنید.برای مثال اگر یک موج سینوسی و انحراف فاز ۱۸۰ داشته باشید, موج در ابتدا به پایین می رود.برای موج مربعی نیز شبیه همین است.</translation> </message> <message> <source>Osc %1 stereo phase-detuning:</source> <translation type="unfinished">کوک فاز استریوی نوسان ساز %1:</translation> </message> <message> <source>With this knob you can set the stereo phase-detuning of oscillator %1. The stereo phase-detuning specifies the size of the difference between the phase-offset of left and right channel. This is very good for creating wide stereo sounds.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a sine-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a triangle-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a saw-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a square-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a moog-like saw-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use an exponential wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use white-noise for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a user-defined waveform for current oscillator.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VersionedSaveDialog</name> <message> <source>Increment version number</source> <translation type="unfinished"></translation> </message> <message> <source>Decrement version number</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VestigeInstrumentView</name> <message> <source>Open other VST-plugin</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to open another VST-plugin. After clicking on this button, a file-open-dialog appears and you can select your file.</source> <translation type="unfinished"></translation> </message> <message> <source>Show/hide GUI</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the graphical user interface (GUI) of your VST-plugin.</source> <translation type="unfinished"></translation> </message> <message> <source>Turn off all notes</source> <translation type="unfinished"></translation> </message> <message> <source>Open VST-plugin</source> <translation type="unfinished"></translation> </message> <message> <source>DLL-files (*.dll)</source> <translation type="unfinished"></translation> </message> <message> <source>EXE-files (*.exe)</source> <translation type="unfinished"></translation> </message> <message> <source>No VST-plugin loaded</source> <translation type="unfinished"></translation> </message> <message> <source>Control VST-plugin from LMMS host</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to control VST-plugin from host.</source> <translation type="unfinished"></translation> </message> <message> <source>Open VST-plugin preset</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to open another *.fxp, *.fxb VST-plugin preset.</source> <translation type="unfinished"></translation> </message> <message> <source>Previous (-)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to switch to another VST-plugin preset program.</source> <translation type="unfinished"></translation> </message> <message> <source>Save preset</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to save current VST-plugin preset program.</source> <translation type="unfinished"></translation> </message> <message> <source>Next (+)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to select presets that are currently loaded in VST.</source> <translation type="unfinished"></translation> </message> <message> <source>Preset</source> <translation type="unfinished"></translation> </message> <message> <source>by </source> <translation type="unfinished"></translation> </message> <message> <source> - VST plugin control</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VisualizationWidget</name> <message> <source>click to enable/disable visualization of master-output</source> <translation type="unfinished">برای فعال / غیرفعال کردن تصور خروجی اصلی کلیک کنید</translation> </message> <message> <source>Click to enable</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VstEffectControlDialog</name> <message> <source>Show/hide</source> <translation type="unfinished"></translation> </message> <message> <source>Control VST-plugin from LMMS host</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to control VST-plugin from host.</source> <translation type="unfinished"></translation> </message> <message> <source>Open VST-plugin preset</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to open another *.fxp, *.fxb VST-plugin preset.</source> <translation type="unfinished"></translation> </message> <message> <source>Previous (-)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to switch to another VST-plugin preset program.</source> <translation type="unfinished"></translation> </message> <message> <source>Next (+)</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to select presets that are currently loaded in VST.</source> <translation type="unfinished"></translation> </message> <message> <source>Save preset</source> <translation type="unfinished"></translation> </message> <message> <source>Click here, if you want to save current VST-plugin preset program.</source> <translation type="unfinished"></translation> </message> <message> <source>Effect by: </source> <translation type="unfinished"></translation> </message> <message> <source>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;</source> <translation type="unfinished"></translation> </message> </context> <context> <name>VstPlugin</name> <message> <source>Loading plugin</source> <translation type="unfinished"></translation> </message> <message> <source>Open Preset</source> <translation type="unfinished"></translation> </message> <message> <source>Vst Plugin Preset (*.fxp *.fxb)</source> <translation type="unfinished"></translation> </message> <message> <source>: default</source> <translation type="unfinished"></translation> </message> <message> <source>&quot;</source> <translation type="unfinished"></translation> </message> <message> <source>&apos;</source> <translation type="unfinished"></translation> </message> <message> <source>Save Preset</source> <translation type="unfinished"></translation> </message> <message> <source>.fxp</source> <translation type="unfinished"></translation> </message> <message> <source>.FXP</source> <translation type="unfinished"></translation> </message> <message> <source>.FXB</source> <translation type="unfinished"></translation> </message> <message> <source>.fxb</source> <translation type="unfinished"></translation> </message> <message> <source>Please wait while loading VST plugin...</source> <translation type="unfinished"></translation> </message> <message> <source>The VST plugin %1 could not be loaded.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>WatsynInstrument</name> <message> <source>Volume A1</source> <translation type="unfinished"></translation> </message> <message> <source>Volume A2</source> <translation type="unfinished"></translation> </message> <message> <source>Volume B1</source> <translation type="unfinished"></translation> </message> <message> <source>Volume B2</source> <translation type="unfinished"></translation> </message> <message> <source>Panning A1</source> <translation type="unfinished"></translation> </message> <message> <source>Panning A2</source> <translation type="unfinished"></translation> </message> <message> <source>Panning B1</source> <translation type="unfinished"></translation> </message> <message> <source>Panning B2</source> <translation type="unfinished"></translation> </message> <message> <source>Freq. multiplier A1</source> <translation type="unfinished"></translation> </message> <message> <source>Freq. multiplier A2</source> <translation type="unfinished"></translation> </message> <message> <source>Freq. multiplier B1</source> <translation type="unfinished"></translation> </message> <message> <source>Freq. multiplier B2</source> <translation type="unfinished"></translation> </message> <message> <source>Left detune A1</source> <translation type="unfinished"></translation> </message> <message> <source>Left detune A2</source> <translation type="unfinished"></translation> </message> <message> <source>Left detune B1</source> <translation type="unfinished"></translation> </message> <message> <source>Left detune B2</source> <translation type="unfinished"></translation> </message> <message> <source>Right detune A1</source> <translation type="unfinished"></translation> </message> <message> <source>Right detune A2</source> <translation type="unfinished"></translation> </message> <message> <source>Right detune B1</source> <translation type="unfinished"></translation> </message> <message> <source>Right detune B2</source> <translation type="unfinished"></translation> </message> <message> <source>A-B Mix</source> <translation type="unfinished"></translation> </message> <message> <source>A-B Mix envelope amount</source> <translation type="unfinished"></translation> </message> <message> <source>A-B Mix envelope attack</source> <translation type="unfinished"></translation> </message> <message> <source>A-B Mix envelope hold</source> <translation type="unfinished"></translation> </message> <message> <source>A-B Mix envelope decay</source> <translation type="unfinished"></translation> </message> <message> <source>A1-B2 Crosstalk</source> <translation type="unfinished"></translation> </message> <message> <source>A2-A1 modulation</source> <translation type="unfinished"></translation> </message> <message> <source>B2-B1 modulation</source> <translation type="unfinished"></translation> </message> <message> <source>Selected graph</source> <translation type="unfinished"></translation> </message> </context> <context> <name>WatsynView</name> <message> <source>Select oscillator A1</source> <translation type="unfinished"></translation> </message> <message> <source>Select oscillator A2</source> <translation type="unfinished"></translation> </message> <message> <source>Select oscillator B1</source> <translation type="unfinished"></translation> </message> <message> <source>Select oscillator B2</source> <translation type="unfinished"></translation> </message> <message> <source>Mix output of A2 to A1</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate amplitude of A1 with output of A2</source> <translation type="unfinished"></translation> </message> <message> <source>Ring-modulate A1 and A2</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate phase of A1 with output of A2</source> <translation type="unfinished"></translation> </message> <message> <source>Mix output of B2 to B1</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate amplitude of B1 with output of B2</source> <translation type="unfinished"></translation> </message> <message> <source>Ring-modulate B1 and B2</source> <translation type="unfinished"></translation> </message> <message> <source>Modulate phase of B1 with output of B2</source> <translation type="unfinished"></translation> </message> <message> <source>Draw your own waveform here by dragging your mouse on this graph.</source> <translation type="unfinished"></translation> </message> <message> <source>Load waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Click to load a waveform from a sample file</source> <translation type="unfinished"></translation> </message> <message> <source>Phase left</source> <translation type="unfinished"></translation> </message> <message> <source>Click to shift phase by -15 degrees</source> <translation type="unfinished"></translation> </message> <message> <source>Phase right</source> <translation type="unfinished"></translation> </message> <message> <source>Click to shift phase by +15 degrees</source> <translation type="unfinished"></translation> </message> <message> <source>Normalize</source> <translation type="unfinished"></translation> </message> <message> <source>Click to normalize</source> <translation type="unfinished"></translation> </message> <message> <source>Invert</source> <translation type="unfinished"></translation> </message> <message> <source>Click to invert</source> <translation type="unfinished"></translation> </message> <message> <source>Smooth</source> <translation type="unfinished"></translation> </message> <message> <source>Click to smooth</source> <translation type="unfinished"></translation> </message> <message> <source>Sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click for sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click for triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click for saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click for square wave</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ZynAddSubFxInstrument</name> <message> <source>Portamento</source> <translation type="unfinished"></translation> </message> <message> <source>Filter Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Filter Resonance</source> <translation type="unfinished"></translation> </message> <message> <source>Bandwidth</source> <translation type="unfinished"></translation> </message> <message> <source>FM Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance Center Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance Bandwidth</source> <translation type="unfinished"></translation> </message> <message> <source>Forward MIDI Control Change Events</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ZynAddSubFxView</name> <message> <source>Show GUI</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to show or hide the graphical user interface (GUI) of ZynAddSubFX.</source> <translation type="unfinished"></translation> </message> <message> <source>Portamento:</source> <translation type="unfinished"></translation> </message> <message> <source>PORT</source> <translation type="unfinished"></translation> </message> <message> <source>Filter Frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>FREQ</source> <translation type="unfinished"></translation> </message> <message> <source>Filter Resonance:</source> <translation type="unfinished"></translation> </message> <message> <source>RES</source> <translation type="unfinished"></translation> </message> <message> <source>Bandwidth:</source> <translation type="unfinished"></translation> </message> <message> <source>BW</source> <translation type="unfinished"></translation> </message> <message> <source>FM Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>FM GAIN</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance center frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>RES CF</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance bandwidth:</source> <translation type="unfinished"></translation> </message> <message> <source>RES BW</source> <translation type="unfinished"></translation> </message> <message> <source>Forward MIDI Control Changes</source> <translation type="unfinished"></translation> </message> </context> <context> <name>audioFileProcessor</name> <message> <source>Amplify</source> <translation>تقویت</translation> </message> <message> <source>Start of sample</source> <translation>شروع نمونه</translation> </message> <message> <source>End of sample</source> <translation>پایان نمونه</translation> </message> <message> <source>Reverse sample</source> <translation type="unfinished"></translation> </message> <message> <source>Stutter</source> <translation type="unfinished"></translation> </message> <message> <source>Loopback point</source> <translation type="unfinished"></translation> </message> <message> <source>Loop mode</source> <translation type="unfinished"></translation> </message> <message> <source>Interpolation mode</source> <translation type="unfinished"></translation> </message> <message> <source>None</source> <translation type="unfinished"></translation> </message> <message> <source>Linear</source> <translation type="unfinished"></translation> </message> <message> <source>Sinc</source> <translation type="unfinished"></translation> </message> <message> <source>Sample not found: %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>bitInvader</name> <message> <source>Samplelength</source> <translation type="unfinished"></translation> </message> </context> <context> <name>bitInvaderView</name> <message> <source>Sample Length</source> <translation type="unfinished"></translation> </message> <message> <source>Sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>White noise wave</source> <translation type="unfinished"></translation> </message> <message> <source>User defined wave</source> <translation type="unfinished"></translation> </message> <message> <source>Smooth</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to smooth waveform.</source> <translation type="unfinished"></translation> </message> <message> <source>Interpolation</source> <translation type="unfinished"></translation> </message> <message> <source>Normalize</source> <translation type="unfinished"></translation> </message> <message> <source>Draw your own waveform here by dragging your mouse on this graph.</source> <translation type="unfinished"></translation> </message> <message> <source>Click for a sine-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a triangle-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a saw-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a square-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for white-noise.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a user-defined shape.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>dynProcControlDialog</name> <message> <source>INPUT</source> <translation type="unfinished"></translation> </message> <message> <source>Input gain:</source> <translation type="unfinished"></translation> </message> <message> <source>OUTPUT</source> <translation type="unfinished"></translation> </message> <message> <source>Output gain:</source> <translation type="unfinished"></translation> </message> <message> <source>ATTACK</source> <translation type="unfinished"></translation> </message> <message> <source>Peak attack time:</source> <translation type="unfinished"></translation> </message> <message> <source>RELEASE</source> <translation type="unfinished"></translation> </message> <message> <source>Peak release time:</source> <translation type="unfinished"></translation> </message> <message> <source>Reset waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to reset the wavegraph back to default</source> <translation type="unfinished"></translation> </message> <message> <source>Smooth waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to apply smoothing to wavegraph</source> <translation type="unfinished"></translation> </message> <message> <source>Increase wavegraph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to increase wavegraph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Decrease wavegraph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to decrease wavegraph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Stereomode Maximum</source> <translation type="unfinished"></translation> </message> <message> <source>Process based on the maximum of both stereo channels</source> <translation type="unfinished"></translation> </message> <message> <source>Stereomode Average</source> <translation type="unfinished"></translation> </message> <message> <source>Process based on the average of both stereo channels</source> <translation type="unfinished"></translation> </message> <message> <source>Stereomode Unlinked</source> <translation type="unfinished"></translation> </message> <message> <source>Process each stereo channel independently</source> <translation type="unfinished"></translation> </message> </context> <context> <name>dynProcControls</name> <message> <source>Input gain</source> <translation type="unfinished"></translation> </message> <message> <source>Output gain</source> <translation type="unfinished"></translation> </message> <message> <source>Attack time</source> <translation type="unfinished"></translation> </message> <message> <source>Release time</source> <translation type="unfinished"></translation> </message> <message> <source>Stereo mode</source> <translation type="unfinished"></translation> </message> </context> <context> <name>graphModel</name> <message> <source>Graph</source> <translation type="unfinished"></translation> </message> </context> <context> <name>kickerInstrument</name> <message> <source>Start frequency</source> <translation type="unfinished"></translation> </message> <message> <source>End frequency</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Length</source> <translation type="unfinished"></translation> </message> <message> <source>Distortion Start</source> <translation type="unfinished"></translation> </message> <message> <source>Distortion End</source> <translation type="unfinished"></translation> </message> <message> <source>Envelope Slope</source> <translation type="unfinished"></translation> </message> <message> <source>Noise</source> <translation type="unfinished"></translation> </message> <message> <source>Click</source> <translation type="unfinished"></translation> </message> <message> <source>Frequency Slope</source> <translation type="unfinished"></translation> </message> <message> <source>Start from note</source> <translation type="unfinished"></translation> </message> <message> <source>End to note</source> <translation type="unfinished"></translation> </message> </context> <context> <name>kickerInstrumentView</name> <message> <source>Start frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>End frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Frequency Slope:</source> <translation type="unfinished"></translation> </message> <message> <source>Envelope Length:</source> <translation type="unfinished"></translation> </message> <message> <source>Envelope Slope:</source> <translation type="unfinished"></translation> </message> <message> <source>Click:</source> <translation type="unfinished"></translation> </message> <message> <source>Noise:</source> <translation type="unfinished"></translation> </message> <message> <source>Distortion Start:</source> <translation type="unfinished"></translation> </message> <message> <source>Distortion End:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ladspaBrowserView</name> <message> <source>Available Effects</source> <translation type="unfinished"></translation> </message> <message> <source>Unavailable Effects</source> <translation type="unfinished"></translation> </message> <message> <source>Instruments</source> <translation type="unfinished"></translation> </message> <message> <source>Analysis Tools</source> <translation type="unfinished"></translation> </message> <message> <source>Don&apos;t know</source> <translation type="unfinished"></translation> </message> <message> <source>This dialog displays information on all of the LADSPA plugins LMMS was able to locate. The plugins are divided into five categories based upon an interpretation of the port types and names. Available Effects are those that can be used by LMMS. In order for LMMS to be able to use an effect, it must, first and foremost, be an effect, which is to say, it has to have both input channels and output channels. LMMS identifies an input channel as an audio rate port containing &apos;in&apos; in the name. Output channels are identified by the letters &apos;out&apos;. Furthermore, the effect must have the same number of inputs and outputs and be real time capable. Unavailable Effects are those that were identified as effects, but either didn&apos;t have the same number of input and output channels or weren&apos;t real time capable. Instruments are plugins for which only output channels were identified. Analysis Tools are plugins for which only input channels were identified. Don&apos;t Knows are plugins for which no input or output channels were identified. Double clicking any of the plugins will bring up information on the ports.</source> <translation type="unfinished"></translation> </message> <message> <source>Type:</source> <translation type="unfinished">نوع:</translation> </message> </context> <context> <name>ladspaDescription</name> <message> <source>Plugins</source> <translation type="unfinished"></translation> </message> <message> <source>Description</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ladspaPortDialog</name> <message> <source>Ports</source> <translation type="unfinished"></translation> </message> <message> <source>Name</source> <translation type="unfinished"></translation> </message> <message> <source>Rate</source> <translation type="unfinished"></translation> </message> <message> <source>Direction</source> <translation type="unfinished"></translation> </message> <message> <source>Type</source> <translation type="unfinished"></translation> </message> <message> <source>Min &lt; Default &lt; Max</source> <translation type="unfinished"></translation> </message> <message> <source>Logarithmic</source> <translation type="unfinished"></translation> </message> <message> <source>SR Dependent</source> <translation type="unfinished"></translation> </message> <message> <source>Audio</source> <translation type="unfinished"></translation> </message> <message> <source>Control</source> <translation type="unfinished"></translation> </message> <message> <source>Input</source> <translation type="unfinished"></translation> </message> <message> <source>Output</source> <translation type="unfinished"></translation> </message> <message> <source>Toggled</source> <translation type="unfinished"></translation> </message> <message> <source>Integer</source> <translation type="unfinished"></translation> </message> <message> <source>Float</source> <translation type="unfinished"></translation> </message> <message> <source>Yes</source> <translation type="unfinished"></translation> </message> </context> <context> <name>lb302Synth</name> <message> <source>VCF Cutoff Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>VCF Resonance</source> <translation type="unfinished"></translation> </message> <message> <source>VCF Envelope Mod</source> <translation type="unfinished"></translation> </message> <message> <source>VCF Envelope Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Distortion</source> <translation type="unfinished"></translation> </message> <message> <source>Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Slide Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Slide</source> <translation type="unfinished"></translation> </message> <message> <source>Accent</source> <translation type="unfinished"></translation> </message> <message> <source>Dead</source> <translation type="unfinished"></translation> </message> <message> <source>24dB/oct Filter</source> <translation type="unfinished"></translation> </message> </context> <context> <name>lb302SynthView</name> <message> <source>Cutoff Freq:</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance:</source> <translation type="unfinished"></translation> </message> <message> <source>Env Mod:</source> <translation type="unfinished"></translation> </message> <message> <source>Decay:</source> <translation type="unfinished">محو شدن(Decay):</translation> </message> <message> <source>303-es-que, 24dB/octave, 3 pole filter</source> <translation type="unfinished"></translation> </message> <message> <source>Slide Decay:</source> <translation type="unfinished"></translation> </message> <message> <source>DIST:</source> <translation type="unfinished"></translation> </message> <message> <source>Saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a saw-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a triangle-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a square-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Rounded square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a square-wave with a rounded end.</source> <translation type="unfinished"></translation> </message> <message> <source>Moog wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for a moog-like wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click for a sine-wave.</source> <translation type="unfinished"></translation> </message> <message> <source>White noise wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for an exponential wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for white-noise.</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for bandlimited saw wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited square wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for bandlimited square wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for bandlimited triangle wave.</source> <translation type="unfinished"></translation> </message> <message> <source>Bandlimited moog saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Click here for bandlimited moog saw wave.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>lb303Synth</name> <message> <source>VCF Cutoff Frequency</source> <translation type="unfinished"></translation> </message> <message> <source>VCF Resonance</source> <translation type="unfinished"></translation> </message> <message> <source>VCF Envelope Mod</source> <translation type="unfinished"></translation> </message> <message> <source>VCF Envelope Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Distortion</source> <translation type="unfinished"></translation> </message> <message> <source>Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Slide Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Slide</source> <translation type="unfinished"></translation> </message> <message> <source>Accent</source> <translation type="unfinished"></translation> </message> <message> <source>Dead</source> <translation type="unfinished"></translation> </message> <message> <source>24dB/oct Filter</source> <translation type="unfinished"></translation> </message> </context> <context> <name>lb303SynthView</name> <message> <source>Cutoff Freq:</source> <translation type="unfinished"></translation> </message> <message> <source>CUT</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance:</source> <translation type="unfinished"></translation> </message> <message> <source>RES</source> <translation type="unfinished"></translation> </message> <message> <source>Env Mod:</source> <translation type="unfinished"></translation> </message> <message> <source>ENV MOD</source> <translation type="unfinished"></translation> </message> <message> <source>Decay:</source> <translation type="unfinished">محو شدن(Decay):</translation> </message> <message> <source>DEC</source> <translation type="unfinished"></translation> </message> <message> <source>303-es-que, 24dB/octave, 3 pole filter</source> <translation type="unfinished"></translation> </message> <message> <source>Slide Decay:</source> <translation type="unfinished"></translation> </message> <message> <source>SLIDE</source> <translation type="unfinished"></translation> </message> <message> <source>DIST:</source> <translation type="unfinished"></translation> </message> <message> <source>DIST</source> <translation type="unfinished"></translation> </message> <message> <source>WAVE:</source> <translation type="unfinished"></translation> </message> <message> <source>WAVE</source> <translation type="unfinished"></translation> </message> </context> <context> <name>malletsInstrument</name> <message> <source>Hardness</source> <translation type="unfinished"></translation> </message> <message> <source>Position</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrato Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrato Freq</source> <translation type="unfinished"></translation> </message> <message> <source>Stick Mix</source> <translation type="unfinished"></translation> </message> <message> <source>Modulator</source> <translation type="unfinished"></translation> </message> <message> <source>Crossfade</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Speed</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Depth</source> <translation type="unfinished"></translation> </message> <message> <source>ADSR</source> <translation type="unfinished"></translation> </message> <message> <source>Pressure</source> <translation type="unfinished"></translation> </message> <message> <source>Motion</source> <translation type="unfinished"></translation> </message> <message> <source>Speed</source> <translation type="unfinished"></translation> </message> <message> <source>Bowed</source> <translation type="unfinished"></translation> </message> <message> <source>Spread</source> <translation type="unfinished"></translation> </message> <message> <source>Marimba</source> <translation type="unfinished"></translation> </message> <message> <source>Vibraphone</source> <translation type="unfinished"></translation> </message> <message> <source>Agogo</source> <translation type="unfinished"></translation> </message> <message> <source>Wood1</source> <translation type="unfinished"></translation> </message> <message> <source>Reso</source> <translation type="unfinished"></translation> </message> <message> <source>Wood2</source> <translation type="unfinished"></translation> </message> <message> <source>Beats</source> <translation type="unfinished"></translation> </message> <message> <source>Two Fixed</source> <translation type="unfinished"></translation> </message> <message> <source>Clump</source> <translation type="unfinished"></translation> </message> <message> <source>Tubular Bells</source> <translation type="unfinished"></translation> </message> <message> <source>Uniform Bar</source> <translation type="unfinished"></translation> </message> <message> <source>Tuned Bar</source> <translation type="unfinished"></translation> </message> <message> <source>Glass</source> <translation type="unfinished"></translation> </message> <message> <source>Tibetan Bowl</source> <translation type="unfinished"></translation> </message> <message> <source>Missing files</source> <translation type="unfinished"></translation> </message> <message> <source>Your Stk-installation seems to be incomplete. Please make sure the full Stk-package is installed!</source> <translation type="unfinished"></translation> </message> </context> <context> <name>malletsInstrumentView</name> <message> <source>Instrument</source> <translation type="unfinished"></translation> </message> <message> <source>Spread</source> <translation type="unfinished"></translation> </message> <message> <source>Spread:</source> <translation type="unfinished"></translation> </message> <message> <source>Hardness</source> <translation type="unfinished"></translation> </message> <message> <source>Hardness:</source> <translation type="unfinished"></translation> </message> <message> <source>Position</source> <translation type="unfinished"></translation> </message> <message> <source>Position:</source> <translation type="unfinished"></translation> </message> <message> <source>Vib Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Vib Gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Vib Freq</source> <translation type="unfinished"></translation> </message> <message> <source>Vib Freq:</source> <translation type="unfinished"></translation> </message> <message> <source>Stick Mix</source> <translation type="unfinished"></translation> </message> <message> <source>Stick Mix:</source> <translation type="unfinished"></translation> </message> <message> <source>Modulator</source> <translation type="unfinished"></translation> </message> <message> <source>Modulator:</source> <translation type="unfinished"></translation> </message> <message> <source>Crossfade</source> <translation type="unfinished"></translation> </message> <message> <source>Crossfade:</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Speed</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Speed:</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Depth</source> <translation type="unfinished"></translation> </message> <message> <source>LFO Depth:</source> <translation type="unfinished"></translation> </message> <message> <source>ADSR</source> <translation type="unfinished"></translation> </message> <message> <source>ADSR:</source> <translation type="unfinished"></translation> </message> <message> <source>Bowed</source> <translation type="unfinished"></translation> </message> <message> <source>Pressure</source> <translation type="unfinished"></translation> </message> <message> <source>Pressure:</source> <translation type="unfinished"></translation> </message> <message> <source>Motion</source> <translation type="unfinished"></translation> </message> <message> <source>Motion:</source> <translation type="unfinished"></translation> </message> <message> <source>Speed</source> <translation type="unfinished"></translation> </message> <message> <source>Speed:</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrato</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrato:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>manageVSTEffectView</name> <message> <source> - VST parameter control</source> <translation type="unfinished"></translation> </message> <message> <source>VST Sync</source> <translation type="unfinished"></translation> </message> <message> <source>Click here if you want to synchronize all parameters with VST plugin.</source> <translation type="unfinished"></translation> </message> <message> <source>Automated</source> <translation type="unfinished"></translation> </message> <message> <source>Click here if you want to display automated parameters only.</source> <translation type="unfinished"></translation> </message> <message> <source> Close </source> <translation type="unfinished"></translation> </message> <message> <source>Close VST effect knob-controller window.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>manageVestigeInstrumentView</name> <message> <source> - VST plugin control</source> <translation type="unfinished"></translation> </message> <message> <source>VST Sync</source> <translation type="unfinished"></translation> </message> <message> <source>Click here if you want to synchronize all parameters with VST plugin.</source> <translation type="unfinished"></translation> </message> <message> <source>Automated</source> <translation type="unfinished"></translation> </message> <message> <source>Click here if you want to display automated parameters only.</source> <translation type="unfinished"></translation> </message> <message> <source> Close </source> <translation type="unfinished"></translation> </message> <message> <source>Close VST plugin knob-controller window.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>opl2instrument</name> <message> <source>Patch</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Attack</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Sustain</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Release</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Level</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Level Scaling</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Frequency Multiple</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Feedback</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Key Scaling Rate</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Percussive Envelope</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Tremolo</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Vibrato</source> <translation type="unfinished"></translation> </message> <message> <source>Op 1 Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Attack</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Decay</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Sustain</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Release</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Level</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Level Scaling</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Frequency Multiple</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Key Scaling Rate</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Percussive Envelope</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Tremolo</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Vibrato</source> <translation type="unfinished"></translation> </message> <message> <source>Op 2 Waveform</source> <translation type="unfinished"></translation> </message> <message> <source>FM</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrato Depth</source> <translation type="unfinished"></translation> </message> <message> <source>Tremolo Depth</source> <translation type="unfinished"></translation> </message> </context> <context> <name>organicInstrument</name> <message> <source>Distortion</source> <translation type="unfinished"></translation> </message> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> </context> <context> <name>organicInstrumentView</name> <message> <source>Distortion:</source> <translation type="unfinished"></translation> </message> <message> <source>Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>Randomise</source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 waveform:</source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 volume:</source> <translation type="unfinished">حجم نوسان ساز %1:</translation> </message> <message> <source>Osc %1 panning:</source> <translation type="unfinished">تراز نوسان ساز %1:</translation> </message> <message> <source>cents</source> <translation type="unfinished">درصد</translation> </message> <message> <source>The distortion knob adds distortion to the output of the instrument. </source> <translation type="unfinished"></translation> </message> <message> <source>The volume knob controls the volume of the output of the instrument. It is cumulative with the instrument window&apos;s volume control. </source> <translation type="unfinished"></translation> </message> <message> <source>The randomize button randomizes all knobs except the harmonics,main volume and distortion knobs. </source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 stereo detuning</source> <translation type="unfinished"></translation> </message> <message> <source>Osc %1 harmonic:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>papuInstrument</name> <message> <source>Sweep time</source> <translation type="unfinished"></translation> </message> <message> <source>Sweep direction</source> <translation type="unfinished"></translation> </message> <message> <source>Sweep RtShift amount</source> <translation type="unfinished"></translation> </message> <message> <source>Wave Pattern Duty</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 volume</source> <translation type="unfinished"></translation> </message> <message> <source>Volume sweep direction</source> <translation type="unfinished"></translation> </message> <message> <source>Length of each step in sweep</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 3 volume</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 volume</source> <translation type="unfinished"></translation> </message> <message> <source>Right Output level</source> <translation type="unfinished"></translation> </message> <message> <source>Left Output level</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 3 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 1 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 2 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 3 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel 4 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Treble</source> <translation type="unfinished"></translation> </message> <message> <source>Bass</source> <translation type="unfinished"></translation> </message> <message> <source>Shift Register width</source> <translation type="unfinished"></translation> </message> </context> <context> <name>papuInstrumentView</name> <message> <source>Sweep Time:</source> <translation type="unfinished"></translation> </message> <message> <source>Sweep Time</source> <translation type="unfinished"></translation> </message> <message> <source>Sweep RtShift amount:</source> <translation type="unfinished"></translation> </message> <message> <source>Sweep RtShift amount</source> <translation type="unfinished"></translation> </message> <message> <source>Wave pattern duty:</source> <translation type="unfinished"></translation> </message> <message> <source>Wave Pattern Duty</source> <translation type="unfinished"></translation> </message> <message> <source>Square Channel 1 Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>Length of each step in sweep:</source> <translation type="unfinished"></translation> </message> <message> <source>Length of each step in sweep</source> <translation type="unfinished"></translation> </message> <message> <source>Wave pattern duty</source> <translation type="unfinished"></translation> </message> <message> <source>Square Channel 2 Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>Square Channel 2 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Wave Channel Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>Wave Channel Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Noise Channel Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>Noise Channel Volume</source> <translation type="unfinished"></translation> </message> <message> <source>SO1 Volume (Right):</source> <translation type="unfinished"></translation> </message> <message> <source>SO1 Volume (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>SO2 Volume (Left):</source> <translation type="unfinished"></translation> </message> <message> <source>SO2 Volume (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Treble:</source> <translation type="unfinished"></translation> </message> <message> <source>Treble</source> <translation type="unfinished"></translation> </message> <message> <source>Bass:</source> <translation type="unfinished"></translation> </message> <message> <source>Bass</source> <translation type="unfinished"></translation> </message> <message> <source>Sweep Direction</source> <translation type="unfinished"></translation> </message> <message> <source>Volume Sweep Direction</source> <translation type="unfinished"></translation> </message> <message> <source>Shift Register Width</source> <translation type="unfinished"></translation> </message> <message> <source>Channel1 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel2 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel3 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel4 to SO1 (Right)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel1 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel2 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel3 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Channel4 to SO2 (Left)</source> <translation type="unfinished"></translation> </message> <message> <source>Wave Pattern</source> <translation type="unfinished"></translation> </message> <message> <source>The amount of increase or decrease in frequency</source> <translation type="unfinished"></translation> </message> <message> <source>The rate at which increase or decrease in frequency occurs</source> <translation type="unfinished"></translation> </message> <message> <source>The duty cycle is the ratio of the duration (time) that a signal is ON versus the total period of the signal.</source> <translation type="unfinished"></translation> </message> <message> <source>Square Channel 1 Volume</source> <translation type="unfinished"></translation> </message> <message> <source>The delay between step change</source> <translation type="unfinished"></translation> </message> <message> <source>Draw the wave here</source> <translation type="unfinished"></translation> </message> </context> <context> <name>pluginBrowser</name> <message> <source>no description</source> <translation type="unfinished"></translation> </message> <message> <source>Incomplete monophonic imitation tb303</source> <translation type="unfinished"></translation> </message> <message> <source>Plugin for freely manipulating stereo output</source> <translation type="unfinished"></translation> </message> <message> <source>Plugin for controlling knobs with sound peaks</source> <translation type="unfinished"></translation> </message> <message> <source>Plugin for enhancing stereo separation of a stereo input file</source> <translation type="unfinished"></translation> </message> <message> <source>List installed LADSPA plugins</source> <translation type="unfinished"></translation> </message> <message> <source>Filter for importing FL Studio projects into LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>GUS-compatible patch instrument</source> <translation type="unfinished"></translation> </message> <message> <source>Additive Synthesizer for organ-like sounds</source> <translation type="unfinished"></translation> </message> <message> <source>Tuneful things to bang on</source> <translation type="unfinished"></translation> </message> <message> <source>VST-host for using VST(i)-plugins within LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>Vibrating string modeler</source> <translation type="unfinished"></translation> </message> <message> <source>plugin for using arbitrary LADSPA-effects inside LMMS.</source> <translation type="unfinished"></translation> </message> <message> <source>Filter for importing MIDI-files into LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>Emulation of the MOS6581 and MOS8580 SID. This chip was used in the Commodore 64 computer.</source> <translation type="unfinished"></translation> </message> <message> <source>Player for SoundFont files</source> <translation type="unfinished"></translation> </message> <message> <source>Emulation of GameBoy (TM) APU</source> <translation type="unfinished"></translation> </message> <message> <source>Customizable wavetable synthesizer</source> <translation type="unfinished"></translation> </message> <message> <source>Embedded ZynAddSubFX</source> <translation type="unfinished"></translation> </message> <message> <source>2-operator FM Synth</source> <translation type="unfinished"></translation> </message> <message> <source>Filter for importing Hydrogen files into LMMS</source> <translation type="unfinished"></translation> </message> <message> <source>LMMS port of sfxr</source> <translation type="unfinished"></translation> </message> <message> <source>Monstrous 3-oscillator synth with modulation matrix</source> <translation type="unfinished"></translation> </message> <message> <source>Three powerful oscillators you can modulate in several ways</source> <translation type="unfinished"></translation> </message> <message> <source>A native amplifier plugin</source> <translation type="unfinished"></translation> </message> <message> <source>Carla Rack Instrument</source> <translation type="unfinished"></translation> </message> <message> <source>4-oscillator modulatable wavetable synth</source> <translation type="unfinished"></translation> </message> <message> <source>plugin for waveshaping</source> <translation type="unfinished"></translation> </message> <message> <source>Boost your bass the fast and simple way</source> <translation type="unfinished"></translation> </message> <message> <source>Versatile drum synthesizer</source> <translation type="unfinished"></translation> </message> <message> <source>Simple sampler with various settings for using samples (e.g. drums) in an instrument-track</source> <translation type="unfinished"></translation> </message> <message> <source>plugin for processing dynamics in a flexible way</source> <translation type="unfinished"></translation> </message> <message> <source>Carla Patchbay Instrument</source> <translation type="unfinished"></translation> </message> <message> <source>plugin for using arbitrary VST effects inside LMMS.</source> <translation type="unfinished"></translation> </message> <message> <source>Graphical spectrum analyzer plugin</source> <translation type="unfinished"></translation> </message> <message> <source>A NES-like synthesizer</source> <translation type="unfinished"></translation> </message> <message> <source>Player for GIG files</source> <translation type="unfinished"></translation> </message> <message> <source>A multitap echo delay plugin</source> <translation type="unfinished"></translation> </message> <message> <source>A native flanger plugin</source> <translation type="unfinished"></translation> </message> <message> <source>A native delay plugin</source> <translation type="unfinished"></translation> </message> <message> <source>An oversampling bitcrusher</source> <translation type="unfinished"></translation> </message> <message> <source>A native eq plugin</source> <translation type="unfinished"></translation> </message> <message> <source>A 4-band Crossover Equalizer</source> <translation type="unfinished"></translation> </message> </context> <context> <name>setupWidget</name> <message> <source>JACK (JACK Audio Connection Kit)</source> <translation type="unfinished"></translation> </message> <message> <source>OSS Raw-MIDI (Open Sound System)</source> <translation type="unfinished"></translation> </message> <message> <source>SDL (Simple DirectMedia Layer)</source> <translation type="unfinished"></translation> </message> <message> <source>PulseAudio</source> <translation type="unfinished"></translation> </message> <message> <source>Dummy (no MIDI support)</source> <translation type="unfinished"></translation> </message> <message> <source>ALSA Raw-MIDI (Advanced Linux Sound Architecture)</source> <translation type="unfinished"></translation> </message> <message> <source>PortAudio</source> <translation type="unfinished"></translation> </message> <message> <source>Dummy (no sound output)</source> <translation type="unfinished"></translation> </message> <message> <source>ALSA (Advanced Linux Sound Architecture)</source> <translation type="unfinished"></translation> </message> <message> <source>OSS (Open Sound System)</source> <translation type="unfinished"></translation> </message> <message> <source>WinMM MIDI</source> <translation type="unfinished"></translation> </message> <message> <source>ALSA-Sequencer (Advanced Linux Sound Architecture)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>sf2Instrument</name> <message> <source>Bank</source> <translation type="unfinished"></translation> </message> <message> <source>Patch</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Roomsize</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Damping</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Width</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Level</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Lines</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Level</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Speed</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Depth</source> <translation type="unfinished"></translation> </message> <message> <source>A soundfont %1 could not be loaded.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>sf2InstrumentView</name> <message> <source>Open other SoundFont file</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to open another SF2 file</source> <translation type="unfinished"></translation> </message> <message> <source>Choose the patch</source> <translation type="unfinished"></translation> </message> <message> <source>Gain</source> <translation type="unfinished"></translation> </message> <message> <source>Apply reverb (if supported)</source> <translation type="unfinished"></translation> </message> <message> <source>This button enables the reverb effect. This is useful for cool effects, but only works on files that support it.</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Roomsize:</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Damping:</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Width:</source> <translation type="unfinished"></translation> </message> <message> <source>Reverb Level:</source> <translation type="unfinished"></translation> </message> <message> <source>Apply chorus (if supported)</source> <translation type="unfinished"></translation> </message> <message> <source>This button enables the chorus effect. This is useful for cool echo effects, but only works on files that support it.</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Lines:</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Level:</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Speed:</source> <translation type="unfinished"></translation> </message> <message> <source>Chorus Depth:</source> <translation type="unfinished"></translation> </message> <message> <source>Open SoundFont file</source> <translation type="unfinished"></translation> </message> <message> <source>SoundFont2 Files (*.sf2)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>sfxrInstrument</name> <message> <source>Wave Form</source> <translation type="unfinished"></translation> </message> </context> <context> <name>sidInstrument</name> <message> <source>Cutoff</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance</source> <translation type="unfinished"></translation> </message> <message> <source>Filter type</source> <translation type="unfinished"></translation> </message> <message> <source>Voice 3 off</source> <translation type="unfinished"></translation> </message> <message> <source>Volume</source> <translation type="unfinished"></translation> </message> <message> <source>Chip model</source> <translation type="unfinished"></translation> </message> </context> <context> <name>sidInstrumentView</name> <message> <source>Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>Resonance:</source> <translation type="unfinished"></translation> </message> <message> <source>Cutoff frequency:</source> <translation type="unfinished"></translation> </message> <message> <source>High-Pass filter </source> <translation type="unfinished"></translation> </message> <message> <source>Band-Pass filter </source> <translation type="unfinished"></translation> </message> <message> <source>Low-Pass filter </source> <translation type="unfinished"></translation> </message> <message> <source>Voice3 Off </source> <translation type="unfinished"></translation> </message> <message> <source>MOS6581 SID </source> <translation type="unfinished"></translation> </message> <message> <source>MOS8580 SID </source> <translation type="unfinished"></translation> </message> <message> <source>Attack:</source> <translation type="unfinished">تهاجم(Attack):</translation> </message> <message> <source>Attack rate determines how rapidly the output of Voice %1 rises from zero to peak amplitude.</source> <translation type="unfinished"></translation> </message> <message> <source>Decay:</source> <translation type="unfinished">محو شدن(Decay):</translation> </message> <message> <source>Decay rate determines how rapidly the output falls from the peak amplitude to the selected Sustain level.</source> <translation type="unfinished"></translation> </message> <message> <source>Sustain:</source> <translation type="unfinished">تقویت(Sustain):</translation> </message> <message> <source>Output of Voice %1 will remain at the selected Sustain amplitude as long as the note is held.</source> <translation type="unfinished"></translation> </message> <message> <source>Release:</source> <translation type="unfinished">رهایی(Release):</translation> </message> <message> <source>The output of of Voice %1 will fall from Sustain amplitude to zero amplitude at the selected Release rate.</source> <translation type="unfinished"></translation> </message> <message> <source>Pulse Width:</source> <translation type="unfinished"></translation> </message> <message> <source>The Pulse Width resolution allows the width to be smoothly swept with no discernable stepping. The Pulse waveform on Oscillator %1 must be selected to have any audible effect.</source> <translation type="unfinished"></translation> </message> <message> <source>Coarse:</source> <translation type="unfinished"></translation> </message> <message> <source>The Coarse detuning allows to detune Voice %1 one octave up or down.</source> <translation type="unfinished"></translation> </message> <message> <source>Pulse Wave</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle Wave</source> <translation type="unfinished"></translation> </message> <message> <source>SawTooth</source> <translation type="unfinished"></translation> </message> <message> <source>Noise</source> <translation type="unfinished"></translation> </message> <message> <source>Sync</source> <translation type="unfinished"></translation> </message> <message> <source>Sync synchronizes the fundamental frequency of Oscillator %1 with the fundamental frequency of Oscillator %2 producing &quot;Hard Sync&quot; effects.</source> <translation type="unfinished"></translation> </message> <message> <source>Ring-Mod</source> <translation type="unfinished"></translation> </message> <message> <source>Ring-mod replaces the Triangle Waveform output of Oscillator %1 with a &quot;Ring Modulated&quot; combination of Oscillators %1 and %2.</source> <translation type="unfinished"></translation> </message> <message> <source>Filtered</source> <translation type="unfinished"></translation> </message> <message> <source>When Filtered is on, Voice %1 will be processed through the Filter. When Filtered is off, Voice %1 appears directly at the output, and the Filter has no effect on it.</source> <translation type="unfinished"></translation> </message> <message> <source>Test</source> <translation type="unfinished"></translation> </message> <message> <source>Test, when set, resets and locks Oscillator %1 at zero until Test is turned off.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>stereoEnhancerControlDialog</name> <message> <source>WIDE</source> <translation type="unfinished"></translation> </message> <message> <source>Width:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>stereoEnhancerControls</name> <message> <source>Width</source> <translation type="unfinished"></translation> </message> </context> <context> <name>stereoMatrixControlDialog</name> <message> <source>Left to Left Vol:</source> <translation type="unfinished"></translation> </message> <message> <source>Left to Right Vol:</source> <translation type="unfinished"></translation> </message> <message> <source>Right to Left Vol:</source> <translation type="unfinished"></translation> </message> <message> <source>Right to Right Vol:</source> <translation type="unfinished"></translation> </message> </context> <context> <name>stereoMatrixControls</name> <message> <source>Left to Left</source> <translation type="unfinished"></translation> </message> <message> <source>Left to Right</source> <translation type="unfinished"></translation> </message> <message> <source>Right to Left</source> <translation type="unfinished"></translation> </message> <message> <source>Right to Right</source> <translation type="unfinished"></translation> </message> </context> <context> <name>vestigeInstrument</name> <message> <source>Loading plugin</source> <translation type="unfinished"></translation> </message> <message> <source>Please wait while loading VST-plugin...</source> <translation type="unfinished"></translation> </message> </context> <context> <name>vibed</name> <message> <source>String %1 volume</source> <translation type="unfinished"></translation> </message> <message> <source>String %1 stiffness</source> <translation type="unfinished"></translation> </message> <message> <source>Pick %1 position</source> <translation type="unfinished"></translation> </message> <message> <source>Pickup %1 position</source> <translation type="unfinished"></translation> </message> <message> <source>Pan %1</source> <translation type="unfinished"></translation> </message> <message> <source>Detune %1</source> <translation type="unfinished"></translation> </message> <message> <source>Fuzziness %1 </source> <translation type="unfinished"></translation> </message> <message> <source>Length %1</source> <translation type="unfinished"></translation> </message> <message> <source>Impulse %1</source> <translation type="unfinished"></translation> </message> <message> <source>Octave %1</source> <translation type="unfinished"></translation> </message> </context> <context> <name>vibedView</name> <message> <source>Volume:</source> <translation type="unfinished"></translation> </message> <message> <source>The &apos;V&apos; knob sets the volume of the selected string.</source> <translation type="unfinished"></translation> </message> <message> <source>String stiffness:</source> <translation type="unfinished"></translation> </message> <message> <source>The &apos;S&apos; knob sets the stiffness of the selected string. The stiffness of the string affects how long the string will ring out. The lower the setting, the longer the string will ring.</source> <translation type="unfinished"></translation> </message> <message> <source>Pick position:</source> <translation type="unfinished">برگزیدن موقعیت:</translation> </message> <message> <source>The &apos;P&apos; knob sets the position where the selected string will be &apos;picked&apos;. The lower the setting the closer the pick is to the bridge.</source> <translation type="unfinished"></translation> </message> <message> <source>Pickup position:</source> <translation type="unfinished">برداشتن موقعیت:</translation> </message> <message> <source>The &apos;PU&apos; knob sets the position where the vibrations will be monitored for the selected string. The lower the setting, the closer the pickup is to the bridge.</source> <translation type="unfinished"></translation> </message> <message> <source>Pan:</source> <translation type="unfinished"></translation> </message> <message> <source>The Pan knob determines the location of the selected string in the stereo field.</source> <translation type="unfinished"></translation> </message> <message> <source>Detune:</source> <translation type="unfinished"></translation> </message> <message> <source>The Detune knob modifies the pitch of the selected string. Settings less than zero will cause the string to sound flat. Settings greater than zero will cause the string to sound sharp.</source> <translation type="unfinished"></translation> </message> <message> <source>Fuzziness:</source> <translation type="unfinished"></translation> </message> <message> <source>The Slap knob adds a bit of fuzz to the selected string which is most apparent during the attack, though it can also be used to make the string sound more &apos;metallic&apos;.</source> <translation type="unfinished"></translation> </message> <message> <source>Length:</source> <translation type="unfinished"></translation> </message> <message> <source>The Length knob sets the length of the selected string. Longer strings will both ring longer and sound brighter, however, they will also eat up more CPU cycles.</source> <translation type="unfinished"></translation> </message> <message> <source>Impulse or initial state</source> <translation type="unfinished"></translation> </message> <message> <source>The &apos;Imp&apos; selector determines whether the waveform in the graph is to be treated as an impulse imparted to the string by the pick or the initial state of the string.</source> <translation type="unfinished"></translation> </message> <message> <source>Octave</source> <translation type="unfinished"></translation> </message> <message> <source>The Octave selector is used to choose which harmonic of the note the string will ring at. For example, &apos;-2&apos; means the string will ring two octaves below the fundamental, &apos;F&apos; means the string will ring at the fundamental, and &apos;6&apos; means the string will ring six octaves above the fundamental.</source> <translation type="unfinished"></translation> </message> <message> <source>Impulse Editor</source> <translation type="unfinished"></translation> </message> <message> <source>The waveform editor provides control over the initial state or impulse that is used to start the string vibrating. The buttons to the right of the graph will initialize the waveform to the selected type. The &apos;?&apos; button will load a waveform from a file--only the first 128 samples will be loaded. The waveform can also be drawn in the graph. The &apos;S&apos; button will smooth the waveform. The &apos;N&apos; button will normalize the waveform.</source> <translation type="unfinished"></translation> </message> <message> <source>Vibed models up to nine independently vibrating strings. The &apos;String&apos; selector allows you to choose which string is being edited. The &apos;Imp&apos; selector chooses whether the graph represents an impulse or the initial state of the string. The &apos;Octave&apos; selector chooses which harmonic the string should vibrate at. The graph allows you to control the initial state or impulse used to set the string in motion. The &apos;V&apos; knob controls the volume. The &apos;S&apos; knob controls the string&apos;s stiffness. The &apos;P&apos; knob controls the pick position. The &apos;PU&apos; knob controls the pickup position. &apos;Pan&apos; and &apos;Detune&apos; hopefully don&apos;t need explanation. The &apos;Slap&apos; knob adds a bit of fuzz to the sound of the string. The &apos;Length&apos; knob controls the length of the string. The LED in the lower right corner of the waveform editor determines whether the string is active in the current instrument.</source> <translation type="unfinished"></translation> </message> <message> <source>Enable waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to enable/disable waveform.</source> <translation type="unfinished"></translation> </message> <message> <source>String</source> <translation type="unfinished"></translation> </message> <message> <source>The String selector is used to choose which string the controls are editing. A Vibed instrument can contain up to nine independently vibrating strings. The LED in the lower right corner of the waveform editor indicates whether the selected string is active.</source> <translation type="unfinished"></translation> </message> <message> <source>Sine wave</source> <translation type="unfinished"></translation> </message> <message> <source>Triangle wave</source> <translation type="unfinished"></translation> </message> <message> <source>Saw wave</source> <translation type="unfinished"></translation> </message> <message> <source>Square wave</source> <translation type="unfinished"></translation> </message> <message> <source>White noise wave</source> <translation type="unfinished"></translation> </message> <message> <source>User defined wave</source> <translation type="unfinished"></translation> </message> <message> <source>Smooth</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to smooth waveform.</source> <translation type="unfinished"></translation> </message> <message> <source>Normalize</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to normalize waveform.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a sine-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a triangle-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a saw-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a square-wave for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use white-noise for current oscillator.</source> <translation type="unfinished"></translation> </message> <message> <source>Use a user-defined waveform for current oscillator.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>voiceObject</name> <message> <source>Voice %1 pulse width</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 attack</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 decay</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 sustain</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 release</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 coarse detuning</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 wave shape</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 sync</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 ring modulate</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 filtered</source> <translation type="unfinished"></translation> </message> <message> <source>Voice %1 test</source> <translation type="unfinished"></translation> </message> </context> <context> <name>waveShaperControlDialog</name> <message> <source>INPUT</source> <translation type="unfinished"></translation> </message> <message> <source>Input gain:</source> <translation type="unfinished"></translation> </message> <message> <source>OUTPUT</source> <translation type="unfinished"></translation> </message> <message> <source>Output gain:</source> <translation type="unfinished"></translation> </message> <message> <source>Reset waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to reset the wavegraph back to default</source> <translation type="unfinished"></translation> </message> <message> <source>Smooth waveform</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to apply smoothing to wavegraph</source> <translation type="unfinished"></translation> </message> <message> <source>Increase graph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to increase wavegraph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Decrease graph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Click here to decrease wavegraph amplitude by 1dB</source> <translation type="unfinished"></translation> </message> <message> <source>Clip input</source> <translation type="unfinished"></translation> </message> <message> <source>Clip input signal to 0dB</source> <translation type="unfinished"></translation> </message> </context> <context> <name>waveShaperControls</name> <message> <source>Input gain</source> <translation type="unfinished"></translation> </message> <message> <source>Output gain</source> <translation type="unfinished"></translation> </message> </context> </TS>
DanielAeolusLaude/lmms
data/locale/fa.ts
TypeScript
gpl-2.0
324,101
/* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. ChibiOS/RT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ChibiOS/RT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ch.h" #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) /** * @brief PAL setup. * @details Digital I/O ports static configuration as defined in @p board.h. * This variable is used by the HAL when initializing the PAL driver. */ const PALConfig pal_default_config = { {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} }; #endif /** * @brief Early initialization code. * @details This initialization must be performed just after stack setup * and before any other initialization. */ void __early_init(void) { stm32_clock_init(); } #if HAL_USE_SDC || defined(__DOXYGEN__) /** * */ bool sdc_lld_is_write_protected(SDCDriver *sdcp) { (void)sdcp; return false; } /** * */ bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { (void)sdcp; return !palReadPad(GPIOB, GPIOB_SDIO_DETECT); } /** * @brief SDC card detection. */ #endif /* HAL_USE_SDC */ #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) /** * @brief MMC_SPI card detection. */ bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { (void)mmcp; /* TODO: Fill the implementation.*/ return true; } /** * @brief MMC_SPI card write protection detection. */ bool mmc_lld_is_write_protected(MMCDriver *mmcp) { (void)mmcp; /* TODO: Fill the implementation.*/ return false; } #endif /** * @brief Board-specific initialization code. * @todo Add your board-specific code, if any. */ void boardInit(void) { }
Pold87/paparazzi_clean
sw/airborne/boards/apogee/chibios-libopencm3/board.c
C
gpl-2.0
3,345
showWord(["","pratikan nan relijyon Vodou.<br>"])
georgejhunt/HaitiDictionary.activity
data/words/vodouyizan.js
JavaScript
gpl-2.0
49
# Seasonal forecasting of the polar stratosphere and its coupling with the troposphere # ## Figures and captions ## ![Time series of 10 hPa zonal-zonal mean zonal wind ($\overline{U}$) at 60$^{\circ}$S for GloSea5 hindcasts initialised near 1st August (a) and at 60$^{\circ}$N for hindcasts initialised near 1st November (b). The ERA-Interim mean over 1996-2009 (black line) and the GloSea5 mean over all ensemble members (blue dashed line) are shown, along with the interquartile range and range of all ensemble members. ](./figures/zm_winds.png) ![Time series of stratospheric polar vortex (60$^{\circ}$S/N, 10hPa) zonal-mean zonal wind anomalies, averaged over SON for the Southern Hemisphere (a) and DJF for the Northern Hemisphere (b). Dots indicate individual GloSea5 ensemble members, the thick black line the ensemble mean, and the thin red line ERA-Interim. The correlation of the GloSea5 ensemble mean and ERA-Interim is 0.74 in the SH and 0.16 in the NH. Also plotted in (a) is the polar cap (60-90$^{\circ}$S) SON mean total column ozone from ERA-Interim (blue dashed line).](./figures/seas_winds.png) ![(a) Variation with ensemble size (between 1-15) of GloSea ensemble mean correlation with ERA-Interim for stratospheric polar vortex $\overline{U}$ anomalies (thick lines), with a fitted theoretical distribution [Sardeshmukh et al., 2000] (thin lines) and its asymptote (dashed line). (b) Rank histogram of vortex wind anomalies, showing where observed values lie in the ensemble hindcasts.](./figures/ens_hist.png) ![Geopotential height at 10hPa at the central date (date at which Uat 60$^{\circ}$S, 10 hPa is at its minimum value) of the two GloSea5 ensemble members which simulate a SH SSW (a,b), and for ERA-Interim at the central date of the 2002 SSW (c). Units are km and the contour interval is 0.3 km.](./figures/sh_ssws.png) ![Time series of the SH final warming date at 10hPa in GloSea5 and ERA-Interim. The final warming date is defined as the date at which Uat 60$^{\circ}$S, 10hPa becomes negative for the last time. The correlation between the GloSea5 ensemble mean and ERA-Interim is 0.44 which is statistically significant at the 95% level. ](./figures/glosea_fw.png) ![SON mean Southern Annular Mode (SAM) index in individual GloSea5 ensemble members (dots), ensemble mean (black line) and ERA-Interim. The SAM is calculated from mean sea-level pressure data. The correlation of the ensemble mean and ERA-Interim values is 0.64, which is statistically significant at the 99% level.](./figures/sam.png) ![(a) Correlation of GloSea5 ensemble mean polar cap (60-90$^{\circ}$S) geopotential height anomalies ($Z'$) with ERA-Interim values, as a function of time and height for forecasts initialised near 1st August. (b) Correlation of ERA-Interim $Z'$ values with those predicted by the linear statistical model based on $Z'$ at 10 hPa on 15th August. $Z'$ values are smoothed using a 30 moving window. Grey shading indicates regions which not are greater than zero at the 95% confidence interval. The blue dashed line indicates the polar cap mean tropopause level from Wilcox et al., 2012.](./figures/glosea_linear_corr.png) ![Lag-height correlations of SH polar cap (60-90$^{\circ}$S) geopotential height anomalies (Z’) in ERA-Interim. $Z'$ values are smoothed with a 30-day running mean before calculating correlations. (a,b,c) Show correlations with $Z'$ at 10 hPa on the 1st of September, October and November respectively. (d,e,f) Show correlations with $Z'$ at 850 hPa. The blue dashed line indicates the polar cap mean tropopause level from Wilcox et al., 2012. ADD SIGNIFICANCE TESTS ](./figures/lag_corrs_SH_10hPa.png) ![ As Figure 8 but for the NH polar cap (60-90$^{\circ}$N), with correlations calculated from 1st December, January and February respectively. ADD SIGNIFICANCE TESTS \label{figure} ](./figures/lag_corrs_NH_DJF.png) This is a reference \ref{figure}
wseviour/glosea5-paper
figures.md
Markdown
gpl-2.0
3,927
package tutorial; /** * Main class that shows how to create your first working application. * * @author Maciej Spiechowicz */ public class Main { public static void main(String[] args) { // This line is responsible for printing a message System.out.println("Hello World!"); } }
MSpiechowicz/Programming
Java/Lesson01_HelloWorld/src/main/java/tutorial/Main.java
Java
gpl-2.0
310
<?php define('SHCMS_ENGINE',true); include_once('../engine/system/core.php'); $templates->template('SHCMS: Система'); echo engine::admin($users['group']); if($users['group'] == 15) { header('Location: ../admin.php'); exit; }
shcms5/shcms_engine
admin/index.php
PHP
gpl-2.0
249
/*****************************************************************************\ * proc_req.c - process incoming messages to slurmctld ***************************************************************************** * Copyright (C) 2002-2007 The Regents of the University of California. * Copyright (C) 2008-2011 Lawrence Livermore National Security. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Morris Jette <jette@llnl.gov>, et. al. * CODE-OCEC-09-009. All rights reserved. * * This file is part of SLURM, a resource management program. * For details, see <http://slurm.schedmd.com/>. * Please also read the included file: DISCLAIMER. * * SLURM is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * In addition, as a special exception, the copyright holders give permission * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than * OpenSSL. If you modify file(s) with this exception, you may extend this * exception to your version of the file(s), but you are not obligated to do * so. If you do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source files in * the program, then also delete it here. * * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with SLURM; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \*****************************************************************************/ #include "config.h" #include <errno.h> #include <pthread.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #if HAVE_SYS_PRCTL_H # include <sys/prctl.h> #endif #include "slurm/slurm_errno.h" #include "src/common/assoc_mgr.h" #include "src/common/checkpoint.h" #include "src/common/daemonize.h" #include "src/common/fd.h" #include "src/common/forward.h" #include "src/common/gres.h" #include "src/common/hostlist.h" #include "src/common/layouts_mgr.h" #include "src/common/log.h" #include "src/common/macros.h" #include "src/common/node_select.h" #include "src/common/pack.h" #include "src/common/read_config.h" #include "src/common/slurm_acct_gather.h" #include "src/common/slurm_auth.h" #include "src/common/slurm_cred.h" #include "src/common/slurm_ext_sensors.h" #include "src/common/slurm_priority.h" #include "src/common/slurm_protocol_api.h" #include "src/common/slurm_protocol_interface.h" #include "src/common/slurm_topology.h" #include "src/common/switch.h" #include "src/common/xstring.h" #include "src/slurmctld/agent.h" #include "src/slurmctld/burst_buffer.h" #include "src/slurmctld/fed_mgr.h" #include "src/slurmctld/front_end.h" #include "src/slurmctld/gang.h" #include "src/slurmctld/job_scheduler.h" #include "src/slurmctld/licenses.h" #include "src/slurmctld/locks.h" #include "src/slurmctld/power_save.h" #include "src/slurmctld/powercapping.h" #include "src/slurmctld/proc_req.h" #include "src/slurmctld/read_config.h" #include "src/slurmctld/reservation.h" #include "src/slurmctld/sched_plugin.h" #include "src/slurmctld/slurmctld.h" #include "src/slurmctld/srun_comm.h" #include "src/slurmctld/state_save.h" #include "src/slurmctld/trigger_mgr.h" #include "src/plugins/select/bluegene/bg_enums.h" static pthread_mutex_t rpc_mutex = PTHREAD_MUTEX_INITIALIZER; static int rpc_type_size = 0; /* Size of rpc_type_* arrays */ static uint16_t *rpc_type_id = NULL; static uint32_t *rpc_type_cnt = NULL; static uint64_t *rpc_type_time = NULL; static int rpc_user_size = 0; /* Size of rpc_user_* arrays */ static uint32_t *rpc_user_id = NULL; static uint32_t *rpc_user_cnt = NULL; static uint64_t *rpc_user_time = NULL; static pthread_mutex_t throttle_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t throttle_cond = PTHREAD_COND_INITIALIZER; static void _fill_ctld_conf(slurm_ctl_conf_t * build_ptr); static void _kill_job_on_msg_fail(uint32_t job_id); static int _is_prolog_finished(uint32_t job_id); static int _launch_batch_step(job_desc_msg_t *job_desc_msg, uid_t uid, uint32_t *step_id, uint16_t protocol_version); static int _make_step_cred(struct step_record *step_rec, slurm_cred_t **slurm_cred, uint16_t protocol_version); static void _throttle_fini(int *active_rpc_cnt); static void _throttle_start(int *active_rpc_cnt); inline static void _slurm_rpc_accounting_first_reg(slurm_msg_t *msg); inline static void _slurm_rpc_accounting_register_ctld(slurm_msg_t *msg); inline static void _slurm_rpc_accounting_update_msg(slurm_msg_t *msg); inline static void _slurm_rpc_allocate_resources(slurm_msg_t * msg); inline static void _slurm_rpc_block_info(slurm_msg_t * msg); inline static void _slurm_rpc_burst_buffer_info(slurm_msg_t * msg); inline static void _slurm_rpc_checkpoint(slurm_msg_t * msg); inline static void _slurm_rpc_checkpoint_comp(slurm_msg_t * msg); inline static void _slurm_rpc_checkpoint_task_comp(slurm_msg_t * msg); inline static void _slurm_rpc_delete_partition(slurm_msg_t * msg); inline static void _slurm_rpc_complete_job_allocation(slurm_msg_t * msg); inline static void _slurm_rpc_complete_batch_script(slurm_msg_t * msg, bool *run_scheduler, bool running_composite); inline static void _slurm_rpc_complete_prolog(slurm_msg_t * msg); inline static void _slurm_rpc_dump_conf(slurm_msg_t * msg); inline static void _slurm_rpc_dump_front_end(slurm_msg_t * msg); inline static void _slurm_rpc_dump_jobs(slurm_msg_t * msg); inline static void _slurm_rpc_dump_jobs_user(slurm_msg_t * msg); inline static void _slurm_rpc_dump_job_single(slurm_msg_t * msg); inline static void _slurm_rpc_dump_licenses(slurm_msg_t * msg); inline static void _slurm_rpc_dump_nodes(slurm_msg_t * msg); inline static void _slurm_rpc_dump_node_single(slurm_msg_t * msg); inline static void _slurm_rpc_dump_partitions(slurm_msg_t * msg); inline static void _slurm_rpc_dump_spank(slurm_msg_t * msg); inline static void _slurm_rpc_dump_stats(slurm_msg_t * msg); inline static void _slurm_rpc_end_time(slurm_msg_t * msg); inline static void _slurm_rpc_event_log(slurm_msg_t * msg); inline static void _slurm_rpc_epilog_complete(slurm_msg_t * msg, bool *run_scheduler, bool running_composite); inline static void _slurm_rpc_get_fed(slurm_msg_t *msg); inline static void _slurm_rpc_get_shares(slurm_msg_t *msg); inline static void _slurm_rpc_get_topo(slurm_msg_t * msg); inline static void _slurm_rpc_get_powercap(slurm_msg_t * msg); inline static void _slurm_rpc_get_priority_factors(slurm_msg_t *msg); inline static void _slurm_rpc_job_notify(slurm_msg_t * msg); inline static void _slurm_rpc_job_ready(slurm_msg_t * msg); inline static void _slurm_rpc_job_sbcast_cred(slurm_msg_t * msg); inline static void _slurm_rpc_job_step_kill(slurm_msg_t * msg); inline static void _slurm_rpc_job_step_create(slurm_msg_t * msg); inline static void _slurm_rpc_job_step_get_info(slurm_msg_t * msg); inline static void _slurm_rpc_job_will_run(slurm_msg_t * msg); inline static void _slurm_rpc_job_alloc_info(slurm_msg_t * msg); inline static void _slurm_rpc_job_alloc_info_lite(slurm_msg_t * msg); inline static void _slurm_rpc_kill_job2(slurm_msg_t *msg); inline static void _slurm_rpc_node_registration(slurm_msg_t *msg, bool running_composite); inline static void _slurm_rpc_ping(slurm_msg_t * msg); inline static void _slurm_rpc_reboot_nodes(slurm_msg_t * msg); inline static void _slurm_rpc_reconfigure_controller(slurm_msg_t * msg); inline static void _slurm_rpc_resv_create(slurm_msg_t * msg); inline static void _slurm_rpc_resv_update(slurm_msg_t * msg); inline static void _slurm_rpc_resv_delete(slurm_msg_t * msg); inline static void _slurm_rpc_resv_show(slurm_msg_t * msg); inline static void _slurm_rpc_layout_show(slurm_msg_t * msg); inline static void _slurm_rpc_requeue(slurm_msg_t * msg); inline static void _slurm_rpc_takeover(slurm_msg_t * msg); inline static void _slurm_rpc_set_debug_flags(slurm_msg_t *msg); inline static void _slurm_rpc_set_debug_level(slurm_msg_t *msg); inline static void _slurm_rpc_set_schedlog_level(slurm_msg_t *msg); inline static void _slurm_rpc_shutdown_controller(slurm_msg_t * msg); inline static void _slurm_rpc_shutdown_controller_immediate(slurm_msg_t * msg); inline static void _slurm_rpc_step_complete(slurm_msg_t * msg, bool running_composite); inline static void _slurm_rpc_step_layout(slurm_msg_t * msg); inline static void _slurm_rpc_step_update(slurm_msg_t * msg); inline static void _slurm_rpc_submit_batch_job(slurm_msg_t * msg); inline static void _slurm_rpc_suspend(slurm_msg_t * msg); inline static void _slurm_rpc_top_job(slurm_msg_t * msg); inline static void _slurm_rpc_trigger_clear(slurm_msg_t * msg); inline static void _slurm_rpc_trigger_get(slurm_msg_t * msg); inline static void _slurm_rpc_trigger_set(slurm_msg_t * msg); inline static void _slurm_rpc_trigger_pull(slurm_msg_t * msg); inline static void _slurm_rpc_update_front_end(slurm_msg_t * msg); inline static void _slurm_rpc_update_job(slurm_msg_t * msg); inline static void _slurm_rpc_update_node(slurm_msg_t * msg); inline static void _slurm_rpc_update_layout(slurm_msg_t * msg); inline static void _slurm_rpc_update_partition(slurm_msg_t * msg); inline static void _slurm_rpc_update_powercap(slurm_msg_t * msg); inline static void _slurm_rpc_update_block(slurm_msg_t * msg); inline static void _update_cred_key(void); static void _slurm_rpc_composite_msg(slurm_msg_t *msg); static void _slurm_rpc_comp_msg_list(composite_msg_t * comp_msg, bool *run_scheduler, List msg_list_in, struct timeval *start_tv, int timeout); static void _slurm_rpc_assoc_mgr_info(slurm_msg_t * msg); static void _set_persist_thread_name(connection_arg_t *arg); extern diag_stats_t slurmctld_diag_stats; /* * slurmctld_req - Process an individual RPC request * IN/OUT msg - the request message, data associated with the message is freed */ void slurmctld_req(slurm_msg_t *msg, connection_arg_t *arg) { DEF_TIMERS; int i, rpc_type_index = -1, rpc_user_index = -1; uint32_t rpc_uid; /* Just to validate the cred */ rpc_uid = (uint32_t) g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); if (g_slurm_auth_errno(msg->auth_cred) != SLURM_SUCCESS) { error("Bad authentication: %s", g_slurm_auth_errstr(g_slurm_auth_errno(msg->auth_cred))); return; } slurm_mutex_lock(&rpc_mutex); if (rpc_type_size == 0) { rpc_type_size = 100; /* Capture info for first 100 RPC types */ rpc_type_id = xmalloc(sizeof(uint16_t) * rpc_type_size); rpc_type_cnt = xmalloc(sizeof(uint32_t) * rpc_type_size); rpc_type_time = xmalloc(sizeof(uint64_t) * rpc_type_size); } for (i = 0; i < rpc_type_size; i++) { if (rpc_type_id[i] == 0) rpc_type_id[i] = msg->msg_type; else if (rpc_type_id[i] != msg->msg_type) continue; rpc_type_index = i; break; } if (rpc_user_size == 0) { rpc_user_size = 200; /* Capture info for first 200 RPC users */ rpc_user_id = xmalloc(sizeof(uint32_t) * rpc_user_size); rpc_user_cnt = xmalloc(sizeof(uint32_t) * rpc_user_size); rpc_user_time = xmalloc(sizeof(uint64_t) * rpc_user_size); } for (i = 0; i < rpc_user_size; i++) { if ((rpc_user_id[i] == 0) && (i != 0)) rpc_user_id[i] = rpc_uid; else if (rpc_user_id[i] != rpc_uid) continue; rpc_user_index = i; break; } slurm_mutex_unlock(&rpc_mutex); /* Debug the protocol layer. */ START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_PROTOCOL) { char *p; char inetbuf[64]; p = rpc_num2string(msg->msg_type); slurm_print_slurm_addr(&arg->cli_addr, inetbuf, sizeof(inetbuf)); info("%s: received opcode %s from %s", __func__, p, inetbuf); } switch (msg->msg_type) { case REQUEST_RESOURCE_ALLOCATION: _slurm_rpc_allocate_resources(msg); break; case REQUEST_BUILD_INFO: _slurm_rpc_dump_conf(msg); break; case REQUEST_JOB_INFO: _slurm_rpc_dump_jobs(msg); break; case REQUEST_JOB_USER_INFO: _slurm_rpc_dump_jobs_user(msg); break; case REQUEST_JOB_INFO_SINGLE: _slurm_rpc_dump_job_single(msg); break; case REQUEST_SHARE_INFO: _slurm_rpc_get_shares(msg); break; case REQUEST_PRIORITY_FACTORS: _slurm_rpc_get_priority_factors(msg); break; case REQUEST_JOB_END_TIME: _slurm_rpc_end_time(msg); break; case REQUEST_FED_INFO: _slurm_rpc_get_fed(msg); break; case REQUEST_FRONT_END_INFO: _slurm_rpc_dump_front_end(msg); break; case REQUEST_NODE_INFO: _slurm_rpc_dump_nodes(msg); break; case REQUEST_NODE_INFO_SINGLE: _slurm_rpc_dump_node_single(msg); break; case REQUEST_PARTITION_INFO: _slurm_rpc_dump_partitions(msg); break; case MESSAGE_EPILOG_COMPLETE: i = 0; _slurm_rpc_epilog_complete(msg, (bool *)&i, 0); break; case REQUEST_CANCEL_JOB_STEP: _slurm_rpc_job_step_kill(msg); break; case REQUEST_COMPLETE_JOB_ALLOCATION: _slurm_rpc_complete_job_allocation(msg); break; case REQUEST_COMPLETE_PROLOG: _slurm_rpc_complete_prolog(msg); break; case REQUEST_COMPLETE_BATCH_JOB: case REQUEST_COMPLETE_BATCH_SCRIPT: i = 0; _slurm_rpc_complete_batch_script(msg, (bool *)&i, 0); break; case REQUEST_JOB_STEP_CREATE: _slurm_rpc_job_step_create(msg); break; case REQUEST_JOB_STEP_INFO: _slurm_rpc_job_step_get_info(msg); break; case REQUEST_JOB_WILL_RUN: _slurm_rpc_job_will_run(msg); break; case MESSAGE_NODE_REGISTRATION_STATUS: _slurm_rpc_node_registration(msg, 0); break; case REQUEST_JOB_ALLOCATION_INFO: _slurm_rpc_job_alloc_info(msg); break; case REQUEST_JOB_ALLOCATION_INFO_LITE: _slurm_rpc_job_alloc_info_lite(msg); break; case REQUEST_JOB_SBCAST_CRED: _slurm_rpc_job_sbcast_cred(msg); break; case REQUEST_PING: _slurm_rpc_ping(msg); break; case REQUEST_RECONFIGURE: _slurm_rpc_reconfigure_controller(msg); break; case REQUEST_CONTROL: _slurm_rpc_shutdown_controller(msg); break; case REQUEST_TAKEOVER: _slurm_rpc_takeover(msg); break; case REQUEST_SHUTDOWN: _slurm_rpc_shutdown_controller(msg); break; case REQUEST_SHUTDOWN_IMMEDIATE: _slurm_rpc_shutdown_controller_immediate(msg); break; case REQUEST_SUBMIT_BATCH_JOB: _slurm_rpc_submit_batch_job(msg); break; case REQUEST_UPDATE_FRONT_END: _slurm_rpc_update_front_end(msg); break; case REQUEST_UPDATE_JOB: _slurm_rpc_update_job(msg); break; case REQUEST_UPDATE_NODE: _slurm_rpc_update_node(msg); break; case REQUEST_UPDATE_LAYOUT: _slurm_rpc_update_layout(msg); break; case REQUEST_CREATE_PARTITION: case REQUEST_UPDATE_PARTITION: _slurm_rpc_update_partition(msg); break; case REQUEST_UPDATE_POWERCAP: _slurm_rpc_update_powercap(msg); break; case REQUEST_DELETE_PARTITION: _slurm_rpc_delete_partition(msg); break; case REQUEST_CREATE_RESERVATION: _slurm_rpc_resv_create(msg); break; case REQUEST_UPDATE_RESERVATION: _slurm_rpc_resv_update(msg); break; case REQUEST_DELETE_RESERVATION: _slurm_rpc_resv_delete(msg); break; case REQUEST_UPDATE_BLOCK: _slurm_rpc_update_block(msg); break; case REQUEST_RESERVATION_INFO: _slurm_rpc_resv_show(msg); break; case REQUEST_LAYOUT_INFO: _slurm_rpc_layout_show(msg); break; case REQUEST_NODE_REGISTRATION_STATUS: error("slurmctld is talking with itself. " "SlurmctldPort == SlurmdPort"); slurm_send_rc_msg(msg, EINVAL); break; case REQUEST_CHECKPOINT: _slurm_rpc_checkpoint(msg); break; case REQUEST_CHECKPOINT_COMP: _slurm_rpc_checkpoint_comp(msg); break; case REQUEST_CHECKPOINT_TASK_COMP: _slurm_rpc_checkpoint_task_comp(msg); break; case REQUEST_SUSPEND: _slurm_rpc_suspend(msg); break; case REQUEST_TOP_JOB: _slurm_rpc_top_job(msg); break; case REQUEST_JOB_REQUEUE: _slurm_rpc_requeue(msg); break; case REQUEST_JOB_READY: _slurm_rpc_job_ready(msg); break; case REQUEST_BLOCK_INFO: _slurm_rpc_block_info(msg); break; case REQUEST_BURST_BUFFER_INFO: _slurm_rpc_burst_buffer_info(msg); break; case REQUEST_STEP_COMPLETE: _slurm_rpc_step_complete(msg, 0); break; case REQUEST_STEP_LAYOUT: _slurm_rpc_step_layout(msg); break; case REQUEST_UPDATE_JOB_STEP: _slurm_rpc_step_update(msg); break; case REQUEST_TRIGGER_SET: _slurm_rpc_trigger_set(msg); break; case REQUEST_TRIGGER_GET: _slurm_rpc_trigger_get(msg); break; case REQUEST_TRIGGER_CLEAR: _slurm_rpc_trigger_clear(msg); break; case REQUEST_TRIGGER_PULL: _slurm_rpc_trigger_pull(msg); break; case REQUEST_JOB_NOTIFY: _slurm_rpc_job_notify(msg); break; case REQUEST_SET_DEBUG_FLAGS: _slurm_rpc_set_debug_flags(msg); break; case REQUEST_SET_DEBUG_LEVEL: _slurm_rpc_set_debug_level(msg); break; case REQUEST_SET_SCHEDLOG_LEVEL: _slurm_rpc_set_schedlog_level(msg); break; case ACCOUNTING_UPDATE_MSG: _slurm_rpc_accounting_update_msg(msg); break; case ACCOUNTING_FIRST_REG: _slurm_rpc_accounting_first_reg(msg); break; case ACCOUNTING_REGISTER_CTLD: _slurm_rpc_accounting_register_ctld(msg); break; case REQUEST_TOPO_INFO: _slurm_rpc_get_topo(msg); break; case REQUEST_POWERCAP_INFO: _slurm_rpc_get_powercap(msg); break; case REQUEST_SPANK_ENVIRONMENT: _slurm_rpc_dump_spank(msg); break; case REQUEST_REBOOT_NODES: _slurm_rpc_reboot_nodes(msg); break; case REQUEST_STATS_INFO: _slurm_rpc_dump_stats(msg); break; case REQUEST_LICENSE_INFO: _slurm_rpc_dump_licenses(msg); break; case REQUEST_KILL_JOB: _slurm_rpc_kill_job2(msg); break; case MESSAGE_COMPOSITE: _slurm_rpc_composite_msg(msg); break; case REQUEST_ASSOC_MGR_INFO: _slurm_rpc_assoc_mgr_info(msg); break; case REQUEST_PERSIST_INIT: arg->persist = true; _set_persist_thread_name(arg); slurm_send_rc_msg(msg, SLURM_SUCCESS); break; case REQUEST_PERSIST_FINI: arg->persist = false; slurm_send_rc_msg(msg, SLURM_SUCCESS); break; case REQUEST_EVENT_LOG: _slurm_rpc_event_log(msg); break; default: error("invalid RPC msg_type=%u", msg->msg_type); slurm_send_rc_msg(msg, EINVAL); break; } END_TIMER; slurm_mutex_lock(&rpc_mutex); if (rpc_type_index >= 0) { rpc_type_cnt[rpc_type_index]++; rpc_type_time[rpc_type_index] += DELTA_TIMER; } if (rpc_user_index >= 0) { rpc_user_cnt[rpc_user_index]++; rpc_user_time[rpc_user_index] += DELTA_TIMER; } slurm_mutex_unlock(&rpc_mutex); } static void _set_persist_thread_name(connection_arg_t *arg) { #if HAVE_SYS_PRCTL_H if (slurmctld_conf.debug_flags & DEBUG_FLAG_FEDR) { #ifdef NYI char *s_name = NULL; #endif char ip[16]; uint16_t port = 0; slurm_get_ip_str(&arg->cli_addr, &port, ip, sizeof(ip)); #ifndef NYI if (prctl(PR_SET_NAME, ip, NULL, NULL, NULL) < 0) error("%s: cannot set my name to %s %m", __func__, ip); #else /* Trying to get the name of the sibling causes contention for the fed_mgr_lock * when using the ping_thread. e.g. One cluster tries to establish a persistent * connection with another cluster and at the same time the other cluster is in * the middle of the pinging the other cluster -- which has the lock. The * persistent connection request can't set the service connection's thread name * until the ping thread release the lock. If/when the ping thread is removed * this may be able to used again. */ if ((s_name = fed_mgr_find_sibling_name_by_ip(ip))) { char tmp_name[16]; snprintf(tmp_name, sizeof(tmp_name), "sib-%s", s_name); if (prctl(PR_SET_NAME, tmp_name, NULL, NULL, NULL) < 0) error("%s: cannot set my name to %s %m", __func__, tmp_name); xfree(s_name); } else error("Didn't find fed sibling by ip '%s'", ip); #endif } #endif } /* These functions prevent certain RPCs from keeping the slurmctld write locks * constantly set, which can prevent other RPCs and system functions from being * processed. For example, a steady stream of batch submissions can prevent * squeue from responding or jobs from being scheduled. */ static void _throttle_start(int *active_rpc_cnt) { slurm_mutex_lock(&throttle_mutex); while (1) { if (*active_rpc_cnt == 0) { (*active_rpc_cnt)++; break; } #if 1 slurm_cond_wait(&throttle_cond, &throttle_mutex); #else /* While an RPC is being throttled due to a running RPC of the * same type, do not count that thread against the daemon's * thread limit. In extreme environments, this logic can result * in the slurmctld spawning so many pthreads that it exhausts * system resources and fails. */ server_thread_decr(); slurm_cond_wait(&throttle_cond, &throttle_mutex); server_thread_incr(); #endif } slurm_mutex_unlock(&throttle_mutex); if (LOTS_OF_AGENTS) usleep(1000); else usleep(1); } static void _throttle_fini(int *active_rpc_cnt) { slurm_mutex_lock(&throttle_mutex); (*active_rpc_cnt)--; slurm_cond_broadcast(&throttle_cond); slurm_mutex_unlock(&throttle_mutex); } /* * _fill_ctld_conf - make a copy of current slurm configuration * this is done with locks set so the data can change at other times * OUT conf_ptr - place to copy configuration to */ static void _fill_ctld_conf(slurm_ctl_conf_t * conf_ptr) { char *licenses_used = get_licenses_used(); /* Do before config lock */ slurm_ctl_conf_t *conf = slurm_conf_lock(); memset(conf_ptr, 0, sizeof(slurm_ctl_conf_t)); conf_ptr->last_update = time(NULL); conf_ptr->accounting_storage_enforce = conf->accounting_storage_enforce; conf_ptr->accounting_storage_host = xstrdup(conf->accounting_storage_host); conf_ptr->accounting_storage_backup_host = xstrdup(conf->accounting_storage_backup_host); conf_ptr->accounting_storage_loc = xstrdup(conf->accounting_storage_loc); conf_ptr->accounting_storage_port = conf->accounting_storage_port; conf_ptr->accounting_storage_tres = xstrdup(conf->accounting_storage_tres); conf_ptr->accounting_storage_type = xstrdup(conf->accounting_storage_type); conf_ptr->accounting_storage_user = xstrdup(conf->accounting_storage_user); conf_ptr->acctng_store_job_comment = conf->acctng_store_job_comment; conf_ptr->acct_gather_conf = acct_gather_conf_values(); conf_ptr->acct_gather_energy_type = xstrdup(conf->acct_gather_energy_type); conf_ptr->acct_gather_filesystem_type = xstrdup(conf->acct_gather_filesystem_type); conf_ptr->acct_gather_infiniband_type = xstrdup(conf->acct_gather_infiniband_type); conf_ptr->acct_gather_profile_type = xstrdup(conf->acct_gather_profile_type); conf_ptr->acct_gather_node_freq = conf->acct_gather_node_freq; conf_ptr->authinfo = xstrdup(conf->authinfo); conf_ptr->authtype = xstrdup(conf->authtype); conf_ptr->backup_addr = xstrdup(conf->backup_addr); conf_ptr->backup_controller = xstrdup(conf->backup_controller); conf_ptr->batch_start_timeout = conf->batch_start_timeout; conf_ptr->boot_time = slurmctld_config.boot_time; conf_ptr->bb_type = xstrdup(conf->bb_type); conf_ptr->checkpoint_type = xstrdup(conf->checkpoint_type); conf_ptr->chos_loc = xstrdup(conf->chos_loc); conf_ptr->cluster_name = xstrdup(conf->cluster_name); conf_ptr->complete_wait = conf->complete_wait; conf_ptr->control_addr = xstrdup(conf->control_addr); conf_ptr->control_machine = xstrdup(conf->control_machine); conf_ptr->core_spec_plugin = xstrdup(conf->core_spec_plugin); conf_ptr->cpu_freq_def = conf->cpu_freq_def; conf_ptr->cpu_freq_govs = conf->cpu_freq_govs; conf_ptr->crypto_type = xstrdup(conf->crypto_type); conf_ptr->def_mem_per_cpu = conf->def_mem_per_cpu; conf_ptr->debug_flags = conf->debug_flags; conf_ptr->disable_root_jobs = conf->disable_root_jobs; conf_ptr->eio_timeout = conf->eio_timeout; conf_ptr->enforce_part_limits = conf->enforce_part_limits; conf_ptr->epilog = xstrdup(conf->epilog); conf_ptr->epilog_msg_time = conf->epilog_msg_time; conf_ptr->epilog_slurmctld = xstrdup(conf->epilog_slurmctld); ext_sensors_g_get_config(&conf_ptr->ext_sensors_conf); conf_ptr->ext_sensors_type = xstrdup(conf->ext_sensors_type); conf_ptr->ext_sensors_freq = conf->ext_sensors_freq; conf_ptr->fast_schedule = conf->fast_schedule; conf_ptr->first_job_id = conf->first_job_id; conf_ptr->fs_dampening_factor = conf->fs_dampening_factor; conf_ptr->gres_plugins = xstrdup(conf->gres_plugins); conf_ptr->group_info = conf->group_info; conf_ptr->inactive_limit = conf->inactive_limit; conf_ptr->hash_val = conf->hash_val; conf_ptr->health_check_interval = conf->health_check_interval; conf_ptr->health_check_node_state = conf->health_check_node_state; conf_ptr->health_check_program = xstrdup(conf->health_check_program); conf_ptr->job_acct_gather_freq = xstrdup(conf->job_acct_gather_freq); conf_ptr->job_acct_gather_type = xstrdup(conf->job_acct_gather_type); conf_ptr->job_acct_gather_params= xstrdup(conf->job_acct_gather_params); conf_ptr->job_ckpt_dir = xstrdup(conf->job_ckpt_dir); conf_ptr->job_comp_host = xstrdup(conf->job_comp_host); conf_ptr->job_comp_loc = xstrdup(conf->job_comp_loc); conf_ptr->job_comp_port = conf->job_comp_port; conf_ptr->job_comp_type = xstrdup(conf->job_comp_type); conf_ptr->job_comp_user = xstrdup(conf->job_comp_user); conf_ptr->job_container_plugin = xstrdup(conf->job_container_plugin); conf_ptr->job_credential_private_key = xstrdup(conf->job_credential_private_key); conf_ptr->job_credential_public_certificate = xstrdup(conf->job_credential_public_certificate); conf_ptr->job_file_append = conf->job_file_append; conf_ptr->job_requeue = conf->job_requeue; conf_ptr->job_submit_plugins = xstrdup(conf->job_submit_plugins); conf_ptr->get_env_timeout = conf->get_env_timeout; conf_ptr->keep_alive_time = conf->keep_alive_time; conf_ptr->kill_wait = conf->kill_wait; conf_ptr->kill_on_bad_exit = conf->kill_on_bad_exit; conf_ptr->launch_params = xstrdup(conf->launch_params); conf_ptr->launch_type = xstrdup(conf->launch_type); conf_ptr->layouts = xstrdup(conf->layouts); conf_ptr->licenses = xstrdup(conf->licenses); conf_ptr->licenses_used = licenses_used; conf_ptr->log_fmt = conf->log_fmt; conf_ptr->mail_prog = xstrdup(conf->mail_prog); conf_ptr->max_array_sz = conf->max_array_sz; conf_ptr->max_job_cnt = conf->max_job_cnt; conf_ptr->max_job_id = conf->max_job_id; conf_ptr->max_mem_per_cpu = conf->max_mem_per_cpu; conf_ptr->max_step_cnt = conf->max_step_cnt; conf_ptr->max_tasks_per_node = conf->max_tasks_per_node; conf_ptr->mcs_plugin = xstrdup(conf->mcs_plugin); conf_ptr->mcs_plugin_params = xstrdup(conf->mcs_plugin_params); conf_ptr->mem_limit_enforce = conf->mem_limit_enforce; conf_ptr->min_job_age = conf->min_job_age; conf_ptr->mpi_default = xstrdup(conf->mpi_default); conf_ptr->mpi_params = xstrdup(conf->mpi_params); conf_ptr->msg_aggr_params = xstrdup(conf->msg_aggr_params); conf_ptr->msg_timeout = conf->msg_timeout; conf_ptr->next_job_id = get_next_job_id(); conf_ptr->node_features_plugins = xstrdup(conf->node_features_plugins); conf_ptr->node_prefix = xstrdup(conf->node_prefix); conf_ptr->over_time_limit = conf->over_time_limit; conf_ptr->plugindir = xstrdup(conf->plugindir); conf_ptr->plugstack = xstrdup(conf->plugstack); conf_ptr->power_parameters = xstrdup(conf->power_parameters); conf_ptr->power_plugin = xstrdup(conf->power_plugin); conf_ptr->preempt_mode = conf->preempt_mode; conf_ptr->preempt_type = xstrdup(conf->preempt_type); conf_ptr->priority_decay_hl = conf->priority_decay_hl; conf_ptr->priority_calc_period = conf->priority_calc_period; conf_ptr->priority_favor_small= conf->priority_favor_small; conf_ptr->priority_flags = conf->priority_flags; conf_ptr->priority_max_age = conf->priority_max_age; conf_ptr->priority_params = xstrdup(conf->priority_params); conf_ptr->priority_reset_period = conf->priority_reset_period; conf_ptr->priority_type = xstrdup(conf->priority_type); conf_ptr->priority_weight_age = conf->priority_weight_age; conf_ptr->priority_weight_fs = conf->priority_weight_fs; conf_ptr->priority_weight_js = conf->priority_weight_js; conf_ptr->priority_weight_part= conf->priority_weight_part; conf_ptr->priority_weight_qos = conf->priority_weight_qos; conf_ptr->priority_weight_tres = xstrdup(conf->priority_weight_tres); conf_ptr->private_data = conf->private_data; conf_ptr->proctrack_type = xstrdup(conf->proctrack_type); conf_ptr->prolog = xstrdup(conf->prolog); conf_ptr->prolog_epilog_timeout = conf->prolog_epilog_timeout; conf_ptr->prolog_slurmctld = xstrdup(conf->prolog_slurmctld); conf_ptr->prolog_flags = conf->prolog_flags; conf_ptr->propagate_prio_process = slurmctld_conf.propagate_prio_process; conf_ptr->propagate_rlimits = xstrdup(conf->propagate_rlimits); conf_ptr->propagate_rlimits_except = xstrdup(conf-> propagate_rlimits_except); conf_ptr->reboot_program = xstrdup(conf->reboot_program); conf_ptr->reconfig_flags = conf->reconfig_flags; conf_ptr->requeue_exit = xstrdup(conf->requeue_exit); conf_ptr->requeue_exit_hold = xstrdup(conf->requeue_exit_hold); conf_ptr->resume_program = xstrdup(conf->resume_program); conf_ptr->resume_rate = conf->resume_rate; conf_ptr->resume_timeout = conf->resume_timeout; conf_ptr->resv_epilog = xstrdup(conf->resv_epilog); conf_ptr->resv_over_run = conf->resv_over_run; conf_ptr->resv_prolog = xstrdup(conf->resv_prolog); conf_ptr->ret2service = conf->ret2service; conf_ptr->route_plugin = xstrdup(conf->route_plugin); conf_ptr->salloc_default_command = xstrdup(conf-> salloc_default_command); if (conf->sched_params) conf_ptr->sched_params = xstrdup(conf->sched_params); else conf_ptr->sched_params = slurm_sched_g_get_conf(); conf_ptr->schedport = conf->schedport; conf_ptr->schedrootfltr = conf->schedrootfltr; conf_ptr->sched_logfile = xstrdup(conf->sched_logfile); conf_ptr->sched_log_level = conf->sched_log_level; conf_ptr->sched_time_slice = conf->sched_time_slice; conf_ptr->schedtype = xstrdup(conf->schedtype); conf_ptr->select_type = xstrdup(conf->select_type); select_g_get_info_from_plugin(SELECT_CONFIG_INFO, NULL, &conf_ptr->select_conf_key_pairs); conf_ptr->select_type_param = conf->select_type_param; conf_ptr->slurm_user_id = conf->slurm_user_id; conf_ptr->slurm_user_name = xstrdup(conf->slurm_user_name); conf_ptr->slurmctld_debug = conf->slurmctld_debug; conf_ptr->slurmctld_logfile = xstrdup(conf->slurmctld_logfile); conf_ptr->slurmctld_pidfile = xstrdup(conf->slurmctld_pidfile); conf_ptr->slurmctld_plugstack = xstrdup(conf->slurmctld_plugstack); conf_ptr->slurmctld_port = conf->slurmctld_port; conf_ptr->slurmctld_port_count = conf->slurmctld_port_count; conf_ptr->slurmctld_timeout = conf->slurmctld_timeout; conf_ptr->slurmd_debug = conf->slurmd_debug; conf_ptr->slurmd_logfile = xstrdup(conf->slurmd_logfile); conf_ptr->slurmd_pidfile = xstrdup(conf->slurmd_pidfile); conf_ptr->slurmd_plugstack = xstrdup(conf->slurmd_plugstack); conf_ptr->slurmd_port = conf->slurmd_port; conf_ptr->slurmd_spooldir = xstrdup(conf->slurmd_spooldir); conf_ptr->slurmd_timeout = conf->slurmd_timeout; conf_ptr->slurmd_user_id = conf->slurmd_user_id; conf_ptr->slurmd_user_name = xstrdup(conf->slurmd_user_name); conf_ptr->slurm_conf = xstrdup(conf->slurm_conf); conf_ptr->srun_epilog = xstrdup(conf->srun_epilog); conf_ptr->srun_port_range = xmalloc(2 * sizeof(uint16_t)); if (conf->srun_port_range) { conf_ptr->srun_port_range[0] = conf->srun_port_range[0]; conf_ptr->srun_port_range[1] = conf->srun_port_range[1]; } else { conf_ptr->srun_port_range[0] = 0; conf_ptr->srun_port_range[1] = 0; } conf_ptr->srun_prolog = xstrdup(conf->srun_prolog); conf_ptr->state_save_location = xstrdup(conf->state_save_location); conf_ptr->suspend_exc_nodes = xstrdup(conf->suspend_exc_nodes); conf_ptr->suspend_exc_parts = xstrdup(conf->suspend_exc_parts); conf_ptr->suspend_program = xstrdup(conf->suspend_program); conf_ptr->suspend_rate = conf->suspend_rate; conf_ptr->suspend_time = conf->suspend_time; conf_ptr->suspend_timeout = conf->suspend_timeout; conf_ptr->switch_type = xstrdup(conf->switch_type); conf_ptr->task_epilog = xstrdup(conf->task_epilog); conf_ptr->task_prolog = xstrdup(conf->task_prolog); conf_ptr->task_plugin = xstrdup(conf->task_plugin); conf_ptr->task_plugin_param = conf->task_plugin_param; conf_ptr->tcp_timeout = conf->tcp_timeout; conf_ptr->tmp_fs = xstrdup(conf->tmp_fs); conf_ptr->topology_param = xstrdup(conf->topology_param); conf_ptr->topology_plugin = xstrdup(conf->topology_plugin); conf_ptr->track_wckey = conf->track_wckey; conf_ptr->tree_width = conf->tree_width; conf_ptr->wait_time = conf->wait_time; conf_ptr->use_pam = conf->use_pam; conf_ptr->use_spec_resources = conf->use_spec_resources; conf_ptr->unkillable_program = xstrdup(conf->unkillable_program); conf_ptr->unkillable_timeout = conf->unkillable_timeout; conf_ptr->version = xstrdup(SLURM_VERSION_STRING); conf_ptr->vsize_factor = conf->vsize_factor; slurm_conf_unlock(); return; } /* * validate_slurm_user - validate that the uid is authorized to see * privileged data (either user root or SlurmUser) * IN uid - user to validate * RET true if permitted to run, false otherwise */ extern bool validate_slurm_user(uid_t uid) { if ((uid == 0) || (uid == getuid())) return true; else return false; } /* * validate_super_user - validate that the uid is authorized at the * root, SlurmUser, or SLURMDB_ADMIN_SUPER_USER level * IN uid - user to validate * RET true if permitted to run, false otherwise */ extern bool validate_super_user(uid_t uid) { if ((uid == 0) || (uid == getuid()) || assoc_mgr_get_admin_level(acct_db_conn, uid) >= SLURMDB_ADMIN_SUPER_USER) return true; else return false; } /* * validate_operator - validate that the uid is authorized at the * root, SlurmUser, or SLURMDB_ADMIN_OPERATOR level * IN uid - user to validate * RET true if permitted to run, false otherwise */ extern bool validate_operator(uid_t uid) { if ((uid == 0) || (uid == getuid()) || assoc_mgr_get_admin_level(acct_db_conn, uid) >= SLURMDB_ADMIN_OPERATOR) return true; else return false; } /* _kill_job_on_msg_fail - The request to create a job record successed, * but the reply message to srun failed. We kill the job to avoid * leaving it orphaned */ static void _kill_job_on_msg_fail(uint32_t job_id) { /* Locks: Write job, write node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; error("Job allocate response msg send failure, killing JobId=%u", job_id); lock_slurmctld(job_write_lock); job_complete(job_id, 0, false, false, 0); unlock_slurmctld(job_write_lock); } /* create a credential for a given job step, return error code */ static int _make_step_cred(struct step_record *step_ptr, slurm_cred_t **slurm_cred, uint16_t protocol_version) { slurm_cred_arg_t cred_arg; struct job_record* job_ptr = step_ptr->job_ptr; job_resources_t *job_resrcs_ptr = job_ptr->job_resrcs; xassert(job_resrcs_ptr && job_resrcs_ptr->cpus); memset(&cred_arg, 0, sizeof(slurm_cred_arg_t)); cred_arg.jobid = job_ptr->job_id; cred_arg.stepid = step_ptr->step_id; cred_arg.uid = job_ptr->user_id; cred_arg.job_constraints = job_ptr->details->features; cred_arg.job_core_bitmap = job_resrcs_ptr->core_bitmap; cred_arg.job_core_spec = job_ptr->details->core_spec; cred_arg.job_hostlist = job_resrcs_ptr->nodes; cred_arg.job_mem_limit = job_ptr->details->pn_min_memory; cred_arg.job_nhosts = job_resrcs_ptr->nhosts; cred_arg.job_gres_list = job_ptr->gres_list; cred_arg.step_gres_list = step_ptr->gres_list; cred_arg.step_core_bitmap = step_ptr->core_bitmap_job; #ifdef HAVE_FRONT_END xassert(job_ptr->batch_host); cred_arg.step_hostlist = job_ptr->batch_host; #else cred_arg.step_hostlist = step_ptr->step_layout->node_list; #endif if (step_ptr->pn_min_memory) cred_arg.step_mem_limit = step_ptr->pn_min_memory; cred_arg.cores_per_socket = job_resrcs_ptr->cores_per_socket; cred_arg.sockets_per_node = job_resrcs_ptr->sockets_per_node; cred_arg.sock_core_rep_count = job_resrcs_ptr->sock_core_rep_count; *slurm_cred = slurm_cred_create(slurmctld_config.cred_ctx, &cred_arg, protocol_version); if (*slurm_cred == NULL) { error("slurm_cred_create error"); return ESLURM_INVALID_JOB_CREDENTIAL; } return SLURM_SUCCESS; } /* _slurm_rpc_allocate_resources: process RPC to allocate resources for * a job */ static void _slurm_rpc_allocate_resources(slurm_msg_t * msg) { static int active_rpc_cnt = 0; int i, error_code = SLURM_SUCCESS; slurm_msg_t response_msg; DEF_TIMERS; job_desc_msg_t *job_desc_msg = (job_desc_msg_t *) msg->data; resource_allocation_response_msg_t alloc_msg; /* Locks: Read config, read job, read node, read partition */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK }; /* Locks: Read config, write job, write node, read partition */ slurmctld_lock_t job_write_lock = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); int immediate = job_desc_msg->immediate; bool do_unlock = false; bool job_waiting = false; struct job_record *job_ptr = NULL; uint16_t port; /* dummy value */ slurm_addr_t resp_addr; char *err_msg = NULL; START_TIMER; /* Zero out the record as not all fields may be set. */ memset(&alloc_msg, 0, sizeof(resource_allocation_response_msg_t)); if ((uid != job_desc_msg->user_id) && (!validate_slurm_user(uid))) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, RESOURCE_ALLOCATE from uid=%d", uid); } debug2("sched: Processing RPC: REQUEST_RESOURCE_ALLOCATION from uid=%d", uid); /* do RPC call */ if ((job_desc_msg->alloc_node == NULL) || (job_desc_msg->alloc_node[0] == '\0')) { error_code = ESLURM_INVALID_NODE_NAME; error("REQUEST_RESOURCE_ALLOCATE lacks alloc_node from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* Locks are for job_submit plugin use */ lock_slurmctld(job_read_lock); error_code = validate_job_create_req(job_desc_msg,uid,&err_msg); unlock_slurmctld(job_read_lock); } #if HAVE_ALPS_CRAY /* * Catch attempts to nest salloc sessions. It is not possible to use an * ALPS session which has the same alloc_sid, it fails even if PAGG * container IDs are used. */ if (allocated_session_in_use(job_desc_msg)) { error_code = ESLURM_RESERVATION_BUSY; error("attempt to nest ALPS allocation on %s:%d by uid=%d", job_desc_msg->alloc_node, job_desc_msg->alloc_sid, uid); } #endif if (!slurm_get_peer_addr(msg->conn_fd, &resp_addr)) { job_desc_msg->resp_host = xmalloc(16); slurm_get_ip_str(&resp_addr, &port, job_desc_msg->resp_host, 16); dump_job_desc(job_desc_msg); if (error_code == SLURM_SUCCESS) { do_unlock = true; _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); error_code = job_allocate(job_desc_msg, immediate, false, NULL, true, uid, &job_ptr, &err_msg, msg->protocol_version); /* unlock after finished using the job structure data */ END_TIMER2("_slurm_rpc_allocate_resources"); } } else if (errno) error_code = errno; else error_code = SLURM_ERROR; /* return result */ if ((error_code == ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE) || (error_code == ESLURM_POWER_NOT_AVAIL) || (error_code == ESLURM_POWER_RESERVED) || (error_code == ESLURM_RESERVATION_NOT_USABLE) || (error_code == ESLURM_QOS_THRES) || (error_code == ESLURM_NODE_NOT_AVAIL) || (error_code == ESLURM_JOB_HELD)) job_waiting = true; if ((error_code == ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE) && (slurmctld_conf.enforce_part_limits != PARTITION_ENFORCE_NONE)) job_waiting = false; /* Reject job submission */ if ((error_code == SLURM_SUCCESS) || ((immediate == 0) && job_waiting)) { xassert(job_ptr); info("sched: _slurm_rpc_allocate_resources JobId=%u " "NodeList=%s %s",job_ptr->job_id, job_ptr->nodes, TIME_STR); /* send job_ID and node_name_ptr */ if (job_ptr->job_resrcs && job_ptr->job_resrcs->cpu_array_cnt) { alloc_msg.num_cpu_groups = job_ptr->job_resrcs-> cpu_array_cnt; alloc_msg.cpu_count_reps = xmalloc(sizeof(uint32_t) * job_ptr->job_resrcs-> cpu_array_cnt); memcpy(alloc_msg.cpu_count_reps, job_ptr->job_resrcs->cpu_array_reps, (sizeof(uint32_t) * job_ptr->job_resrcs-> cpu_array_cnt)); alloc_msg.cpus_per_node = xmalloc(sizeof(uint16_t) * job_ptr->job_resrcs-> cpu_array_cnt); memcpy(alloc_msg.cpus_per_node, job_ptr->job_resrcs->cpu_array_value, (sizeof(uint16_t) * job_ptr->job_resrcs-> cpu_array_cnt)); } alloc_msg.error_code = error_code; alloc_msg.job_id = job_ptr->job_id; alloc_msg.node_cnt = job_ptr->node_cnt; alloc_msg.node_list = xstrdup(job_ptr->nodes); alloc_msg.partition = xstrdup(job_ptr->partition); alloc_msg.alias_list = xstrdup(job_ptr->alias_list); alloc_msg.select_jobinfo = select_g_select_jobinfo_copy(job_ptr->select_jobinfo); if (job_ptr->details) { alloc_msg.pn_min_memory = job_ptr->details-> pn_min_memory; if (job_ptr->details->mc_ptr) { alloc_msg.ntasks_per_board = job_ptr->details->mc_ptr-> ntasks_per_board; alloc_msg.ntasks_per_core = job_ptr->details->mc_ptr-> ntasks_per_core; alloc_msg.ntasks_per_socket = job_ptr->details->mc_ptr-> ntasks_per_socket; } if (job_ptr->details->env_cnt) { alloc_msg.env_size = job_ptr->details->env_cnt; alloc_msg.environment = xmalloc(sizeof(char *) * alloc_msg.env_size); for (i = 0; i < alloc_msg.env_size; i++) { alloc_msg.environment[i] = xstrdup(job_ptr->details-> env_sup[i]); } } } else { alloc_msg.pn_min_memory = 0; alloc_msg.ntasks_per_board = (uint16_t)NO_VAL; alloc_msg.ntasks_per_core = (uint16_t)NO_VAL; alloc_msg.ntasks_per_socket = (uint16_t)NO_VAL; } if (job_ptr->account) alloc_msg.account = xstrdup(job_ptr->account); if (job_ptr->qos_ptr) { slurmdb_qos_rec_t *qos; qos = (slurmdb_qos_rec_t *)job_ptr->qos_ptr; alloc_msg.qos = xstrdup(qos->name); } if (job_ptr->resv_name) alloc_msg.resv_name = xstrdup(job_ptr->resv_name); /* This check really isn't needed, but just doing it * to be more complete. */ if (do_unlock) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.msg_type = RESPONSE_RESOURCE_ALLOCATION; response_msg.data = &alloc_msg; if (slurm_send_node_msg(msg->conn_fd, &response_msg) < 0) _kill_job_on_msg_fail(job_ptr->job_id); slurm_free_resource_allocation_response_msg_members(&alloc_msg); schedule_job_save(); /* has own locks */ schedule_node_save(); /* has own locks */ } else { /* allocate error */ if (do_unlock) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } info("_slurm_rpc_allocate_resources: %s ", slurm_strerror(error_code)); if (err_msg) slurm_send_rc_err_msg(msg, error_code, err_msg); else slurm_send_rc_msg(msg, error_code); } xfree(err_msg); } /* _slurm_rpc_dump_conf - process RPC for Slurm configuration information */ static void _slurm_rpc_dump_conf(slurm_msg_t * msg) { DEF_TIMERS; slurm_msg_t response_msg; last_update_msg_t *last_time_msg = (last_update_msg_t *) msg->data; slurm_ctl_conf_info_msg_t config_tbl; /* Locks: Read config, partition*/ slurmctld_lock_t config_read_lock = { READ_LOCK, NO_LOCK, NO_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_BUILD_INFO from uid=%d", uid); lock_slurmctld(config_read_lock); /* check to see if configuration data has changed */ if ((last_time_msg->last_update - 1) >= slurmctld_conf.last_update) { unlock_slurmctld(config_read_lock); debug2("_slurm_rpc_dump_conf, no change"); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); } else { _fill_ctld_conf(&config_tbl); unlock_slurmctld(config_read_lock); END_TIMER2("_slurm_rpc_dump_conf"); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_BUILD_INFO; response_msg.data = &config_tbl; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); free_slurm_conf(&config_tbl, false); } } /* _slurm_rpc_dump_jobs - process RPC for job state information */ static void _slurm_rpc_dump_jobs(slurm_msg_t * msg) { DEF_TIMERS; char *dump; int dump_size; slurm_msg_t response_msg; job_info_request_msg_t *job_info_request_msg = (job_info_request_msg_t *) msg->data; /* Locks: Read config job, write partition (for hiding) */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, NO_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug3("Processing RPC: REQUEST_JOB_INFO from uid=%d", uid); lock_slurmctld(job_read_lock); if ((job_info_request_msg->last_update - 1) >= last_job_update) { unlock_slurmctld(job_read_lock); debug3("_slurm_rpc_dump_jobs, no change"); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); } else { pack_all_jobs(&dump, &dump_size, job_info_request_msg->show_flags, g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info), NO_VAL, msg->protocol_version); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_dump_jobs"); #if 0 info("_slurm_rpc_dump_jobs, size=%d %s", dump_size, TIME_STR); #endif /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_JOB_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } } /* _slurm_rpc_dump_jobs - process RPC for job state information */ static void _slurm_rpc_dump_jobs_user(slurm_msg_t * msg) { DEF_TIMERS; char *dump; int dump_size; slurm_msg_t response_msg; job_user_id_msg_t *job_info_request_msg = (job_user_id_msg_t *) msg->data; /* Locks: Read config job, write node (for hiding) */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, NO_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug3("Processing RPC: REQUEST_JOB_USER_INFO from uid=%d", uid); lock_slurmctld(job_read_lock); pack_all_jobs(&dump, &dump_size, job_info_request_msg->show_flags, g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info), job_info_request_msg->user_id, msg->protocol_version); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_dump_job_user"); #if 0 info("_slurm_rpc_dump_user_jobs, size=%d %s", dump_size, TIME_STR); #endif /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_JOB_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } /* _slurm_rpc_dump_job_single - process RPC for one job's state information */ static void _slurm_rpc_dump_job_single(slurm_msg_t * msg) { DEF_TIMERS; char *dump = NULL; int dump_size, rc; slurm_msg_t response_msg; job_id_msg_t *job_id_msg = (job_id_msg_t *) msg->data; /* Locks: Read config, job, and node info */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, NO_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug3("Processing RPC: REQUEST_JOB_INFO_SINGLE from uid=%d", uid); lock_slurmctld(job_read_lock); rc = pack_one_job(&dump, &dump_size, job_id_msg->job_id, job_id_msg->show_flags, g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info), msg->protocol_version); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_dump_job_single"); #if 0 info("_slurm_rpc_dump_job_single, size=%d %s", dump_size, TIME_STR); #endif /* init response_msg structure */ if (rc != SLURM_SUCCESS) { slurm_send_rc_msg(msg, rc); } else { slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_JOB_INFO; response_msg.data = dump; response_msg.data_size = dump_size; slurm_send_node_msg(msg->conn_fd, &response_msg); } xfree(dump); } static void _slurm_rpc_get_shares(slurm_msg_t *msg) { DEF_TIMERS; shares_request_msg_t *req_msg = (shares_request_msg_t *) msg->data; shares_response_msg_t resp_msg; slurm_msg_t response_msg; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_SHARE_INFO from uid=%d", uid); memset(&resp_msg, 0, sizeof(shares_response_msg_t)); assoc_mgr_get_shares(acct_db_conn, uid, req_msg, &resp_msg); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_SHARE_INFO; response_msg.data = &resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); FREE_NULL_LIST(resp_msg.assoc_shares_list); /* don't free the resp_msg.tres_names */ END_TIMER2("_slurm_rpc_get_share"); debug2("_slurm_rpc_get_shares %s", TIME_STR); } static void _slurm_rpc_get_priority_factors(slurm_msg_t *msg) { DEF_TIMERS; priority_factors_request_msg_t *req_msg = (priority_factors_request_msg_t *) msg->data; priority_factors_response_msg_t resp_msg; slurm_msg_t response_msg; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_PRIORITY_FACTORS from uid=%d", uid); resp_msg.priority_factors_list = priority_g_get_priority_factors_list( req_msg, uid); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_PRIORITY_FACTORS; response_msg.data = &resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); FREE_NULL_LIST(resp_msg.priority_factors_list); END_TIMER2("_slurm_rpc_get_priority_factors"); debug2("_slurm_rpc_get_priority_factors %s", TIME_STR); } /* _slurm_rpc_end_time - Process RPC for job end time */ static void _slurm_rpc_end_time(slurm_msg_t * msg) { DEF_TIMERS; job_alloc_info_msg_t *time_req_msg = (job_alloc_info_msg_t *) msg->data; srun_timeout_msg_t timeout_msg; slurm_msg_t response_msg; int rc; /* Locks: Read job */ slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_JOB_END_TIME from uid=%d", uid); lock_slurmctld(job_read_lock); rc = job_end_time(time_req_msg, &timeout_msg); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_end_time"); if (rc != SLURM_SUCCESS) { slurm_send_rc_msg(msg, rc); } else { slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = SRUN_TIMEOUT; response_msg.data = &timeout_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); } debug2("_slurm_rpc_end_time jobid=%u %s", time_req_msg->job_id, TIME_STR); } /* _slurm_rpc_get_fd - process RPC for federation state information */ static void _slurm_rpc_get_fed(slurm_msg_t * msg) { DEF_TIMERS; slurm_msg_t response_msg; slurmdb_federation_rec_t *fed = NULL; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurm_get_auth_info()); START_TIMER; debug2("Processing RPC: REQUEST_FED_INFO from uid=%d", uid); fed_mgr_get_fed_info(&fed); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_FED_INFO; response_msg.data = fed; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); slurmdb_destroy_federation_rec(fed); END_TIMER2("_slurm_rpc_get_fed"); debug2("%s %s", __func__, TIME_STR); } /* _slurm_rpc_dump_front_end - process RPC for front_end state information */ static void _slurm_rpc_dump_front_end(slurm_msg_t * msg) { DEF_TIMERS; char *dump = NULL; int dump_size = 0; slurm_msg_t response_msg; front_end_info_request_msg_t *front_end_req_msg = (front_end_info_request_msg_t *) msg->data; /* Locks: Read config, read node */ slurmctld_lock_t node_read_lock = { READ_LOCK, NO_LOCK, NO_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug3("Processing RPC: REQUEST_FRONT_END_INFO from uid=%d", uid); lock_slurmctld(node_read_lock); if ((front_end_req_msg->last_update - 1) >= last_front_end_update) { unlock_slurmctld(node_read_lock); debug3("_slurm_rpc_dump_front_end, no change"); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); } else { pack_all_front_end(&dump, &dump_size, uid, msg->protocol_version); unlock_slurmctld(node_read_lock); END_TIMER2("_slurm_rpc_dump_front_end"); debug2("_slurm_rpc_dump_front_end, size=%d %s", dump_size, TIME_STR); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_FRONT_END_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } } /* _slurm_rpc_dump_nodes - dump RPC for node state information */ static void _slurm_rpc_dump_nodes(slurm_msg_t * msg) { DEF_TIMERS; char *dump; int dump_size; slurm_msg_t response_msg; node_info_request_msg_t *node_req_msg = (node_info_request_msg_t *) msg->data; /* Locks: Read config, write node (reset allocated CPU count in some * select plugins), write part (for part_filter_set) */ slurmctld_lock_t node_write_lock = { READ_LOCK, NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug3("Processing RPC: REQUEST_NODE_INFO from uid=%d", uid); if ((slurmctld_conf.private_data & PRIVATE_DATA_NODES) && (!validate_operator(uid))) { error("Security violation, REQUEST_NODE_INFO RPC from uid=%d", uid); slurm_send_rc_msg(msg, ESLURM_ACCESS_DENIED); return; } lock_slurmctld(node_write_lock); select_g_select_nodeinfo_set_all(); if ((node_req_msg->last_update - 1) >= last_node_update) { unlock_slurmctld(node_write_lock); debug3("_slurm_rpc_dump_nodes, no change"); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); } else { pack_all_node(&dump, &dump_size, node_req_msg->show_flags, uid, msg->protocol_version); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_dump_nodes"); #if 0 info("_slurm_rpc_dump_nodes, size=%d %s", dump_size, TIME_STR); #endif /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_NODE_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } } /* _slurm_rpc_dump_node_single - done RPC state information for one node */ static void _slurm_rpc_dump_node_single(slurm_msg_t * msg) { DEF_TIMERS; char *dump; int dump_size; slurm_msg_t response_msg; node_info_single_msg_t *node_req_msg = (node_info_single_msg_t *) msg->data; /* Locks: Read config, read node, write part (for part_filter_set) */ slurmctld_lock_t node_write_lock = { READ_LOCK, NO_LOCK, READ_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug3("Processing RPC: REQUEST_NODE_INFO_SINGLE from uid=%d", uid); if ((slurmctld_conf.private_data & PRIVATE_DATA_NODES) && (!validate_operator(uid))) { error("Security violation, REQUEST_NODE_INFO_SINGLE RPC from " "uid=%d", uid); slurm_send_rc_msg(msg, ESLURM_ACCESS_DENIED); return; } lock_slurmctld(node_write_lock); #if 0 /* This function updates each node's alloc_cpus count and too slow for * our use here. Node write lock is needed if this function is used */ select_g_select_nodeinfo_set_all(); #endif pack_one_node(&dump, &dump_size, node_req_msg->show_flags, uid, node_req_msg->node_name, msg->protocol_version); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_dump_node_single"); #if 0 info("_slurm_rpc_dump_node_single, name=%s size=%d %s", node_req_msg->node_name, dump_size, TIME_STR); #endif /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_NODE_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } /* _slurm_rpc_dump_partitions - process RPC for partition state information */ static void _slurm_rpc_dump_partitions(slurm_msg_t * msg) { DEF_TIMERS; char *dump; int dump_size; slurm_msg_t response_msg; part_info_request_msg_t *part_req_msg; /* Locks: Read configuration and partition */ slurmctld_lock_t part_read_lock = { READ_LOCK, NO_LOCK, NO_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_PARTITION_INFO uid=%d", uid); part_req_msg = (part_info_request_msg_t *) msg->data; lock_slurmctld(part_read_lock); if ((slurmctld_conf.private_data & PRIVATE_DATA_PARTITIONS) && !validate_operator(uid)) { unlock_slurmctld(part_read_lock); debug2("Security violation, PARTITION_INFO RPC from uid=%d", uid); slurm_send_rc_msg(msg, ESLURM_ACCESS_DENIED); } else if ((part_req_msg->last_update - 1) >= last_part_update) { unlock_slurmctld(part_read_lock); debug2("_slurm_rpc_dump_partitions, no change"); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); } else { pack_all_part(&dump, &dump_size, part_req_msg->show_flags, uid, msg->protocol_version); unlock_slurmctld(part_read_lock); END_TIMER2("_slurm_rpc_dump_partitions"); debug2("_slurm_rpc_dump_partitions, size=%d %s", dump_size, TIME_STR); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_PARTITION_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } } /* _slurm_rpc_epilog_complete - process RPC noting the completion of * the epilog denoting the completion of a job it its entirety */ static void _slurm_rpc_epilog_complete(slurm_msg_t *msg, bool *run_scheduler, bool running_composite) { static int active_rpc_cnt = 0; static time_t config_update = 0; static bool defer_sched = false; DEF_TIMERS; /* Locks: Read configuration, write job, write node */ slurmctld_lock_t job_write_lock = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); epilog_complete_msg_t *epilog_msg = (epilog_complete_msg_t *) msg->data; struct job_record *job_ptr; char jbuf[JBUFSIZ]; START_TIMER; debug2("Processing RPC: MESSAGE_EPILOG_COMPLETE uid=%d", uid); if (!validate_slurm_user(uid)) { error("Security violation, EPILOG_COMPLETE RPC from uid=%d", uid); return; } /* Only throttle on none composite messages, the lock should * already be set earlier. */ if (!running_composite) { if (config_update != slurmctld_conf.last_update) { char *sched_params = slurm_get_sched_params(); defer_sched = (sched_params && strstr(sched_params, "defer")); xfree(sched_params); config_update = slurmctld_conf.last_update; } _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); } if (slurmctld_conf.debug_flags & DEBUG_FLAG_ROUTE) info("_slurm_rpc_epilog_complete: " "node_name = %s, job_id = %u", epilog_msg->node_name, epilog_msg->job_id); if (job_epilog_complete(epilog_msg->job_id, epilog_msg->node_name, epilog_msg->return_code)) *run_scheduler = true; job_ptr = find_job_record(epilog_msg->job_id); if (epilog_msg->return_code) error("%s: epilog error %s Node=%s Err=%s %s", __func__, jobid2str(job_ptr, jbuf, sizeof(jbuf)), epilog_msg->node_name, slurm_strerror(epilog_msg->return_code), TIME_STR); else debug2("%s: %s Node=%s %s", __func__, jobid2str(job_ptr, jbuf, sizeof(jbuf)), epilog_msg->node_name, TIME_STR); if (!running_composite) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } END_TIMER2("_slurm_rpc_epilog_complete"); /* Functions below provide their own locking */ if (!running_composite && *run_scheduler) { /* * In defer mode, avoid triggering the scheduler logic * for every epilog complete message. * As one epilog message is sent from every node of each * job at termination, the number of simultaneous schedule * calls can be very high for large machine or large number * of managed jobs. */ if (!LOTS_OF_AGENTS && !defer_sched) (void) schedule(0); /* Has own locking */ schedule_node_save(); /* Has own locking */ schedule_job_save(); /* Has own locking */ } /* NOTE: RPC has no response */ } /* _slurm_rpc_job_step_kill - process RPC to cancel an entire job or * an individual job step */ static void _slurm_rpc_job_step_kill(slurm_msg_t * msg) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS; DEF_TIMERS; job_step_kill_msg_t *job_step_kill_msg = (job_step_kill_msg_t *) msg->data; /* Locks: Read config, write job, write node */ slurmctld_lock_t job_write_lock = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); struct job_record *job_ptr; START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("Processing RPC: REQUEST_CANCEL_JOB_STEP uid=%d", uid); _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); job_ptr = find_job_record(job_step_kill_msg->job_id); trace_job(job_ptr, __func__, "enter"); /* do RPC call */ if (job_step_kill_msg->job_step_id == SLURM_BATCH_SCRIPT) { /* NOTE: SLURM_BATCH_SCRIPT == NO_VAL */ error_code = job_signal(job_step_kill_msg->job_id, job_step_kill_msg->signal, job_step_kill_msg->flags, uid, false); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); END_TIMER2("_slurm_rpc_job_step_kill"); /* return result */ if (error_code) { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("Signal %u JobId=%u by UID=%u: %s", job_step_kill_msg->signal, job_step_kill_msg->job_id, uid, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { if (job_step_kill_msg->signal == SIGKILL) { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s: Cancel of JobId=%u by " "UID=%u, %s", __func__, job_step_kill_msg->job_id, uid, TIME_STR); slurmctld_diag_stats.jobs_canceled++; } else { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s: Signal %u of JobId=%u by " "UID=%u, %s", __func__, job_step_kill_msg->signal, job_step_kill_msg->job_id, uid, TIME_STR); } slurm_send_rc_msg(msg, SLURM_SUCCESS); /* Below function provides its own locking */ schedule_job_save(); } } else { error_code = job_step_signal(job_step_kill_msg->job_id, job_step_kill_msg->job_step_id, job_step_kill_msg->signal, uid); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); END_TIMER2("_slurm_rpc_job_step_kill"); /* return result */ if (error_code) { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("Signal %u of StepId=%u.%u by UID=%u: %s", job_step_kill_msg->signal, job_step_kill_msg->job_id, job_step_kill_msg->job_step_id, uid, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { if (job_step_kill_msg->signal == SIGKILL) { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s: Cancel of StepId=%u.%u by " "UID=%u %s", __func__, job_step_kill_msg->job_id, job_step_kill_msg->job_step_id, uid, TIME_STR); } else { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s: Signal %u of StepId=%u.%u " "by UID=%u %s", __func__, job_step_kill_msg->signal, job_step_kill_msg->job_id, job_step_kill_msg->job_step_id, uid, TIME_STR); } slurm_send_rc_msg(msg, SLURM_SUCCESS); /* Below function provides its own locking */ schedule_job_save(); } } trace_job(job_ptr, __func__, "return"); } /* _slurm_rpc_complete_job_allocation - process RPC to note the * completion of a job allocation */ static void _slurm_rpc_complete_job_allocation(slurm_msg_t * msg) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS; DEF_TIMERS; complete_job_allocation_msg_t *comp_msg = (complete_job_allocation_msg_t *) msg->data; /* Locks: Write job, write node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); struct job_record *job_ptr; char jbuf[JBUFSIZ]; /* init */ START_TIMER; debug2("Processing RPC: REQUEST_COMPLETE_JOB_ALLOCATION from " "uid=%u, JobId=%u rc=%d", uid, comp_msg->job_id, comp_msg->job_rc); _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); job_ptr = find_job_record(comp_msg->job_id); trace_job(job_ptr, __func__, "enter"); /* do RPC call */ /* Mark job and/or job step complete */ error_code = job_complete(comp_msg->job_id, uid, false, false, comp_msg->job_rc); if (error_code) info("%s: %s error %s ", __func__, jobid2str(job_ptr, jbuf, sizeof(jbuf)), slurm_strerror(error_code)); else debug2("%s: %s %s", __func__, jobid2str(job_ptr, jbuf, sizeof(jbuf)), TIME_STR); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); END_TIMER2("_slurm_rpc_complete_job_allocation"); /* synchronize power layouts key/values */ if ((powercap_get_cluster_current_cap() != 0) && (which_power_layout() == 2)) { layouts_entity_pull_kv("power", "Cluster", "CurrentSumPower"); } /* return result */ if (error_code) { slurm_send_rc_msg(msg, error_code); } else { slurmctld_diag_stats.jobs_completed++; slurm_send_rc_msg(msg, SLURM_SUCCESS); (void) schedule_job_save(); /* Has own locking */ (void) schedule_node_save(); /* Has own locking */ } trace_job(job_ptr, __func__, "return"); } /* _slurm_rpc_complete_prolog - process RPC to note the * completion of a prolog */ static void _slurm_rpc_complete_prolog(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; complete_prolog_msg_t *comp_msg = (complete_prolog_msg_t *) msg->data; /* Locks: Write job, write node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; /* init */ START_TIMER; debug2("Processing RPC: REQUEST_COMPLETE_PROLOG from JobId=%u", comp_msg->job_id); lock_slurmctld(job_write_lock); error_code = prolog_complete(comp_msg->job_id, comp_msg->prolog_rc); unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_complete_prolog"); /* return result */ if (error_code) { info("_slurm_rpc_complete_prolog JobId=%u: %s ", comp_msg->job_id, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_complete_prolog JobId=%u %s", comp_msg->job_id, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); } } /* _slurm_rpc_complete_batch - process RPC from slurmstepd to note the * completion of a batch script */ static void _slurm_rpc_complete_batch_script(slurm_msg_t *msg, bool *run_scheduler, bool running_composite) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS, i; DEF_TIMERS; complete_batch_script_msg_t *comp_msg = (complete_batch_script_msg_t *) msg->data; /* Locks: Write job, write node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); bool job_requeue = false; bool dump_job = false, dump_node = false; struct job_record *job_ptr = NULL; char *msg_title = "node(s)"; char *nodes = comp_msg->node_name; #ifdef HAVE_BG update_block_msg_t block_desc; memset(&block_desc, 0, sizeof(update_block_msg_t)); #endif /* init */ START_TIMER; debug2("Processing RPC: REQUEST_COMPLETE_BATCH_SCRIPT from " "uid=%u JobId=%u", uid, comp_msg->job_id); if (!validate_slurm_user(uid)) { error("A non superuser %u tried to complete batch job %u", uid, comp_msg->job_id); /* Only the slurmstepd can complete a batch script */ END_TIMER2("_slurm_rpc_complete_batch_script"); return; } if (!running_composite) { _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); } job_ptr = find_job_record(comp_msg->job_id); if (job_ptr && job_ptr->batch_host && comp_msg->node_name && xstrcmp(job_ptr->batch_host, comp_msg->node_name)) { /* This can be the result of the slurmd on the batch_host * failing, but the slurmstepd continuing to run. Then the * batch job is requeued and started on a different node. * The end result is one batch complete RPC from each node. */ error("Batch completion for job %u sent from wrong node " "(%s rather than %s). " "Was the job requeued due to node failure?", comp_msg->job_id, comp_msg->node_name, job_ptr->batch_host); if (!running_composite) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } slurm_send_rc_msg(msg, error_code); return; } /* Send batch step info to accounting, only if the job is * still completing. * * When a job is requeued because of node failure, and there is no * epilog, both EPILOG_COMPLETE and COMPLETE_BATCH_SCRIPT_COMPLETE * messages are sent at the same time and receieved on different * threads. EPILOG_COMPLETE will grab a new db_index for the job. So if * COMPLETE_BATCH_SCRIPT happens after EPILOG_COMPLETE, then adding the * batch step would happen on the new db instance -- which is incorrect. * Rather than try to ensure that COMPLETE_BATCH_SCRIPT happens after * EPILOG_COMPLETE, just throw away the batch step for node failures. * * NOTE: Do not use IS_JOB_PENDING since that doesn't take * into account the COMPLETING FLAG which is valid, but not * always set yet when the step exits normally. */ if (association_based_accounting && job_ptr && (job_ptr->job_state != JOB_PENDING)) { struct step_record batch_step; memset(&batch_step, 0, sizeof(struct step_record)); batch_step.job_ptr = job_ptr; batch_step.step_id = SLURM_BATCH_SCRIPT; batch_step.jobacct = comp_msg->jobacct; batch_step.exit_code = comp_msg->job_rc; #ifdef HAVE_FRONT_END nodes = job_ptr->nodes; #endif batch_step.gres = nodes; node_name2bitmap(batch_step.gres, false, &batch_step.step_node_bitmap); batch_step.requid = -1; batch_step.start_time = job_ptr->start_time; batch_step.name = "batch"; batch_step.select_jobinfo = job_ptr->select_jobinfo; step_set_alloc_tres(&batch_step, 1, false, false); jobacct_storage_g_step_start(acct_db_conn, &batch_step); jobacct_storage_g_step_complete(acct_db_conn, &batch_step); FREE_NULL_BITMAP(batch_step.step_node_bitmap); xfree(batch_step.tres_alloc_str); } #ifdef HAVE_FRONT_END if (job_ptr && job_ptr->front_end_ptr) nodes = job_ptr->front_end_ptr->name; msg_title = "front_end"; #endif /* do RPC call */ /* First set node DOWN if fatal error */ if ((comp_msg->slurm_rc == ESLURM_ALREADY_DONE) || (comp_msg->slurm_rc == ESLURMD_CREDENTIAL_REVOKED)) { /* race condition on job termination, not a real error */ info("slurmd error running JobId=%u from %s=%s: %s", comp_msg->job_id, msg_title, nodes, slurm_strerror(comp_msg->slurm_rc)); comp_msg->slurm_rc = SLURM_SUCCESS; #ifdef HAVE_ALPS_CRAY } else if (comp_msg->slurm_rc == ESLURM_RESERVATION_NOT_USABLE) { /* * Confirmation of ALPS reservation failed. * * This is non-fatal, it may be a transient error (e.g. ALPS * temporary unavailable). Give job one more chance to run. */ error("ALPS reservation for JobId %u failed: %s", comp_msg->job_id, slurm_strerror(comp_msg->slurm_rc)); dump_job = job_requeue = true; #endif /* Handle non-fatal errors here. All others drain the node. */ } else if ((comp_msg->slurm_rc == SLURM_COMMUNICATIONS_SEND_ERROR) || (comp_msg->slurm_rc == ESLURM_USER_ID_MISSING) || (comp_msg->slurm_rc == ESLURMD_UID_NOT_FOUND) || (comp_msg->slurm_rc == ESLURMD_GID_NOT_FOUND) || (comp_msg->slurm_rc == ESLURMD_INVALID_ACCT_FREQ)) { error("Slurmd error running JobId=%u on %s=%s: %s", comp_msg->job_id, msg_title, nodes, slurm_strerror(comp_msg->slurm_rc)); } else if (comp_msg->slurm_rc != SLURM_SUCCESS) { error("slurmd error running JobId=%u on %s=%s: %s", comp_msg->job_id, msg_title, nodes, slurm_strerror(comp_msg->slurm_rc)); slurmctld_diag_stats.jobs_failed++; if (error_code == SLURM_SUCCESS) { #ifdef HAVE_BG if (job_ptr) { select_g_select_jobinfo_get( job_ptr->select_jobinfo, SELECT_JOBDATA_BLOCK_ID, &block_desc.bg_block_id); } #else #ifdef HAVE_FRONT_END if (job_ptr && job_ptr->front_end_ptr) { update_front_end_msg_t update_node_msg; memset(&update_node_msg, 0, sizeof(update_front_end_msg_t)); update_node_msg.name = job_ptr->front_end_ptr-> name; update_node_msg.node_state = NODE_STATE_DRAIN; update_node_msg.reason = "batch job complete failure"; error_code = update_front_end(&update_node_msg); } #else error_code = drain_nodes(comp_msg->node_name, "batch job complete failure", getuid()); #endif /* !HAVE_FRONT_END */ #endif /* !HAVE_BG */ if ((comp_msg->job_rc != SLURM_SUCCESS) && job_ptr && job_ptr->details && job_ptr->details->requeue) job_requeue = true; dump_job = true; dump_node = true; } } /* Mark job allocation complete */ if (msg->msg_type == REQUEST_COMPLETE_BATCH_JOB) job_epilog_complete(comp_msg->job_id, comp_msg->node_name, 0); i = job_complete(comp_msg->job_id, uid, job_requeue, false, comp_msg->job_rc); error_code = MAX(error_code, i); if (!running_composite) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } #ifdef HAVE_BG if (block_desc.bg_block_id) { block_desc.reason = slurm_strerror(comp_msg->slurm_rc); block_desc.state = BG_BLOCK_ERROR_FLAG; i = select_g_update_block(&block_desc); error_code = MAX(error_code, i); xfree(block_desc.bg_block_id); } #endif /* this has to be done after the job_complete */ END_TIMER2("_slurm_rpc_complete_batch_script"); /* synchronize power layouts key/values */ if ((powercap_get_cluster_current_cap() != 0) && (which_power_layout() == 2)) { layouts_entity_pull_kv("power", "Cluster", "CurrentSumPower"); } /* return result */ if (error_code) { debug2("_slurm_rpc_complete_batch_script JobId=%u: %s ", comp_msg->job_id, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_complete_batch_script JobId=%u %s", comp_msg->job_id, TIME_STR); slurmctld_diag_stats.jobs_completed++; dump_job = true; if (replace_batch_job(msg, job_ptr, running_composite)) *run_scheduler = true; } /* If running composite lets not call this to avoid deadlock */ if (!running_composite && *run_scheduler) (void) schedule(0); /* Has own locking */ if (dump_job) (void) schedule_job_save(); /* Has own locking */ if (dump_node) (void) schedule_node_save(); /* Has own locking */ } /* _slurm_rpc_job_step_create - process RPC to create/register a job step * with the step_mgr */ static void _slurm_rpc_job_step_create(slurm_msg_t * msg) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS; DEF_TIMERS; slurm_msg_t resp; struct step_record *step_rec; job_step_create_response_msg_t job_step_resp; job_step_create_request_msg_t *req_step_msg = (job_step_create_request_msg_t *) msg->data; slurm_cred_t *slurm_cred = (slurm_cred_t *) NULL; /* Locks: Write jobs, read nodes */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("Processing RPC: REQUEST_JOB_STEP_CREATE from uid=%d", uid); dump_step_desc(req_step_msg); if (uid && (uid != req_step_msg->user_id)) { error("Security violation, JOB_STEP_CREATE RPC from uid=%d " "to run as uid %u", uid, req_step_msg->user_id); slurm_send_rc_msg(msg, ESLURM_USER_ID_MISSING); return; } #if defined HAVE_FRONT_END && !defined HAVE_BGQ && !defined HAVE_ALPS_CRAY /* Limited job step support */ /* Non-super users not permitted to run job steps on front-end. * A single slurmd can not handle a heavy load. */ if (!validate_slurm_user(uid)) { info("Attempt to execute job step by uid=%d", uid); slurm_send_rc_msg(msg, ESLURM_NO_STEPS); return; } #endif _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); error_code = step_create(req_step_msg, &step_rec, false, msg->protocol_version); if (error_code == SLURM_SUCCESS) { error_code = _make_step_cred(step_rec, &slurm_cred, step_rec->start_protocol_ver); ext_sensors_g_get_stepstartdata(step_rec); } END_TIMER2("_slurm_rpc_job_step_create"); /* return result */ if (error_code) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) { if ((error_code == ESLURM_PROLOG_RUNNING) || (error_code == ESLURM_DISABLED)) { /*job suspended*/ debug("%s for suspended job %u: %s", __func__, req_step_msg->job_id, slurm_strerror(error_code)); } else { info("%s for job %u: %s", __func__, req_step_msg->job_id, slurm_strerror(error_code)); } } slurm_send_rc_msg(msg, error_code); } else { slurm_step_layout_t *layout = step_rec->step_layout; if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("sched: %s: StepId=%u.%u %s %s", __func__, step_rec->job_ptr->job_id, step_rec->step_id, req_step_msg->node_list, TIME_STR); job_step_resp.job_step_id = step_rec->step_id; job_step_resp.resv_ports = step_rec->resv_ports; job_step_resp.step_layout = layout; #ifdef HAVE_FRONT_END if (step_rec->job_ptr->batch_host) { job_step_resp.step_layout->front_end = xstrdup(step_rec->job_ptr->batch_host); } #endif job_step_resp.cred = slurm_cred; job_step_resp.use_protocol_ver = step_rec->start_protocol_ver; job_step_resp.select_jobinfo = step_rec->select_jobinfo; job_step_resp.switch_job = step_rec->switch_job; unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); slurm_msg_t_init(&resp); resp.flags = msg->flags; resp.protocol_version = msg->protocol_version; resp.address = msg->address; resp.msg_type = RESPONSE_JOB_STEP_CREATE; resp.data = &job_step_resp; slurm_send_node_msg(msg->conn_fd, &resp); slurm_cred_destroy(slurm_cred); schedule_job_save(); /* Sets own locks */ } } /* _slurm_rpc_job_step_get_info - process request for job step info */ static void _slurm_rpc_job_step_get_info(slurm_msg_t * msg) { DEF_TIMERS; void *resp_buffer = NULL; int resp_buffer_size = 0; int error_code = SLURM_SUCCESS; job_step_info_request_msg_t *request = (job_step_info_request_msg_t *) msg->data; /* Locks: Read config, job, write partition (for filtering) */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, NO_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) debug("Processing RPC: REQUEST_JOB_STEP_INFO from uid=%d", uid); lock_slurmctld(job_read_lock); if ((request->last_update - 1) >= last_job_update) { unlock_slurmctld(job_read_lock); if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) debug("%s, no change", __func__); error_code = SLURM_NO_CHANGE_IN_DATA; } else { Buf buffer = init_buf(BUF_SIZE); error_code = pack_ctld_job_step_info_response_msg( request->job_id, request->step_id, uid, request->show_flags, buffer, msg->protocol_version); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_job_step_get_info"); if (error_code) { /* job_id:step_id not found or otherwise *\ \* error message is printed elsewhere */ if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) debug("%s: %s", __func__, slurm_strerror(error_code)); free_buf(buffer); } else { resp_buffer_size = get_buf_offset(buffer); resp_buffer = xfer_buf_data(buffer); if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) debug("%s size=%d %s", __func__, resp_buffer_size, TIME_STR); } } if (error_code) slurm_send_rc_msg(msg, error_code); else { slurm_msg_t response_msg; slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_JOB_STEP_INFO; response_msg.data = resp_buffer; response_msg.data_size = resp_buffer_size; slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(resp_buffer); } } static bool _is_valid_will_run_user(job_desc_msg_t *job_desc_msg, uid_t uid) { char *account = NULL; if ((uid == job_desc_msg->user_id) || validate_operator(uid)) return true; if (job_desc_msg->job_id != NO_VAL) { struct job_record *job_ptr; job_ptr = find_job_record(job_desc_msg->job_id); if (job_ptr) account = job_ptr->account; } else if (job_desc_msg->account) account = job_desc_msg->account; if (account && assoc_mgr_is_user_acct_coord(acct_db_conn, uid, account)) return true; return false; } /* _slurm_rpc_job_will_run - process RPC to determine if job with given * configuration can be initiated */ static void _slurm_rpc_job_will_run(slurm_msg_t * msg) { /* init */ DEF_TIMERS; int error_code = SLURM_SUCCESS; struct job_record *job_ptr = NULL; job_desc_msg_t *job_desc_msg = (job_desc_msg_t *) msg->data; /* Locks: Read config, read job, read node, read partition */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK }; /* Locks: Write job, read node, read partition */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, READ_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); uint16_t port; /* dummy value */ slurm_addr_t resp_addr; will_run_response_msg_t *resp = NULL; char *err_msg = NULL; START_TIMER; debug2("Processing RPC: REQUEST_JOB_WILL_RUN from uid=%d", uid); /* do RPC call */ if (!_is_valid_will_run_user(job_desc_msg, uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, JOB_WILL_RUN RPC from uid=%d", uid); } if ((job_desc_msg->alloc_node == NULL) || (job_desc_msg->alloc_node[0] == '\0')) { error_code = ESLURM_INVALID_NODE_NAME; error("REQUEST_JOB_WILL_RUN lacks alloc_node from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* Locks are for job_submit plugin use */ lock_slurmctld(job_read_lock); error_code = validate_job_create_req(job_desc_msg,uid,&err_msg); unlock_slurmctld(job_read_lock); } if (!slurm_get_peer_addr(msg->conn_fd, &resp_addr)) { job_desc_msg->resp_host = xmalloc(16); slurm_get_ip_str(&resp_addr, &port, job_desc_msg->resp_host, 16); dump_job_desc(job_desc_msg); if (error_code == SLURM_SUCCESS) { lock_slurmctld(job_write_lock); if (job_desc_msg->job_id == NO_VAL) { error_code = job_allocate(job_desc_msg, false, true, &resp, true, uid, &job_ptr, &err_msg, msg->protocol_version); } else { /* existing job test */ error_code = job_start_data(job_desc_msg, &resp); } unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_job_will_run"); } } else if (errno) error_code = errno; else error_code = SLURM_ERROR; /* return result */ if (error_code) { debug2("_slurm_rpc_job_will_run: %s", slurm_strerror(error_code)); if (err_msg) slurm_send_rc_err_msg(msg, error_code, err_msg); else slurm_send_rc_msg(msg, error_code); } else if (resp) { slurm_msg_t response_msg; /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_JOB_WILL_RUN; response_msg.data = resp; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_free_will_run_response_msg(resp); debug2("_slurm_rpc_job_will_run success %s", TIME_STR); } else { debug2("_slurm_rpc_job_will_run success %s", TIME_STR); if (job_desc_msg->job_id == NO_VAL) slurm_send_rc_msg(msg, SLURM_SUCCESS); } xfree(err_msg); } static void _slurm_rpc_event_log(slurm_msg_t * msg) { uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); slurm_event_log_msg_t *event_log_msg; int error_code = SLURM_SUCCESS; event_log_msg = (slurm_event_log_msg_t *) msg->data; if (!validate_slurm_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, NODE_REGISTER RPC from uid=%d", uid); } else if (event_log_msg->level == LOG_LEVEL_ERROR) { error("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_INFO) { info("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_VERBOSE) { verbose("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_DEBUG) { debug("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_DEBUG2) { debug2("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_DEBUG3) { debug3("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_DEBUG4) { debug4("%s", event_log_msg->string); } else if (event_log_msg->level == LOG_LEVEL_DEBUG5) { debug5("%s", event_log_msg->string); } else { error_code = EINVAL; error("Invalid message level: %u", event_log_msg->level); error("%s", event_log_msg->string); } slurm_send_rc_msg(msg, error_code); } /* _slurm_rpc_node_registration - process RPC to determine if a node's * actual configuration satisfies the configured specification */ static void _slurm_rpc_node_registration(slurm_msg_t * msg, bool running_composite) { /* init */ DEF_TIMERS; int error_code = SLURM_SUCCESS; bool newly_up = false; slurm_node_registration_status_msg_t *node_reg_stat_msg = (slurm_node_registration_status_msg_t *) msg->data; /* Locks: Read config, write job, write node */ slurmctld_lock_t job_write_lock = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: MESSAGE_NODE_REGISTRATION_STATUS from uid=%d", uid); if (!validate_slurm_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, NODE_REGISTER RPC from uid=%d", uid); } if (msg->protocol_version != SLURM_PROTOCOL_VERSION) info("Node %s appears to have a different version " "of Slurm than ours. Please update at your earliest " "convenience.", node_reg_stat_msg->node_name); if (error_code == SLURM_SUCCESS) { /* do RPC call */ if (!(slurmctld_conf.debug_flags & DEBUG_FLAG_NO_CONF_HASH) && (node_reg_stat_msg->hash_val != NO_VAL) && (node_reg_stat_msg->hash_val != slurm_get_hash_val())) { error("Node %s appears to have a different slurm.conf " "than the slurmctld. This could cause issues " "with communication and functionality. " "Please review both files and make sure they " "are the same. If this is expected ignore, and " "set DebugFlags=NO_CONF_HASH in your slurm.conf.", node_reg_stat_msg->node_name); } if (!running_composite) lock_slurmctld(job_write_lock); #ifdef HAVE_FRONT_END /* Operates only on front-end */ error_code = validate_nodes_via_front_end(node_reg_stat_msg, msg->protocol_version, &newly_up); #else validate_jobs_on_node(node_reg_stat_msg); error_code = validate_node_specs(node_reg_stat_msg, msg->protocol_version, &newly_up); #endif if (!running_composite) unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_node_registration"); if (newly_up) { queue_job_scheduler(); } } /* return result */ if (error_code) { error("_slurm_rpc_node_registration node=%s: %s", node_reg_stat_msg->node_name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_node_registration complete for %s %s", node_reg_stat_msg->node_name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); } } /* _slurm_rpc_job_alloc_info - process RPC to get details on existing job */ static void _slurm_rpc_job_alloc_info(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; slurm_msg_t response_msg; struct job_record *job_ptr; DEF_TIMERS; job_alloc_info_msg_t *job_info_msg = (job_alloc_info_msg_t *) msg->data; job_alloc_info_response_msg_t job_info_resp_msg; /* Locks: Read config, job, read node */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_JOB_ALLOCATION_INFO from uid=%d", uid); /* do RPC call */ lock_slurmctld(job_read_lock); error_code = job_alloc_info(uid, job_info_msg->job_id, &job_ptr); END_TIMER2("_slurm_rpc_job_alloc_info"); /* return result */ if (error_code || (job_ptr == NULL) || (job_ptr->job_resrcs == NULL)) { unlock_slurmctld(job_read_lock); debug2("_slurm_rpc_job_alloc_info: JobId=%u, uid=%u: %s", job_info_msg->job_id, uid, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { info("_slurm_rpc_job_alloc_info JobId=%u NodeList=%s %s", job_info_msg->job_id, job_ptr->nodes, TIME_STR); /* send job_ID and node_name_ptr */ job_info_resp_msg.num_cpu_groups = job_ptr->job_resrcs-> cpu_array_cnt; job_info_resp_msg.cpu_count_reps = xmalloc(sizeof(uint32_t) * job_ptr->job_resrcs->cpu_array_cnt); memcpy(job_info_resp_msg.cpu_count_reps, job_ptr->job_resrcs->cpu_array_reps, (sizeof(uint32_t) * job_ptr->job_resrcs->cpu_array_cnt)); job_info_resp_msg.cpus_per_node = xmalloc(sizeof(uint16_t) * job_ptr->job_resrcs->cpu_array_cnt); memcpy(job_info_resp_msg.cpus_per_node, job_ptr->job_resrcs->cpu_array_value, (sizeof(uint16_t) * job_ptr->job_resrcs->cpu_array_cnt)); job_info_resp_msg.error_code = error_code; job_info_resp_msg.job_id = job_info_msg->job_id; job_info_resp_msg.node_addr = xmalloc(sizeof(slurm_addr_t) * job_ptr->node_cnt); memcpy(job_info_resp_msg.node_addr, job_ptr->node_addr, (sizeof(slurm_addr_t) * job_ptr->node_cnt)); job_info_resp_msg.node_cnt = job_ptr->node_cnt; job_info_resp_msg.node_list = xstrdup(job_ptr->nodes); job_info_resp_msg.select_jobinfo = select_g_select_jobinfo_copy(job_ptr->select_jobinfo); unlock_slurmctld(job_read_lock); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.msg_type = RESPONSE_JOB_ALLOCATION_INFO; response_msg.data = &job_info_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); select_g_select_jobinfo_free(job_info_resp_msg.select_jobinfo); xfree(job_info_resp_msg.cpu_count_reps); xfree(job_info_resp_msg.cpus_per_node); xfree(job_info_resp_msg.node_addr); xfree(job_info_resp_msg.node_list); } } /* _slurm_rpc_job_alloc_info_lite - process RPC to get minor details on existing job */ static void _slurm_rpc_job_alloc_info_lite(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS, i, j; slurm_msg_t response_msg; struct job_record *job_ptr; DEF_TIMERS; job_alloc_info_msg_t *job_info_msg = (job_alloc_info_msg_t *) msg->data; resource_allocation_response_msg_t job_info_resp_msg; /* Locks: Read config, job, read node */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_JOB_ALLOCATION_INFO_LITE from uid=%d", uid); /* do RPC call */ lock_slurmctld(job_read_lock); error_code = job_alloc_info(uid, job_info_msg->job_id, &job_ptr); END_TIMER2("_slurm_rpc_job_alloc_info_lite"); /* return result */ if (error_code || (job_ptr == NULL) || (job_ptr->job_resrcs == NULL)) { unlock_slurmctld(job_read_lock); debug2("_slurm_rpc_job_alloc_info_lite: JobId=%u, uid=%u: %s", job_info_msg->job_id, uid, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug("_slurm_rpc_job_alloc_info_lite JobId=%u NodeList=%s %s", job_info_msg->job_id, job_ptr->nodes, TIME_STR); bzero(&job_info_resp_msg, sizeof(resource_allocation_response_msg_t)); /* send job_ID and node_name_ptr */ if (bit_equal(job_ptr->node_bitmap, job_ptr->job_resrcs->node_bitmap)) { job_info_resp_msg.num_cpu_groups = job_ptr->job_resrcs-> cpu_array_cnt; job_info_resp_msg.cpu_count_reps = xmalloc(sizeof(uint32_t) * job_ptr->job_resrcs-> cpu_array_cnt); memcpy(job_info_resp_msg.cpu_count_reps, job_ptr->job_resrcs->cpu_array_reps, (sizeof(uint32_t) * job_ptr->job_resrcs->cpu_array_cnt)); job_info_resp_msg.cpus_per_node = xmalloc(sizeof(uint16_t) * job_ptr->job_resrcs-> cpu_array_cnt); memcpy(job_info_resp_msg.cpus_per_node, job_ptr->job_resrcs->cpu_array_value, (sizeof(uint16_t) * job_ptr->job_resrcs->cpu_array_cnt)); } else { /* Job has changed size, rebuild CPU count info */ job_info_resp_msg.num_cpu_groups = job_ptr->node_cnt; job_info_resp_msg.cpu_count_reps = xmalloc(sizeof(uint32_t) * job_ptr->node_cnt); job_info_resp_msg.cpus_per_node = xmalloc(sizeof(uint32_t) * job_ptr->node_cnt); for (i=0, j=-1; i<job_ptr->job_resrcs->nhosts; i++) { if (job_ptr->job_resrcs->cpus[i] == 0) continue; if ((j == -1) || (job_info_resp_msg.cpus_per_node[j] != job_ptr->job_resrcs->cpus[i])) { j++; job_info_resp_msg.cpus_per_node[j] = job_ptr->job_resrcs->cpus[i]; job_info_resp_msg.cpu_count_reps[j] = 1; } else { job_info_resp_msg.cpu_count_reps[j]++; } } job_info_resp_msg.num_cpu_groups = j + 1; } job_info_resp_msg.account = xstrdup(job_ptr->account); job_info_resp_msg.alias_list = xstrdup(job_ptr->alias_list); job_info_resp_msg.error_code = error_code; job_info_resp_msg.job_id = job_info_msg->job_id; job_info_resp_msg.node_cnt = job_ptr->node_cnt; job_info_resp_msg.node_list = xstrdup(job_ptr->nodes); job_info_resp_msg.partition = xstrdup(job_ptr->partition); if (job_ptr->qos_ptr) { slurmdb_qos_rec_t *qos; qos = (slurmdb_qos_rec_t *)job_ptr->qos_ptr; job_info_resp_msg.qos = xstrdup(qos->name); } job_info_resp_msg.resv_name = xstrdup(job_ptr->resv_name); job_info_resp_msg.select_jobinfo = select_g_select_jobinfo_copy(job_ptr->select_jobinfo); if (job_ptr->details->env_cnt) { job_info_resp_msg.env_size = job_ptr->details->env_cnt; job_info_resp_msg.environment = xmalloc(sizeof(char *) * job_info_resp_msg.env_size); for (i = 0; i < job_info_resp_msg.env_size; i++) { job_info_resp_msg.environment[i] = xstrdup(job_ptr->details->env_sup[i]); } } unlock_slurmctld(job_read_lock); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.msg_type = RESPONSE_JOB_ALLOCATION_INFO_LITE; response_msg.data = &job_info_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_free_resource_allocation_response_msg_members( &job_info_resp_msg); } } /* _slurm_rpc_job_sbcast_cred - process RPC to get details on existing job * plus sbcast credential */ static void _slurm_rpc_job_sbcast_cred(slurm_msg_t * msg) { #ifdef HAVE_FRONT_END slurm_send_rc_msg(msg, ESLURM_NOT_SUPPORTED); #else int error_code = SLURM_SUCCESS; slurm_msg_t response_msg; struct job_record *job_ptr = NULL; struct step_record *step_ptr; char *node_list = NULL; struct node_record *node_ptr; slurm_addr_t *node_addr = NULL; hostlist_t host_list = NULL; char *this_node_name; int node_inx = 0; uint32_t node_cnt; DEF_TIMERS; step_alloc_info_msg_t *job_info_msg = (step_alloc_info_msg_t *) msg->data; job_sbcast_cred_msg_t job_info_resp_msg; sbcast_cred_t *sbcast_cred; /* Locks: Read config, job, read node */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_JOB_SBCAST_CRED from uid=%d", uid); /* do RPC call */ lock_slurmctld(job_read_lock); error_code = job_alloc_info(uid, job_info_msg->job_id, &job_ptr); if (job_ptr && (job_info_msg->step_id != NO_VAL)) { step_ptr = find_step_record(job_ptr, job_info_msg->step_id); if (!step_ptr) { job_ptr = NULL; error_code = ESLURM_INVALID_JOB_ID; } else if (step_ptr->step_layout && (step_ptr->step_layout->node_cnt != job_ptr->node_cnt)) { node_cnt = step_ptr->step_layout->node_cnt; node_list = step_ptr->step_layout->node_list; if ((host_list = hostlist_create(node_list)) == NULL) { fatal("hostlist_create error for %s: %m", node_list); return; /* Avoid CLANG false positive */ } node_addr = xmalloc(sizeof(slurm_addr_t) * node_cnt); while ((this_node_name = hostlist_shift(host_list))) { if ((node_ptr = find_node_record(this_node_name))) { memcpy(&node_addr[node_inx++], &node_ptr->slurm_addr, sizeof(slurm_addr_t)); } else { error("Invalid node %s in Step=%u.%u", this_node_name, job_ptr->job_id, step_ptr->step_id); } free(this_node_name); } hostlist_destroy(host_list); } } if (job_ptr && !node_addr) { node_addr = job_ptr->node_addr; node_cnt = job_ptr->node_cnt; node_list = job_ptr->nodes; node_addr = xmalloc(sizeof(slurm_addr_t) * node_cnt); memcpy(node_addr, job_ptr->node_addr, (sizeof(slurm_addr_t) * node_cnt)); } END_TIMER2("_slurm_rpc_job_alloc_info"); /* return result */ if (error_code || (job_ptr == NULL)) { unlock_slurmctld(job_read_lock); debug2("_slurm_rpc_job_sbcast_cred: JobId=%u, uid=%u: %s", job_info_msg->job_id, uid, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else if ((sbcast_cred = create_sbcast_cred(slurmctld_config.cred_ctx, job_ptr->job_id, node_list, job_ptr->end_time)) == NULL){ unlock_slurmctld(job_read_lock); error("_slurm_rpc_job_sbcast_cred JobId=%u cred create error", job_info_msg->job_id); slurm_send_rc_msg(msg, SLURM_ERROR); } else { if (job_ptr && (job_info_msg->step_id != NO_VAL)) { info("_slurm_rpc_job_sbcast_cred Job=%u NodeList=%s %s", job_info_msg->job_id, node_list, TIME_STR); } else { info("_slurm_rpc_job_sbcast_cred Step=%u.%u " "NodeList=%s %s", job_info_msg->job_id, job_info_msg->step_id, node_list, TIME_STR); } job_info_resp_msg.job_id = job_ptr->job_id; job_info_resp_msg.node_addr = node_addr; job_info_resp_msg.node_cnt = node_cnt; job_info_resp_msg.node_list = xstrdup(node_list); job_info_resp_msg.sbcast_cred = sbcast_cred; unlock_slurmctld(job_read_lock); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.msg_type = RESPONSE_JOB_SBCAST_CRED; response_msg.data = &job_info_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); /* job_info_resp_msg.node_addr is pointer, * xfree(node_addr) is below */ xfree(job_info_resp_msg.node_list); delete_sbcast_cred(sbcast_cred); } xfree(node_addr); #endif } /* _slurm_rpc_ping - process ping RPC */ static void _slurm_rpc_ping(slurm_msg_t * msg) { /* We could authenticate here, if desired */ /* return result */ slurm_send_rc_msg(msg, SLURM_SUCCESS); } /* _slurm_rpc_reconfigure_controller - process RPC to re-initialize * slurmctld from configuration file * Anything you add to this function must be added to the * slurm_reconfigure function inside controller.c try * to keep these in sync. */ static void _slurm_rpc_reconfigure_controller(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; static bool in_progress = false; DEF_TIMERS; /* Locks: Write configuration, job, node and partition */ slurmctld_lock_t config_write_lock = { WRITE_LOCK, WRITE_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; info("Processing RPC: REQUEST_RECONFIGURE from uid=%d", uid); if (!validate_super_user(uid)) { error("Security violation, RECONFIGURE RPC from uid=%d", uid); error_code = ESLURM_USER_ID_MISSING; } if (in_progress || slurmctld_config.shutdown_time) error_code = EINPROGRESS; /* do RPC call */ if (error_code == SLURM_SUCCESS) { debug("sched: begin reconfiguration"); lock_slurmctld(config_write_lock); in_progress = true; error_code = read_slurm_conf(1, true); if (error_code == SLURM_SUCCESS) { _update_cred_key(); set_slurmctld_state_loc(); msg_to_slurmd(REQUEST_RECONFIGURE); } in_progress = false; slurm_sched_g_partition_change(); /* notify sched plugin */ unlock_slurmctld(config_write_lock); assoc_mgr_set_missing_uids(); start_power_mgr(&slurmctld_config.thread_id_power); trigger_reconfig(); } END_TIMER2("_slurm_rpc_reconfigure_controller"); /* return result */ if (error_code) { error("_slurm_rpc_reconfigure_controller: %s", slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { info("_slurm_rpc_reconfigure_controller: completed %s", TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); acct_storage_g_reconfig(acct_db_conn, 0); priority_g_reconfig(false); /* notify priority plugin too */ save_all_state(); /* has its own locks */ queue_job_scheduler(); } } /* _slurm_rpc_takeover - process takeover RPC */ static void _slurm_rpc_takeover(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); /* We could authenticate here, if desired */ if (!validate_super_user(uid)) { error("Security violation, TAKEOVER RPC from uid=%d", uid); error_code = ESLURM_USER_ID_MISSING; } else { /* takeover is not possible in controller mode */ /* return success */ info("Performing RPC: REQUEST_TAKEOVER : " "already in controller mode - skipping"); } slurm_send_rc_msg(msg, error_code); } /* _slurm_rpc_shutdown_controller - process RPC to shutdown slurmctld */ static void _slurm_rpc_shutdown_controller(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS, i; uint16_t options = 0; shutdown_msg_t *shutdown_msg = (shutdown_msg_t *) msg->data; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); /* Locks: Read node */ slurmctld_lock_t node_read_lock = { NO_LOCK, NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; if (!validate_super_user(uid)) { error("Security violation, SHUTDOWN RPC from uid=%d", uid); error_code = ESLURM_USER_ID_MISSING; } if (error_code); else if (msg->msg_type == REQUEST_CONTROL) { info("Performing RPC: REQUEST_CONTROL"); /* resume backup mode */ slurmctld_config.resume_backup = true; } else { info("Performing RPC: REQUEST_SHUTDOWN"); options = shutdown_msg->options; } /* do RPC call */ if (error_code) ; else if (options == 1) info("performing immeditate shutdown without state save"); else if (slurmctld_config.shutdown_time) debug2("shutdown RPC issued when already in progress"); else { if ((msg->msg_type == REQUEST_SHUTDOWN) && (options == 0)) { /* This means (msg->msg_type != REQUEST_CONTROL) */ lock_slurmctld(node_read_lock); msg_to_slurmd(REQUEST_SHUTDOWN); unlock_slurmctld(node_read_lock); } if (slurmctld_config.thread_id_sig) /* signal clean-up */ pthread_kill(slurmctld_config.thread_id_sig, SIGTERM); else { error("thread_id_sig undefined, hard shutdown"); slurmctld_config.shutdown_time = time(NULL); /* send REQUEST_SHUTDOWN_IMMEDIATE RPC */ slurmctld_shutdown(); } } if (msg->msg_type == REQUEST_CONTROL) { /* Wait for workload to dry up before sending reply. * One thread should remain, this one. */ for (i = 1; i < (CONTROL_TIMEOUT * 10); i++) { if (slurmctld_config.server_thread_count <= 1) break; usleep(100000); } if (slurmctld_config.server_thread_count > 1) error("REQUEST_CONTROL reply with %d active threads", slurmctld_config.server_thread_count); /* save_all_state(); performed by _slurmctld_background */ } slurm_send_rc_msg(msg, error_code); if ((error_code == SLURM_SUCCESS) && (options == 1) && (slurmctld_config.thread_id_sig)) pthread_kill(slurmctld_config.thread_id_sig, SIGABRT); } /* _slurm_rpc_shutdown_controller_immediate - process RPC to shutdown * slurmctld */ static void _slurm_rpc_shutdown_controller_immediate(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); if (!validate_super_user(uid)) { error("Security violation, SHUTDOWN_IMMEDIATE RPC from uid=%d", uid); error_code = ESLURM_USER_ID_MISSING; } /* do RPC call */ /* No op: just used to knock loose accept RPC thread */ if (error_code == SLURM_SUCCESS) debug("Performing RPC: REQUEST_SHUTDOWN_IMMEDIATE"); } /* _slurm_rpc_step_complete - process step completion RPC to note the * completion of a job step on at least some nodes. * If the job step is complete, it may * represent the termination of an entire job */ static void _slurm_rpc_step_complete(slurm_msg_t *msg, bool running_composite) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS, rc, rem; uint32_t step_rc; DEF_TIMERS; step_complete_msg_t *req = (step_complete_msg_t *)msg->data; /* Locks: Write job, write node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); bool dump_job = false, dump_node = false; /* init */ START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("Processing RPC: REQUEST_STEP_COMPLETE for %u.%u " "nodes %u-%u rc=%u uid=%d", req->job_id, req->job_step_id, req->range_first, req->range_last, req->step_rc, uid); if (!running_composite) { _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); } rc = step_partial_comp(req, uid, &rem, &step_rc); if (rc || rem) { /* some error or not totally done */ /* Note: Error printed within step_partial_comp */ if (!running_composite) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } slurm_send_rc_msg(msg, rc); if (!rc) /* partition completion */ schedule_job_save(); /* Has own locking */ return; } if (req->job_step_id == SLURM_BATCH_SCRIPT) { /* FIXME: test for error, possibly cause batch job requeue */ error_code = job_complete(req->job_id, uid, false, false, step_rc); if (!running_composite) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } END_TIMER2("_slurm_rpc_step_complete"); /* return result */ if (error_code) { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s JobId=%u: %s", __func__, req->job_id, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("sched: %s JobId=%u: %s", __func__, req->job_id, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); dump_job = true; } } else { error_code = job_step_complete(req->job_id, req->job_step_id, uid, false, step_rc); if (!running_composite) { unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); } END_TIMER2("_slurm_rpc_step_complete"); /* return result */ if (error_code) { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s 1 StepId=%u.%u %s", __func__, req->job_id, req->job_step_id, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("sched: %s StepId=%u.%u %s", __func__, req->job_id, req->job_step_id, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); dump_job = true; } } if (dump_job) (void) schedule_job_save(); /* Has own locking */ if (dump_node) (void) schedule_node_save(); /* Has own locking */ } /* _slurm_rpc_step_layout - return the step layout structure for * a job step, if it currently exists */ static void _slurm_rpc_step_layout(slurm_msg_t *msg) { int error_code = SLURM_SUCCESS; slurm_msg_t response_msg; DEF_TIMERS; job_step_id_msg_t *req = (job_step_id_msg_t *)msg->data; slurm_step_layout_t *step_layout = NULL; /* Locks: Read config job, write node */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); struct job_record *job_ptr = NULL; struct step_record *step_ptr = NULL; START_TIMER; debug2("Processing RPC: REQUEST_STEP_LAYOUT, from uid=%d", uid); lock_slurmctld(job_read_lock); error_code = job_alloc_info(uid, req->job_id, &job_ptr); END_TIMER2("_slurm_rpc_step_layout"); /* return result */ if (error_code || (job_ptr == NULL)) { unlock_slurmctld(job_read_lock); if (error_code == ESLURM_ACCESS_DENIED) { error("Security vioation, REQUEST_STEP_LAYOUT for " "JobId=%u from uid=%u", req->job_id, uid); } else { if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s: JobId=%u, uid=%u: %s", __func__, req->job_id, uid, slurm_strerror(error_code)); } slurm_send_rc_msg(msg, error_code); return; } step_ptr = find_step_record(job_ptr, req->step_id); if (!step_ptr) { unlock_slurmctld(job_read_lock); if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("%s: JobId=%u.%u Not Found", __func__, req->job_id, req->step_id); slurm_send_rc_msg(msg, ESLURM_INVALID_JOB_ID); return; } step_layout = slurm_step_layout_copy(step_ptr->step_layout); #ifdef HAVE_FRONT_END if (job_ptr->batch_host) step_layout->front_end = xstrdup(job_ptr->batch_host); #endif unlock_slurmctld(job_read_lock); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.msg_type = RESPONSE_STEP_LAYOUT; response_msg.data = step_layout; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_step_layout_destroy(step_layout); } /* _slurm_rpc_step_update - update a job step */ static void _slurm_rpc_step_update(slurm_msg_t *msg) { DEF_TIMERS; step_update_request_msg_t *req = (step_update_request_msg_t *) msg->data; /* Locks: Write job */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); int rc; START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_STEPS) info("Processing RPC: REQUEST_STEP_UPDATE, from uid=%d", uid); lock_slurmctld(job_write_lock); rc = update_step(req, uid); unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_step_update"); slurm_send_rc_msg(msg, rc); } /* _slurm_rpc_submit_batch_job - process RPC to submit a batch job */ static void _slurm_rpc_submit_batch_job(slurm_msg_t * msg) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS; DEF_TIMERS; uint32_t step_id = 0; struct job_record *job_ptr = NULL; slurm_msg_t response_msg; submit_response_msg_t submit_msg; job_desc_msg_t *job_desc_msg = (job_desc_msg_t *) msg->data; /* Locks: Read config, read job, read node, read partition */ slurmctld_lock_t job_read_lock = { READ_LOCK, READ_LOCK, READ_LOCK, READ_LOCK, NO_LOCK }; /* Locks: Write job, read node, read partition */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, READ_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); char *err_msg = NULL; bool reject_job = false; START_TIMER; debug2("Processing RPC: REQUEST_SUBMIT_BATCH_JOB from uid=%d", uid); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; /* do RPC call */ if ( (uid != job_desc_msg->user_id) && (!validate_super_user(uid)) ) { /* NOTE: Super root can submit a batch job for any user */ error_code = ESLURM_USER_ID_MISSING; error("Security violation, SUBMIT_JOB from uid=%d", uid); } if ((job_desc_msg->alloc_node == NULL) || (job_desc_msg->alloc_node[0] == '\0')) { error_code = ESLURM_INVALID_NODE_NAME; error("REQUEST_SUBMIT_BATCH_JOB lacks alloc_node from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* Locks are for job_submit plugin use */ lock_slurmctld(job_read_lock); error_code = validate_job_create_req(job_desc_msg,uid,&err_msg); unlock_slurmctld(job_read_lock); } dump_job_desc(job_desc_msg); if (error_code == SLURM_SUCCESS) { _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); START_TIMER; /* Restart after we have locks */ if (job_desc_msg->job_id != SLURM_BATCH_SCRIPT) { job_ptr = find_job_record(job_desc_msg->job_id); if (job_ptr && IS_JOB_FINISHED(job_ptr)) { if (IS_JOB_COMPLETING(job_ptr)) { info("Attempt to re-use active " "job id %u", job_ptr->job_id); slurm_send_rc_msg( msg, ESLURM_DUPLICATE_JOB_ID); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); goto fini; } job_ptr = NULL; /* OK to re-use job id */ } } else job_ptr = NULL; if (job_ptr) { /* Active job allocation */ #if defined HAVE_FRONT_END && !defined HAVE_BGQ && !defined HAVE_ALPS_CRAY /* Limited job step support */ /* Non-super users not permitted to run job steps on * front-end. A single slurmd can not handle a heavy * load. */ if (!validate_slurm_user(uid)) { info("Attempt to execute batch job step by " "uid=%d", uid); slurm_send_rc_msg(msg, ESLURM_NO_STEPS); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); goto fini; } #endif if (job_ptr->user_id != uid) { error("Security violation, uid=%d attempting " "to execute a step within job %u owned " "by user %u", uid, job_ptr->job_id, job_ptr->user_id); slurm_send_rc_msg(msg, ESLURM_USER_ID_MISSING); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); goto fini; } if (job_ptr->details && job_ptr->details->prolog_running) { slurm_send_rc_msg(msg, EAGAIN); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); goto fini; } error_code = _launch_batch_step(job_desc_msg, uid, &step_id, msg->protocol_version); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); END_TIMER2("_slurm_rpc_submit_batch_job"); if (error_code != SLURM_SUCCESS) { info("_launch_batch_step: %s", slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { info("_launch_batch_step StepId=%u.%u %s", job_desc_msg->job_id, step_id, TIME_STR); submit_msg.job_id = job_desc_msg->job_id; submit_msg.step_id = step_id; submit_msg.error_code = error_code; response_msg.msg_type = RESPONSE_SUBMIT_BATCH_JOB; response_msg.data = &submit_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); schedule_job_save(); } goto fini; } /* Create new job allocation */ error_code = job_allocate(job_desc_msg, job_desc_msg->immediate, false, NULL, 0, uid, &job_ptr, &err_msg, msg->protocol_version); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); END_TIMER2("_slurm_rpc_submit_batch_job"); if (job_desc_msg->immediate && (error_code != SLURM_SUCCESS)) error_code = ESLURM_CAN_NOT_START_IMMEDIATELY; } /* return result */ if ((error_code != SLURM_SUCCESS) && (error_code != ESLURM_JOB_HELD) && (error_code != ESLURM_NODE_NOT_AVAIL) && (error_code != ESLURM_QOS_THRES) && (error_code != ESLURM_RESERVATION_NOT_USABLE) && (error_code != ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE) && (error_code != ESLURM_POWER_NOT_AVAIL) && (error_code != ESLURM_POWER_RESERVED)) { reject_job = true; } if ((error_code == ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE) && (slurmctld_conf.enforce_part_limits != PARTITION_ENFORCE_NONE)) reject_job = true; if (reject_job) { info("_slurm_rpc_submit_batch_job: %s", slurm_strerror(error_code)); if (err_msg) slurm_send_rc_err_msg(msg, error_code, err_msg); else slurm_send_rc_msg(msg, error_code); } else if (!job_ptr) { /* Mostly to avoid CLANG error */ fatal("job_allocate failed to allocate job, rc=%d",error_code); } else { info("_slurm_rpc_submit_batch_job JobId=%u %s", job_ptr->job_id, TIME_STR); /* send job_ID */ submit_msg.job_id = job_ptr->job_id; submit_msg.step_id = SLURM_BATCH_SCRIPT; submit_msg.error_code = error_code; response_msg.msg_type = RESPONSE_SUBMIT_BATCH_JOB; response_msg.data = &submit_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); schedule_job_save(); /* Has own locks */ schedule_node_save(); /* Has own locks */ queue_job_scheduler(); } fini: xfree(err_msg); } /* _slurm_rpc_update_job - process RPC to update the configuration of a * job (e.g. priority) */ static void _slurm_rpc_update_job(slurm_msg_t * msg) { int error_code; DEF_TIMERS; job_desc_msg_t *job_desc_msg = (job_desc_msg_t *) msg->data; /* Locks: Write job, read node, read partition */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, READ_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_JOB from uid=%d", uid); /* do RPC call */ dump_job_desc(job_desc_msg); /* Insure everything that may be written to database is lower case */ xstrtolower(job_desc_msg->account); xstrtolower(job_desc_msg->wckey); lock_slurmctld(job_write_lock); if (job_desc_msg->job_id_str) error_code = update_job_str(msg, uid); else error_code = update_job(msg, uid); unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_update_job"); /* return result */ if (error_code) { info("_slurm_rpc_update_job JobId=%s uid=%d: %s", job_desc_msg->job_id_str, uid, slurm_strerror(error_code)); } else { info("_slurm_rpc_update_job complete JobId=%s uid=%d %s", job_desc_msg->job_id_str, uid, TIME_STR); /* Below functions provide their own locking */ schedule_job_save(); schedule_node_save(); queue_job_scheduler(); } } /* * slurm_drain_nodes - process a request to drain a list of nodes, * no-op for nodes already drained or draining * node_list IN - list of nodes to drain * reason IN - reason to drain the nodes * reason_uid IN - who set the reason * RET SLURM_SUCCESS or error code * NOTE: This is utilzed by plugins and not via RPC and it sets its * own locks. */ extern int slurm_drain_nodes(char *node_list, char *reason, uint32_t reason_uid) { int error_code; DEF_TIMERS; /* Locks: Write node */ slurmctld_lock_t node_write_lock = { NO_LOCK, NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; START_TIMER; lock_slurmctld(node_write_lock); error_code = drain_nodes(node_list, reason, reason_uid); unlock_slurmctld(node_write_lock); END_TIMER2("slurm_drain_nodes"); return error_code; } /* * slurm_fail_job - terminate a job due to a launch failure * no-op for jobs already terminated * job_id IN - slurm job id * IN job_state - desired job state (JOB_BOOT_FAIL, JOB_NODE_FAIL, etc.) * RET SLURM_SUCCESS or error code * NOTE: This is utilzed by plugins and not via RPC and it sets its * own locks. */ extern int slurm_fail_job(uint32_t job_id, uint32_t job_state) { int error_code; DEF_TIMERS; /* Locks: Write job and node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; START_TIMER; lock_slurmctld(job_write_lock); error_code = job_fail(job_id, job_state); unlock_slurmctld(job_write_lock); END_TIMER2("slurm_fail_job"); return error_code; } /* * _slurm_rpc_update_front_end - process RPC to update the configuration of a * front_end node (e.g. UP/DOWN) */ static void _slurm_rpc_update_front_end(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; update_front_end_msg_t *update_front_end_msg_ptr = (update_front_end_msg_t *) msg->data; /* Locks: write node */ slurmctld_lock_t node_write_lock = { NO_LOCK, NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_FRONT_END from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_FRONT_END RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(node_write_lock); error_code = update_front_end(update_front_end_msg_ptr); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_update_front_end"); } /* return result */ if (error_code) { info("_slurm_rpc_update_front_end for %s: %s", update_front_end_msg_ptr->name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_update_front_end complete for %s %s", update_front_end_msg_ptr->name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); } } /* * _slurm_rpc_update_node - process RPC to update the configuration of a * node (e.g. UP/DOWN) */ static void _slurm_rpc_update_node(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; update_node_msg_t *update_node_msg_ptr = (update_node_msg_t *) msg->data; /* Locks: Write job and write node */ slurmctld_lock_t node_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_NODE from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_NODE RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(node_write_lock); error_code = update_node(update_node_msg_ptr); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_update_node"); } /* return result */ if (error_code) { info("_slurm_rpc_update_node for %s: %s", update_node_msg_ptr->node_names, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_update_node complete for %s %s", update_node_msg_ptr->node_names, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); } /* Below functions provide their own locks */ schedule_node_save(); queue_job_scheduler(); trigger_reconfig(); } /* * _slurm_rpc_update_layout - process RPC to update the configuration of a * layout (e.g. params of entities) */ static void _slurm_rpc_update_layout(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; Buf buffer; DEF_TIMERS; update_layout_msg_t *msg_ptr = (update_layout_msg_t *) msg->data; int shrink_size; /* Locks: Write job and write node */ uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_LAYOUT from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_LAYOUT RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ buffer = init_buf(BUF_SIZE); packstr(msg_ptr->arg, buffer); shrink_size = (int)get_buf_offset(buffer) - size_buf(buffer); set_buf_offset(buffer, 0); grow_buf(buffer, shrink_size); /* Shrink actually */ error_code = layouts_update_layout(msg_ptr->layout, buffer); free_buf(buffer); END_TIMER2("_slurm_rpc_update_node"); } /* return result */ if (error_code) { info("_slurm_rpc_update_layout for %s: %s", msg_ptr->layout, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_update_layout complete for %s %s", msg_ptr->layout, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); } } /* _slurm_rpc_update_partition - process RPC to update the configuration * of a partition (e.g. UP/DOWN) */ static void _slurm_rpc_update_partition(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; update_part_msg_t *part_desc_ptr = (update_part_msg_t *) msg->data; /* Locks: Read config, write job, read node, write partition * NOTE: job write lock due to gang scheduler support */ slurmctld_lock_t part_write_lock = { READ_LOCK, WRITE_LOCK, READ_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_PARTITION from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_PARTITION RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ if (msg->msg_type == REQUEST_CREATE_PARTITION) { lock_slurmctld(part_write_lock); error_code = update_part(part_desc_ptr, true); unlock_slurmctld(part_write_lock); } else { lock_slurmctld(part_write_lock); error_code = update_part(part_desc_ptr, false); unlock_slurmctld(part_write_lock); } END_TIMER2("_slurm_rpc_update_partition"); } /* return result */ if (error_code) { info("_slurm_rpc_update_partition partition=%s: %s", part_desc_ptr->name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_update_partition complete for %s %s", part_desc_ptr->name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); schedule_part_save(); /* Has its locking */ queue_job_scheduler(); } } /* _slurm_rpc_update_powercap - process RPC to update the powercap */ static void _slurm_rpc_update_powercap(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; bool valid_cap = false; uint32_t min, max, orig_cap; update_powercap_msg_t *ptr = (update_powercap_msg_t *) msg->data; /* Locks: write configuration, read node */ slurmctld_lock_t config_write_lock = { WRITE_LOCK, NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_POWERCAP from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_POWERCAP RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(config_write_lock); if (ptr->power_cap == 0 || ptr->power_cap == INFINITE) { valid_cap = true; } else if (!power_layout_ready()) { /* Not using layouts/power framework */ valid_cap = true; } else { /* we need to set a cap if * the current value is 0 in order to * enable the capping system and get * the min and max values */ orig_cap = powercap_get_cluster_current_cap(); powercap_set_cluster_cap(INFINITE); min = powercap_get_cluster_min_watts(); max = powercap_get_cluster_max_watts(); if (min <= ptr->power_cap && max >= ptr->power_cap) valid_cap = true; else powercap_set_cluster_cap(orig_cap); } if (valid_cap) powercap_set_cluster_cap(ptr->power_cap); else error_code = ESLURM_INVALID_POWERCAP; unlock_slurmctld(config_write_lock); END_TIMER2("_slurm_rpc_update_powercap"); } /* return result */ if (error_code) { info("_slurm_rpc_update_powercap: %s", slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_update_powercap complete %s", TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); /* NOTE: These functions provide their own locks */ schedule(0); save_all_state(); } } /* _slurm_rpc_delete_partition - process RPC to delete a partition */ static void _slurm_rpc_delete_partition(slurm_msg_t * msg) { /* init */ int error_code = SLURM_SUCCESS; DEF_TIMERS; delete_part_msg_t *part_desc_ptr = (delete_part_msg_t *) msg->data; /* Locks: write job, read node, write partition */ slurmctld_lock_t part_write_lock = { NO_LOCK, WRITE_LOCK, READ_LOCK, WRITE_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_DELETE_PARTITION from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, DELETE_PARTITION RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(part_write_lock); error_code = delete_partition(part_desc_ptr); unlock_slurmctld(part_write_lock); END_TIMER2("_slurm_rpc_delete_partition"); } /* return result */ if (error_code) { info("_slurm_rpc_delete_partition partition=%s: %s", part_desc_ptr->name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { info("_slurm_rpc_delete_partition complete for %s %s", part_desc_ptr->name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); save_all_state(); /* Has own locking */ queue_job_scheduler(); } } /* _slurm_rpc_resv_create - process RPC to create a reservation */ static void _slurm_rpc_resv_create(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; resv_desc_msg_t *resv_desc_ptr = (resv_desc_msg_t *) msg->data; /* Locks: write node, read partition */ slurmctld_lock_t node_write_lock = { NO_LOCK, NO_LOCK, WRITE_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_CREATE_RESERVATION from uid=%d", uid); if (!validate_operator(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, CREATE_RESERVATION RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(node_write_lock); error_code = create_resv(resv_desc_ptr); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_resv_create"); } /* return result */ if (error_code) { if (resv_desc_ptr->name) { info("_slurm_rpc_resv_create reservation=%s: %s", resv_desc_ptr->name, slurm_strerror(error_code)); } else { info("_slurm_rpc_resv_create: %s", slurm_strerror(error_code)); } slurm_send_rc_msg(msg, error_code); } else { slurm_msg_t response_msg; reservation_name_msg_t resv_resp_msg; debug2("_slurm_rpc_resv_create complete for %s %s", resv_desc_ptr->name, TIME_STR); /* send reservation name */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; resv_resp_msg.name = resv_desc_ptr->name; response_msg.msg_type = RESPONSE_CREATE_RESERVATION; response_msg.data = &resv_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); queue_job_scheduler(); } } /* _slurm_rpc_resv_update - process RPC to update a reservation */ static void _slurm_rpc_resv_update(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; resv_desc_msg_t *resv_desc_ptr = (resv_desc_msg_t *) msg->data; /* Locks: write node, read partition */ slurmctld_lock_t node_write_lock = { NO_LOCK, NO_LOCK, WRITE_LOCK, READ_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_RESERVATION from uid=%d", uid); if (!validate_operator(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_RESERVATION RPC from uid=%d", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(node_write_lock); error_code = update_resv(resv_desc_ptr); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_resv_update"); } /* return result */ if (error_code) { info("_slurm_rpc_resv_update reservation=%s: %s", resv_desc_ptr->name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_resv_update complete for %s %s", resv_desc_ptr->name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); queue_job_scheduler(); } } /* _slurm_rpc_resv_delete - process RPC to delete a reservation */ static void _slurm_rpc_resv_delete(slurm_msg_t * msg) { /* init */ int error_code = SLURM_SUCCESS; DEF_TIMERS; reservation_name_msg_t *resv_desc_ptr = (reservation_name_msg_t *) msg->data; /* Locks: read job, write node */ slurmctld_lock_t node_write_lock = { NO_LOCK, READ_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_DELETE_RESERVATION from uid=%d", uid); if (!validate_operator(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, DELETE_RESERVATION RPC from uid=%d", uid); } else if (!resv_desc_ptr->name) { error_code = ESLURM_INVALID_PARTITION_NAME; error("Invalid DELETE_RESERVATION RPC from uid=%d, name is null", uid); } if (error_code == SLURM_SUCCESS) { /* do RPC call */ lock_slurmctld(node_write_lock); error_code = delete_resv(resv_desc_ptr); unlock_slurmctld(node_write_lock); END_TIMER2("_slurm_rpc_resv_delete"); } /* return result */ if (error_code) { info("_slurm_rpc_delete_reservation partition=%s: %s", resv_desc_ptr->name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { info("_slurm_rpc_delete_reservation complete for %s %s", resv_desc_ptr->name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); queue_job_scheduler(); } } /* _slurm_rpc_resv_show - process RPC to dump reservation info */ static void _slurm_rpc_resv_show(slurm_msg_t * msg) { resv_info_request_msg_t *resv_req_msg = (resv_info_request_msg_t *) msg->data; DEF_TIMERS; /* Locks: read node */ slurmctld_lock_t node_read_lock = { NO_LOCK, NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); slurm_msg_t response_msg; char *dump; int dump_size; START_TIMER; debug2("Processing RPC: REQUEST_RESERVATION_INFO from uid=%d", uid); if ((resv_req_msg->last_update - 1) >= last_resv_update) { debug2("_slurm_rpc_resv_show, no change"); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); } else { lock_slurmctld(node_read_lock); show_resv(&dump, &dump_size, uid, msg->protocol_version); unlock_slurmctld(node_read_lock); END_TIMER2("_slurm_rpc_resv_show"); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_RESERVATION_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } } /* _slurm_rpc_layout_show - process RPC to dump layout info */ static void _slurm_rpc_layout_show(slurm_msg_t * msg) { layout_info_request_msg_t *layout_req_msg = (layout_info_request_msg_t *) msg->data; DEF_TIMERS; slurm_msg_t response_msg; char *dump; int dump_size; static int high_buffer_size = (1024 * 1024); Buf buffer = init_buf(high_buffer_size); START_TIMER; debug2("Processing RPC: REQUEST_LAYOUT_INFO"); if (layout_req_msg->layout_type == NULL) { dump = slurm_get_layouts(); pack32((uint32_t) 2, buffer); /* 1 record + trailing \n */ packstr(dump, buffer); packstr("\n", buffer); /* to be consistent with * layouts internal prints */ xfree(dump); } else { if ( layouts_pack_layout(layout_req_msg->layout_type, layout_req_msg->entities, layout_req_msg->type, layout_req_msg->flags, buffer) != SLURM_SUCCESS) { debug2("%s: unable to get layout[%s]", __func__, layout_req_msg->layout_type); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); free_buf(buffer); return; } } dump_size = get_buf_offset(buffer); high_buffer_size = MAX(high_buffer_size, dump_size); dump = xfer_buf_data(buffer); END_TIMER2("_slurm_rpc_resv_show"); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_LAYOUT_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } /* _slurm_rpc_update_block - process RPC to update the configuration * of a block (e.g. FREE/ERROR/DELETE) */ static void _slurm_rpc_update_block(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; update_block_msg_t *block_desc_ptr = (update_block_msg_t *) msg->data; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); char *name = NULL; START_TIMER; debug2("Processing RPC: REQUEST_UPDATE_BLOCK from uid=%d", uid); if (!validate_super_user(uid)) { error_code = ESLURM_USER_ID_MISSING; error("Security violation, UPDATE_BLOCK RPC from uid=%d", uid); if (block_desc_ptr->bg_block_id) { name = block_desc_ptr->bg_block_id; } else if (block_desc_ptr->mp_str) { name = block_desc_ptr->mp_str; } } if (error_code == SLURM_SUCCESS) { /* do RPC call */ if (block_desc_ptr->bg_block_id) { error_code = select_g_update_block(block_desc_ptr); END_TIMER2("_slurm_rpc_update_block"); name = block_desc_ptr->bg_block_id; } else if (block_desc_ptr->mp_str) { error_code = select_g_update_sub_node(block_desc_ptr); END_TIMER2("_slurm_rpc_update_subbp"); name = block_desc_ptr->mp_str; } else { error("Unknown update for blocks"); error_code = SLURM_ERROR; END_TIMER2("_slurm_rpc_update_block"); } } /* return result */ if (error_code) { info("_slurm_rpc_update_block %s: %s", name, slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_update_block complete for %s %s", name, TIME_STR); slurm_send_rc_msg(msg, SLURM_SUCCESS); } } /* determine of nodes are ready for the job */ static void _slurm_rpc_job_ready(slurm_msg_t * msg) { int error_code, result; job_id_msg_t *id_msg = (job_id_msg_t *) msg->data; DEF_TIMERS; /* Locks: read job */ slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; slurm_msg_t response_msg; return_code_msg_t rc_msg; START_TIMER; lock_slurmctld(job_read_lock); error_code = job_node_ready(id_msg->job_id, &result); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_job_ready"); if (error_code) { debug2("_slurm_rpc_job_ready: %s", slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { debug2("_slurm_rpc_job_ready(%u)=%d %s", id_msg->job_id, result, TIME_STR); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; rc_msg.return_code = result; response_msg.data = &rc_msg; if(_is_prolog_finished(id_msg->job_id)) { response_msg.msg_type = RESPONSE_JOB_READY; } else { response_msg.msg_type = RESPONSE_PROLOG_EXECUTING; } slurm_send_node_msg(msg->conn_fd, &response_msg); } } /* Check if prolog has already finished */ static int _is_prolog_finished(uint32_t job_id) { int is_running = 0; struct job_record *job_ptr; slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; lock_slurmctld(job_read_lock); job_ptr = find_job_record(job_id); if (job_ptr) { is_running = (job_ptr->state_reason != WAIT_PROLOG); } unlock_slurmctld(job_read_lock); return is_running; } /* get node select info plugin */ static void _slurm_rpc_block_info(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; Buf buffer = NULL; block_info_request_msg_t *sel_req_msg = (block_info_request_msg_t *) msg->data; slurm_msg_t response_msg; /* Locks: read config */ slurmctld_lock_t config_read_lock = { READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; DEF_TIMERS; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_BLOCK_INFO from uid=%d", uid); lock_slurmctld(config_read_lock); if ((slurmctld_conf.private_data & PRIVATE_DATA_NODES) && !validate_operator(uid)) { error_code = ESLURM_ACCESS_DENIED; error("Security violation, REQUEST_BLOCK_INFO RPC from uid=%d", uid); } unlock_slurmctld(config_read_lock); if (error_code == SLURM_SUCCESS) { error_code = select_g_pack_select_info( sel_req_msg->last_update, sel_req_msg->show_flags, &buffer, msg->protocol_version); } END_TIMER2("_slurm_rpc_block_info"); if (error_code) { debug3("_slurm_rpc_block_info: %s", slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_BLOCK_INFO; response_msg.data = get_buf_data(buffer); response_msg.data_size = get_buf_offset(buffer); /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); if (buffer) free_buf(buffer); } } /* get node select info plugin */ static void _slurm_rpc_burst_buffer_info(slurm_msg_t * msg) { uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); void *resp_buffer = NULL; int resp_buffer_size = 0; int error_code = SLURM_SUCCESS; Buf buffer; DEF_TIMERS; START_TIMER; debug2("Processing RPC: REQUEST_BURST_BUFFER_INFO from uid=%d", uid); buffer = init_buf(BUF_SIZE); if (validate_super_user(uid)) uid = 0; error_code = bb_g_state_pack(uid, buffer, msg->protocol_version); END_TIMER2(__func__); if (error_code) { debug("_slurm_rpc_burst_buffer_info: %s", slurm_strerror(error_code)); slurm_send_rc_msg(msg, error_code); } else { slurm_msg_t response_msg; resp_buffer_size = get_buf_offset(buffer); resp_buffer = xfer_buf_data(buffer); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_BURST_BUFFER_INFO; response_msg.data = resp_buffer; response_msg.data_size = resp_buffer_size; slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(resp_buffer); } } /* Reset the job credential key based upon configuration parameters. * NOTE: READ lock_slurmctld config before entry */ static void _update_cred_key(void) { slurm_cred_ctx_key_update(slurmctld_config.cred_ctx, slurmctld_conf.job_credential_private_key); } inline static void _slurm_rpc_suspend(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; suspend_msg_t *sus_ptr = (suspend_msg_t *) msg->data; /* Locks: write job and node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); char *op; START_TIMER; switch (sus_ptr->op) { case SUSPEND_JOB: op = "suspend"; break; case RESUME_JOB: op = "resume"; break; default: op = "unknown"; } info("Processing RPC: REQUEST_SUSPEND(%s) from uid=%u", op, (unsigned int) uid); lock_slurmctld(job_write_lock); if (sus_ptr->job_id_str) { error_code = job_suspend2(sus_ptr, uid, msg->conn_fd, true, msg->protocol_version); } else { error_code = job_suspend(sus_ptr, uid, msg->conn_fd, true, msg->protocol_version); } unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_suspend"); if (!sus_ptr->job_id_str) xstrfmtcat(sus_ptr->job_id_str, "%u", sus_ptr->job_id); if (error_code) { info("_slurm_rpc_suspend(%s) for %s %s", op, sus_ptr->job_id_str, slurm_strerror(error_code)); } else { info("_slurm_rpc_suspend(%s) for %s %s", op, sus_ptr->job_id_str, TIME_STR); schedule_job_save(); /* Has own locking */ if (sus_ptr->op == SUSPEND_JOB) queue_job_scheduler(); } } inline static void _slurm_rpc_top_job(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; top_job_msg_t *top_ptr = (top_job_msg_t *) msg->data; /* Locks: write job */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); debug("Processing RPC: REQUEST_TOP_JOB from uid=%u", (unsigned int)uid); START_TIMER; lock_slurmctld(job_write_lock); error_code = job_set_top(top_ptr, uid, msg->conn_fd, msg->protocol_version); unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_top"); if (error_code) { info("%s for %s %s", __func__, top_ptr->job_id_str, slurm_strerror(error_code)); } else { info("%s for %s %s", __func__, top_ptr->job_id_str, TIME_STR); } } inline static void _slurm_rpc_requeue(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; requeue_msg_t *req_ptr = (requeue_msg_t *)msg->data; /* Locks: write job and node */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; info("%s: Processing RPC: REQUEST_JOB_REQUEUE from uid=%d", __func__, uid); lock_slurmctld(job_write_lock); if (req_ptr->job_id_str) { error_code = job_requeue2(uid, req_ptr, msg->conn_fd, msg->protocol_version, false); } else { error_code = job_requeue(uid, req_ptr->job_id, msg->conn_fd, msg->protocol_version, false, req_ptr->state); } unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_requeue"); if (error_code) { if (!req_ptr->job_id_str) xstrfmtcat(req_ptr->job_id_str, "%u", req_ptr->job_id); info("%s: %s: %s", __func__, req_ptr->job_id_str, slurm_strerror(error_code)); } /* Functions below provide their own locking */ schedule_job_save(); } /* Assorted checkpoint operations */ inline static void _slurm_rpc_checkpoint(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; checkpoint_msg_t *ckpt_ptr = (checkpoint_msg_t *) msg->data; /* Locks: write job lock, read node lock */ slurmctld_lock_t job_write_lock = { NO_LOCK, WRITE_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); char *op; START_TIMER; switch (ckpt_ptr->op) { case CHECK_ABLE: op = "able"; break; case CHECK_CREATE: op = "create"; break; case CHECK_DISABLE: op = "disable"; break; case CHECK_ENABLE: op = "enable"; break; case CHECK_ERROR: op = "error"; break; case CHECK_REQUEUE: op = "requeue"; break; case CHECK_RESTART: op = "restart"; break; case CHECK_VACATE: op = "vacate"; break; default: op = "unknown"; } debug2("Processing RPC: REQUEST_CHECKPOINT(%s) from uid=%u", op, (unsigned int) uid); /* do RPC call and send reply */ lock_slurmctld(job_write_lock); if (ckpt_ptr->op == CHECK_RESTART) { error_code = job_restart(ckpt_ptr, uid, msg->conn_fd, msg->protocol_version); } else if (ckpt_ptr->step_id == SLURM_BATCH_SCRIPT) { error_code = job_checkpoint(ckpt_ptr, uid, msg->conn_fd, msg->protocol_version); } else { error_code = job_step_checkpoint(ckpt_ptr, uid, msg->conn_fd, msg->protocol_version); } unlock_slurmctld(job_write_lock); END_TIMER2("_slurm_rpc_checkpoint"); if (error_code) { if (ckpt_ptr->step_id == SLURM_BATCH_SCRIPT) { info("_slurm_rpc_checkpoint %s %u: %s", op, ckpt_ptr->job_id, slurm_strerror(error_code)); } else { info("_slurm_rpc_checkpoint %s %u.%u: %s", op, ckpt_ptr->job_id, ckpt_ptr->step_id, slurm_strerror(error_code)); } } else { if (ckpt_ptr->step_id == SLURM_BATCH_SCRIPT) { info("_slurm_rpc_checkpoint %s for %u %s", op, ckpt_ptr->job_id, TIME_STR); } else { info("_slurm_rpc_checkpoint %s for %u.%u %s", op, ckpt_ptr->job_id, ckpt_ptr->step_id, TIME_STR); } if ((ckpt_ptr->op != CHECK_ABLE) && (ckpt_ptr->op != CHECK_ERROR)) { /* job state changed, save it */ /* NOTE: This function provides it own locks */ schedule_job_save(); } } } inline static void _slurm_rpc_checkpoint_comp(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; checkpoint_comp_msg_t *ckpt_ptr = (checkpoint_comp_msg_t *) msg->data; /* Locks: read job */ slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("Processing RPC: REQUEST_CHECKPOINT_COMP from uid=%d", uid); /* do RPC call and send reply */ lock_slurmctld(job_read_lock); error_code = job_step_checkpoint_comp(ckpt_ptr, uid, msg->conn_fd, msg->protocol_version); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_checkpoint_comp"); if (error_code) { info("_slurm_rpc_checkpoint_comp %u.%u: %s", ckpt_ptr->job_id, ckpt_ptr->step_id, slurm_strerror(error_code)); } else { info("_slurm_rpc_checkpoint_comp %u.%u %s", ckpt_ptr->job_id, ckpt_ptr->step_id, TIME_STR); } } inline static void _slurm_rpc_checkpoint_task_comp(slurm_msg_t * msg) { int error_code = SLURM_SUCCESS; DEF_TIMERS; checkpoint_task_comp_msg_t *ckpt_ptr; /* Locks: read job */ slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); ckpt_ptr = (checkpoint_task_comp_msg_t *) msg->data; START_TIMER; debug2("Processing RPC: REQUEST_CHECKPOINT_TASK_COMP from uid=%d", uid); /* do RPC call and send reply */ lock_slurmctld(job_read_lock); error_code = job_step_checkpoint_task_comp(ckpt_ptr, uid, msg->conn_fd, msg->protocol_version); unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_checkpoint_task_comp"); if (error_code) { info("_slurm_rpc_checkpoint_task_comp %u.%u: %s", ckpt_ptr->job_id, ckpt_ptr->step_id, slurm_strerror(error_code)); } else { info("_slurm_rpc_checkpoint_task_comp %u.%u %s", ckpt_ptr->job_id, ckpt_ptr->step_id, TIME_STR); } } /* Copy an array of type char **, xmalloc() the array and xstrdup() the * strings in the array */ extern char ** xduparray(uint32_t size, char ** array) { int i; char ** result; if (size == 0) return (char **)NULL; result = (char **) xmalloc(sizeof(char *) * size); for (i=0; i<size; i++) result[i] = xstrdup(array[i]); return result; } /* Like xduparray(), but performs one xmalloc(). The output format of this * must be identical to _read_data_array_from_file() */ static char ** _xduparray2(uint32_t size, char ** array) { int i, len = 0; char *ptr, ** result; if (size == 0) return (char **) NULL; for (i=0; i<size; i++) len += (strlen(array[i]) + 1); ptr = xmalloc(len); result = (char **) xmalloc(sizeof(char *) * size); for (i=0; i<size; i++) { result[i] = ptr; len = strlen(array[i]); strcpy(ptr, array[i]); ptr += (len + 1); } return result; } /* _launch_batch_step * IN: job_desc_msg from _slurm_rpc_submit_batch_job() but with jobid set * which means it's trying to launch within a pre-existing allocation. * IN: uid launching this batch job, which has already been validated. * OUT: SLURM error code if launch fails, or SLURM_SUCCESS */ static int _launch_batch_step(job_desc_msg_t *job_desc_msg, uid_t uid, uint32_t *step_id, uint16_t protocol_version) { struct job_record *job_ptr; time_t now = time(NULL); int error_code = SLURM_SUCCESS; batch_job_launch_msg_t *launch_msg_ptr; agent_arg_t *agent_arg_ptr; struct node_record *node_ptr; /* * Create a job step. Note that a credential is not necessary, * since the slurmctld will be submitting this job directly to * the slurmd. */ job_step_create_request_msg_t req_step_msg; struct step_record *step_rec; if (job_desc_msg->array_inx && job_desc_msg->array_inx[0]) return ESLURM_INVALID_ARRAY; /* * As far as the step record in slurmctld goes, we are just * launching a batch script which will be run on a single * processor on a single node. The actual launch request sent * to the slurmd should contain the proper allocation values * for subsequent srun jobs within the batch script. */ memset(&req_step_msg, 0, sizeof(job_step_create_request_msg_t)); req_step_msg.job_id = job_desc_msg->job_id; req_step_msg.user_id = uid; req_step_msg.min_nodes = 1; req_step_msg.max_nodes = 0; req_step_msg.cpu_count = 1; req_step_msg.num_tasks = 1; req_step_msg.task_dist = SLURM_DIST_CYCLIC; req_step_msg.name = job_desc_msg->name; error_code = step_create(&req_step_msg, &step_rec, true, protocol_version); xfree(req_step_msg.node_list); /* may be set by step_create */ if (error_code != SLURM_SUCCESS) return error_code; /* * TODO: check all instances of step_record to ensure there's no * problem with a null switch_job_info pointer. */ /* Get the allocation in order to construct the batch job * launch request for the slurmd. */ job_ptr = step_rec->job_ptr; /* TODO: need to address batch job step request options such as * the ability to run a batch job on a subset of the nodes in the * current allocation. * TODO: validate the specific batch job request vs. the * existing allocation. Note that subsequent srun steps within * the batch script will work within the full allocation, but * the batch step options can still provide default settings via * environment variables * * NOTE: for now we are *ignoring* most of the job_desc_msg * allocation-related settings. At some point we * should perform better error-checking, otherwise * the submitter will make some invalid assumptions * about how this job actually ran. */ job_ptr->time_last_active = now; /* Launch the batch job */ node_ptr = find_first_node_record(job_ptr->node_bitmap); if (node_ptr == NULL) { delete_step_record(job_ptr, step_rec->step_id); return ESLURM_INVALID_JOB_ID; } /* Initialization of data structures */ launch_msg_ptr = (batch_job_launch_msg_t *) xmalloc(sizeof(batch_job_launch_msg_t)); launch_msg_ptr->job_id = job_ptr->job_id; launch_msg_ptr->step_id = step_rec->step_id; launch_msg_ptr->gid = job_ptr->group_id; launch_msg_ptr->uid = uid; launch_msg_ptr->nodes = xstrdup(job_ptr->alias_list); launch_msg_ptr->partition = xstrdup(job_ptr->partition); launch_msg_ptr->restart_cnt = job_ptr->restart_cnt; if (job_ptr->details) { launch_msg_ptr->pn_min_memory = job_ptr->details-> pn_min_memory; } if (make_batch_job_cred(launch_msg_ptr, job_ptr, protocol_version)) { error("aborting batch step %u.%u", job_ptr->job_id, job_ptr->group_id); xfree(launch_msg_ptr->nodes); xfree(launch_msg_ptr); delete_step_record(job_ptr, step_rec->step_id); return SLURM_ERROR; } launch_msg_ptr->std_err = xstrdup(job_desc_msg->std_err); launch_msg_ptr->std_in = xstrdup(job_desc_msg->std_in); launch_msg_ptr->std_out = xstrdup(job_desc_msg->std_out); launch_msg_ptr->acctg_freq = xstrdup(job_desc_msg->acctg_freq); launch_msg_ptr->open_mode = job_desc_msg->open_mode; launch_msg_ptr->work_dir = xstrdup(job_desc_msg->work_dir); launch_msg_ptr->argc = job_desc_msg->argc; launch_msg_ptr->argv = xduparray(job_desc_msg->argc, job_desc_msg->argv); launch_msg_ptr->array_job_id = job_ptr->array_job_id; launch_msg_ptr->array_task_id = job_ptr->array_task_id; launch_msg_ptr->spank_job_env_size = job_ptr->spank_job_env_size; launch_msg_ptr->spank_job_env = xduparray(job_ptr->spank_job_env_size, job_ptr->spank_job_env); launch_msg_ptr->script = xstrdup(job_desc_msg->script); launch_msg_ptr->environment = _xduparray2(job_desc_msg->env_size, job_desc_msg->environment); launch_msg_ptr->envc = job_desc_msg->env_size; launch_msg_ptr->job_mem = job_desc_msg->pn_min_memory; launch_msg_ptr->cpus_per_task = job_desc_msg->cpus_per_task; /* job_ptr->total_cpus represents the total number of CPUs available * for this step (overcommit not supported yet). If job_desc_msg * contains a reasonable min_cpus request, use that value; * otherwise default to the allocation processor request. */ launch_msg_ptr->ntasks = job_ptr->total_cpus; if (job_desc_msg->min_cpus > 0 && job_desc_msg->min_cpus < launch_msg_ptr->ntasks) launch_msg_ptr->ntasks = job_desc_msg->min_cpus; launch_msg_ptr->num_cpu_groups = job_ptr->job_resrcs->cpu_array_cnt; launch_msg_ptr->cpus_per_node = xmalloc(sizeof(uint16_t) * job_ptr->job_resrcs->cpu_array_cnt); memcpy(launch_msg_ptr->cpus_per_node, job_ptr->job_resrcs->cpu_array_value, (sizeof(uint16_t) * job_ptr->job_resrcs->cpu_array_cnt)); launch_msg_ptr->cpu_count_reps = xmalloc(sizeof(uint32_t) * job_ptr->job_resrcs->cpu_array_cnt); memcpy(launch_msg_ptr->cpu_count_reps, job_ptr->job_resrcs->cpu_array_reps, (sizeof(uint32_t) * job_ptr->job_resrcs->cpu_array_cnt)); launch_msg_ptr->select_jobinfo = select_g_select_jobinfo_copy( job_ptr->select_jobinfo); if (job_desc_msg->profile != ACCT_GATHER_PROFILE_NOT_SET) launch_msg_ptr->profile = job_desc_msg->profile; else launch_msg_ptr->profile = job_ptr->profile; /* FIXME: for some reason these CPU arrays total all the CPUs * actually allocated, rather than totaling up to the requested * CPU count for the allocation. * This means that SLURM_TASKS_PER_NODE will not match with * SLURM_NTASKS in the batch script environment. */ agent_arg_ptr = (agent_arg_t *) xmalloc(sizeof(agent_arg_t)); agent_arg_ptr->node_count = 1; agent_arg_ptr->retry = 0; xassert(job_ptr->batch_host); #ifdef HAVE_FRONT_END if (job_ptr->front_end_ptr) agent_arg_ptr->protocol_version = job_ptr->front_end_ptr->protocol_version; #else if ((node_ptr = find_node_record(job_ptr->batch_host))) agent_arg_ptr->protocol_version = node_ptr->protocol_version; #endif agent_arg_ptr->hostlist = hostlist_create(job_ptr->batch_host); if (!agent_arg_ptr->hostlist) fatal("Invalid batch host: %s", job_ptr->batch_host); agent_arg_ptr->msg_type = REQUEST_BATCH_JOB_LAUNCH; agent_arg_ptr->msg_args = (void *) launch_msg_ptr; /* Launch the RPC via agent */ agent_queue_request(agent_arg_ptr); *step_id = step_rec->step_id; return SLURM_SUCCESS; } inline static void _slurm_rpc_trigger_clear(slurm_msg_t * msg) { int rc; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); trigger_info_msg_t * trigger_ptr = (trigger_info_msg_t *) msg->data; DEF_TIMERS; START_TIMER; debug("Processing RPC: REQUEST_TRIGGER_CLEAR from uid=%d", uid); rc = trigger_clear(uid, trigger_ptr); END_TIMER2("_slurm_rpc_trigger_clear"); slurm_send_rc_msg(msg, rc); } inline static void _slurm_rpc_trigger_get(slurm_msg_t * msg) { uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); trigger_info_msg_t *resp_data; trigger_info_msg_t * trigger_ptr = (trigger_info_msg_t *) msg->data; slurm_msg_t response_msg; DEF_TIMERS; START_TIMER; debug("Processing RPC: REQUEST_TRIGGER_GET from uid=%d", uid); resp_data = trigger_get(uid, trigger_ptr); END_TIMER2("_slurm_rpc_trigger_get"); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_TRIGGER_GET; response_msg.data = resp_data; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_free_trigger_msg(resp_data); } inline static void _slurm_rpc_trigger_set(slurm_msg_t * msg) { int rc; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); gid_t gid = g_slurm_auth_get_gid(msg->auth_cred, slurmctld_config.auth_info); trigger_info_msg_t * trigger_ptr = (trigger_info_msg_t *) msg->data; DEF_TIMERS; START_TIMER; debug("Processing RPC: REQUEST_TRIGGER_SET from uid=%d", uid); rc = trigger_set(uid, gid, trigger_ptr); END_TIMER2("_slurm_rpc_trigger_set"); slurm_send_rc_msg(msg, rc); } inline static void _slurm_rpc_trigger_pull(slurm_msg_t * msg) { int rc; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); trigger_info_msg_t * trigger_ptr = (trigger_info_msg_t *) msg->data; DEF_TIMERS; START_TIMER; /* NOTE: No locking required here, trigger_pull only needs to lock * it's own internal trigger structure */ debug("Processing RPC: REQUEST_TRIGGER_PULL from uid=%u", (unsigned int) uid); if (!validate_slurm_user(uid)) { rc = ESLURM_USER_ID_MISSING; error("Security violation, REQUEST_TRIGGER_PULL RPC " "from uid=%d", uid); } else rc = trigger_pull(trigger_ptr); END_TIMER2("_slurm_rpc_trigger_pull"); slurm_send_rc_msg(msg, rc); } inline static void _slurm_rpc_get_topo(slurm_msg_t * msg) { topo_info_response_msg_t *topo_resp_msg; slurm_msg_t response_msg; int i; /* Locks: read node lock */ slurmctld_lock_t node_read_lock = { NO_LOCK, NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK }; DEF_TIMERS; START_TIMER; lock_slurmctld(node_read_lock); topo_resp_msg = xmalloc(sizeof(topo_info_response_msg_t)); topo_resp_msg->record_count = switch_record_cnt; topo_resp_msg->topo_array = xmalloc(sizeof(topo_info_t) * topo_resp_msg->record_count); for (i=0; i<topo_resp_msg->record_count; i++) { topo_resp_msg->topo_array[i].level = switch_record_table[i].level; topo_resp_msg->topo_array[i].link_speed = switch_record_table[i].link_speed; topo_resp_msg->topo_array[i].name = xstrdup(switch_record_table[i].name); topo_resp_msg->topo_array[i].nodes = xstrdup(switch_record_table[i].nodes); topo_resp_msg->topo_array[i].switches = xstrdup(switch_record_table[i].switches); } unlock_slurmctld(node_read_lock); END_TIMER2("_slurm_rpc_get_topo"); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_TOPO_INFO; response_msg.data = topo_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_free_topo_info_msg(topo_resp_msg); } inline static void _slurm_rpc_get_powercap(slurm_msg_t * msg) { powercap_info_msg_t *powercap_resp_msg, *ptr; slurm_msg_t response_msg; /* Locks: read config lock */ slurmctld_lock_t config_read_lock = { READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; DEF_TIMERS; START_TIMER; lock_slurmctld(config_read_lock); powercap_resp_msg = xmalloc(sizeof(powercap_info_msg_t)); ptr = powercap_resp_msg; ptr->power_cap = powercap_get_cluster_current_cap(); ptr->min_watts = powercap_get_cluster_min_watts(); ptr->cur_max_watts = powercap_get_cluster_current_max_watts(); ptr->adj_max_watts = powercap_get_cluster_adjusted_max_watts(); ptr->max_watts = powercap_get_cluster_max_watts(); unlock_slurmctld(config_read_lock); END_TIMER2("_slurm_rpc_get_powercap"); slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_POWERCAP_INFO; response_msg.data = powercap_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_free_powercap_info_msg(powercap_resp_msg); } inline static void _slurm_rpc_job_notify(slurm_msg_t * msg) { int error_code; /* Locks: read job */ slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); job_notify_msg_t * notify_msg = (job_notify_msg_t *) msg->data; struct job_record *job_ptr; DEF_TIMERS; START_TIMER; debug("Processing RPC: REQUEST_JOB_NOTIFY from uid=%d", uid); /* do RPC call */ lock_slurmctld(job_read_lock); job_ptr = find_job_record(notify_msg->job_id); if (!job_ptr) error_code = ESLURM_INVALID_JOB_ID; else if ((job_ptr->user_id == uid) || validate_slurm_user(uid)) error_code = srun_user_message(job_ptr, notify_msg->message); else { error_code = ESLURM_USER_ID_MISSING; error("Security violation, REQUEST_JOB_NOTIFY RPC " "from uid=%d for jobid %u owner %d", uid, notify_msg->job_id, job_ptr->user_id); } unlock_slurmctld(job_read_lock); END_TIMER2("_slurm_rpc_job_notify"); slurm_send_rc_msg(msg, error_code); } inline static void _slurm_rpc_set_debug_flags(slurm_msg_t *msg) { uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); slurmctld_lock_t config_write_lock = { WRITE_LOCK, NO_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; set_debug_flags_msg_t *request_msg = (set_debug_flags_msg_t *) msg->data; uint64_t debug_flags; char *flag_string; debug2("Processing RPC: REQUEST_SET_DEBUG_FLAGS from uid=%d", uid); if (!validate_super_user(uid)) { error("set debug flags request from non-super user uid=%d", uid); slurm_send_rc_msg(msg, EACCES); return; } lock_slurmctld (config_write_lock); debug_flags = slurmctld_conf.debug_flags; debug_flags &= (~request_msg->debug_flags_minus); debug_flags |= request_msg->debug_flags_plus; slurm_set_debug_flags(debug_flags); slurmctld_conf.last_update = time(NULL); /* Reset cached debug_flags values */ log_set_debug_flags(); gs_reconfig(); gres_plugin_reconfig(NULL); acct_storage_g_reconfig(acct_db_conn, 0); priority_g_reconfig(false); select_g_reconfigure(); (void) slurm_sched_g_reconfig(); (void) switch_g_reconfig(); unlock_slurmctld (config_write_lock); flag_string = debug_flags2str(debug_flags); info("Set DebugFlags to %s", flag_string ? flag_string : "none"); xfree(flag_string); slurm_send_rc_msg(msg, SLURM_SUCCESS); } inline static void _slurm_rpc_set_debug_level(slurm_msg_t *msg) { int debug_level, old_debug_level; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); slurmctld_lock_t config_write_lock = { WRITE_LOCK, NO_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; set_debug_level_msg_t *request_msg = (set_debug_level_msg_t *) msg->data; log_options_t log_opts = LOG_OPTS_INITIALIZER; slurm_ctl_conf_t *conf; debug2("Processing RPC: REQUEST_SET_DEBUG_LEVEL from uid=%d", uid); if (!validate_super_user(uid)) { error("set debug level request from non-super user uid=%d", uid); slurm_send_rc_msg(msg, EACCES); return; } /* NOTE: not offset by LOG_LEVEL_INFO, since it's inconveniet * to provide negative values for scontrol */ debug_level = MIN (request_msg->debug_level, (LOG_LEVEL_END - 1)); debug_level = MAX (debug_level, LOG_LEVEL_QUIET); lock_slurmctld (config_write_lock); if (slurmctld_config.daemonize) { log_opts.stderr_level = LOG_LEVEL_QUIET; if (slurmctld_conf.slurmctld_logfile) { log_opts.logfile_level = debug_level; log_opts.syslog_level = LOG_LEVEL_QUIET; } else { log_opts.syslog_level = debug_level; log_opts.logfile_level = LOG_LEVEL_QUIET; } } else { log_opts.syslog_level = LOG_LEVEL_QUIET; log_opts.stderr_level = debug_level; if (slurmctld_conf.slurmctld_logfile) log_opts.logfile_level = debug_level; else log_opts.logfile_level = LOG_LEVEL_QUIET; } log_alter(log_opts, LOG_DAEMON, slurmctld_conf.slurmctld_logfile); unlock_slurmctld (config_write_lock); conf = slurm_conf_lock(); old_debug_level = conf->slurmctld_debug; conf->slurmctld_debug = debug_level; slurm_conf_unlock(); slurmctld_conf.last_update = time(NULL); if (debug_level != old_debug_level) info("Set debug level to %d", debug_level); slurm_send_rc_msg(msg, SLURM_SUCCESS); } inline static void _slurm_rpc_set_schedlog_level(slurm_msg_t *msg) { int schedlog_level, old_schedlog_level; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); slurmctld_lock_t config_read_lock = { READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; set_debug_level_msg_t *request_msg = (set_debug_level_msg_t *) msg->data; log_options_t log_opts = SCHEDLOG_OPTS_INITIALIZER; slurm_ctl_conf_t *conf; debug2("Processing RPC: REQUEST_SET_SCHEDLOG_LEVEL from uid=%d", uid); if (!validate_super_user(uid)) { error("set scheduler log level request from non-super user " "uid=%d", uid); slurm_send_rc_msg(msg, EACCES); return; } /* * If slurmctld_conf.sched_logfile is NULL, then this operation * will fail, since there is no sched logfile for which to alter * the log level. (Calling sched_log_alter with a NULL filename * is likely to cause a segfault at the next sched log call) * So just give up and return "Operation Disabled" */ if (slurmctld_conf.sched_logfile == NULL) { error("set scheduler log level failed: no log file!"); slurm_send_rc_msg (msg, ESLURM_DISABLED); return; } schedlog_level = MIN (request_msg->debug_level, (LOG_LEVEL_QUIET + 1)); schedlog_level = MAX (schedlog_level, LOG_LEVEL_QUIET); lock_slurmctld (config_read_lock); log_opts.logfile_level = schedlog_level; sched_log_alter(log_opts, LOG_DAEMON, slurmctld_conf.sched_logfile); unlock_slurmctld (config_read_lock); conf = slurm_conf_lock(); old_schedlog_level = conf->sched_log_level; conf->sched_log_level = schedlog_level; slurm_conf_unlock(); slurmctld_conf.last_update = time(NULL); if (schedlog_level != old_schedlog_level) info("sched: Set scheduler log level to %d", schedlog_level); slurm_send_rc_msg(msg, SLURM_SUCCESS); } static int _find_update_object_in_list(void *x, void *key) { slurmdb_update_object_t *object = (slurmdb_update_object_t *)x; slurmdb_update_type_t type = *(slurmdb_update_type_t *)key; if (object->type == type) return 1; return 0; } inline static void _slurm_rpc_accounting_update_msg(slurm_msg_t *msg) { int rc = SLURM_SUCCESS; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); accounting_update_msg_t *update_ptr = (accounting_update_msg_t *) msg->data; bool sent_rc = false; DEF_TIMERS; START_TIMER; debug2("Processing RPC: ACCOUNTING_UPDATE_MSG from uid=%d", uid); if (!validate_super_user(uid)) { error("Update Association request from non-super user uid=%d", uid); slurm_send_rc_msg(msg, EACCES); return; } /* Send message back to the caller letting him know we got it. There is no need to wait since the end result would be the same if we wait or not since the update has already happened in the database. */ slurm_send_rc_msg(msg, rc); if (update_ptr->update_list && list_count(update_ptr->update_list)) { slurmdb_update_object_t *object; slurmdb_update_type_t fed_type = SLURMDB_UPDATE_FEDS; if ((object = list_find_first(update_ptr->update_list, _find_update_object_in_list, &fed_type))) { #if HAVE_SYS_PRCTL_H if (prctl(PR_SET_NAME, "fedmgr", NULL, NULL, NULL) < 0){ error("%s: cannot set my name to %s %m", __func__, "fedmgr"); } #endif fed_mgr_update_feds(object); } object = list_peek(update_ptr->update_list); if (object->type != SLURMDB_ADD_TRES) { /* If not specific message types, send message back * to the caller immediately letting him know we got it. * In most cases there is no need to wait since the end * result would be the same if we wait or not * since the update has already happened in * the database. */ slurm_send_rc_msg(msg, rc); sent_rc = true; } rc = assoc_mgr_update(update_ptr->update_list, 0); } END_TIMER2("_slurm_rpc_accounting_update_msg"); if (sent_rc) { if (rc != SLURM_SUCCESS) error("assoc_mgr_update gave error: %s", slurm_strerror(rc)); } else { info("sending after"); slurm_send_rc_msg(msg, rc); } } /* _slurm_rpc_reboot_nodes - process RPC to schedule nodes reboot */ inline static void _slurm_rpc_reboot_nodes(slurm_msg_t * msg) { int rc; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); #ifndef HAVE_FRONT_END int i; struct node_record *node_ptr; reboot_msg_t *reboot_msg = (reboot_msg_t *)msg->data; char *nodelist = NULL; bitstr_t *bitmap = NULL; /* Locks: write node lock */ slurmctld_lock_t node_write_lock = { NO_LOCK, NO_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; #endif DEF_TIMERS; START_TIMER; debug2("Processing RPC: REQUEST_REBOOT_NODES from uid=%d", uid); if (!validate_super_user(uid)) { error("Security violation, REBOOT_NODES RPC from uid=%d", uid); slurm_send_rc_msg(msg, EACCES); return; } #ifdef HAVE_FRONT_END rc = ESLURM_NOT_SUPPORTED; #else /* do RPC call */ if (reboot_msg) nodelist = reboot_msg->node_list; if (!nodelist || !xstrcasecmp(nodelist, "ALL")) { bitmap = bit_alloc(node_record_count); bit_nset(bitmap, 0, (node_record_count - 1)); } else if (node_name2bitmap(nodelist, false, &bitmap) != 0) { FREE_NULL_BITMAP(bitmap); error("Invalid node list in REBOOT_NODES request"); slurm_send_rc_msg(msg, ESLURM_INVALID_NODE_NAME); return; } lock_slurmctld(node_write_lock); for (i = 0, node_ptr = node_record_table_ptr; i < node_record_count; i++, node_ptr++) { if (bit_test(bitmap, i) == 0) continue; if (IS_NODE_MAINT(node_ptr)) /* already on maintenance */ continue; if (IS_NODE_FUTURE(node_ptr) || IS_NODE_DOWN(node_ptr)) continue; if (IS_NODE_CLOUD(node_ptr) && IS_NODE_POWER_SAVE(node_ptr)) continue; node_ptr->node_state |= NODE_STATE_MAINT; want_nodes_reboot = true; } if (want_nodes_reboot == true) schedule_node_save(); unlock_slurmctld(node_write_lock); FREE_NULL_BITMAP(bitmap); rc = SLURM_SUCCESS; #endif END_TIMER2("_slurm_rpc_reboot_nodes"); slurm_send_rc_msg(msg, rc); } inline static void _slurm_rpc_accounting_first_reg(slurm_msg_t *msg) { uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); time_t event_time = time(NULL); DEF_TIMERS; START_TIMER; debug2("Processing RPC: ACCOUNTING_FIRST_REG from uid=%d", uid); if (!validate_super_user(uid)) { error("First Registration request from non-super user uid=%d", uid); return; } send_all_to_accounting(event_time); END_TIMER2("_slurm_rpc_accounting_first_reg"); } inline static void _slurm_rpc_accounting_register_ctld(slurm_msg_t *msg) { uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); DEF_TIMERS; START_TIMER; debug2("Processing RPC: ACCOUNTING_REGISTER_CTLD from uid=%d", uid); if (!validate_super_user(uid)) { error("Registration request from non-super user uid=%d", uid); return; } clusteracct_storage_g_register_ctld(acct_db_conn, slurmctld_conf.slurmctld_port); END_TIMER2("_slurm_rpc_accounting_register_ctld"); } inline static void _slurm_rpc_dump_spank(slurm_msg_t * msg) { int rc = SLURM_SUCCESS; spank_env_request_msg_t *spank_req_msg = (spank_env_request_msg_t *) msg->data; spank_env_responce_msg_t *spank_resp_msg = NULL; /* Locks: read job */ slurmctld_lock_t job_read_lock = { NO_LOCK, READ_LOCK, NO_LOCK, NO_LOCK, NO_LOCK }; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); slurm_msg_t response_msg; DEF_TIMERS; START_TIMER; debug("Processing RPC: REQUEST_SPANK_ENVIRONMENT from uid=%d JobId=%u", uid, spank_req_msg->job_id); if (!validate_slurm_user(uid)) { rc = ESLURM_USER_ID_MISSING; error("Security violation, REQUEST_SPANK_ENVIRONMENT RPC " "from uid=%d", uid); } if (rc == SLURM_SUCCESS) { /* do RPC call */ struct job_record *job_ptr; uint32_t i; lock_slurmctld(job_read_lock); job_ptr = find_job_record(spank_req_msg->job_id); if (job_ptr) { spank_resp_msg = xmalloc(sizeof(spank_env_responce_msg_t)); spank_resp_msg->spank_job_env_size = job_ptr->spank_job_env_size; spank_resp_msg->spank_job_env = xmalloc( spank_resp_msg->spank_job_env_size * sizeof(char *)); for (i = 0; i < spank_resp_msg->spank_job_env_size; i++) spank_resp_msg->spank_job_env[i] = xstrdup( job_ptr->spank_job_env[i]); } else { rc = ESLURM_INVALID_JOB_ID; } unlock_slurmctld(job_read_lock); } END_TIMER2("_slurm_rpc_dump_spank"); if (rc == SLURM_SUCCESS) { slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONCE_SPANK_ENVIRONMENT; response_msg.data = spank_resp_msg; slurm_send_node_msg(msg->conn_fd, &response_msg); slurm_free_spank_env_responce_msg(spank_resp_msg); } else { slurm_send_rc_msg(msg, rc); } } static void _clear_rpc_stats(void) { int i; slurm_mutex_lock(&rpc_mutex); for (i = 0; i < rpc_type_size; i++) { rpc_type_cnt[i] = 0; rpc_type_id[i] = 0; rpc_type_time[i] = 0; } for (i = 0; i < rpc_user_size; i++) { rpc_user_cnt[i] = 0; rpc_user_id[i] = 0; rpc_user_time[i] = 0; } slurm_mutex_unlock(&rpc_mutex); } static void _pack_rpc_stats(int resp, char **buffer_ptr, int *buffer_size, uint16_t protocol_version) { uint32_t i; Buf buffer; slurm_mutex_lock(&rpc_mutex); buffer = create_buf(*buffer_ptr, *buffer_size); set_buf_offset(buffer, *buffer_size); for (i = 0; i < rpc_type_size; i++) { if (rpc_type_id[i] == 0) break; } pack32(i, buffer); pack16_array(rpc_type_id, i, buffer); pack32_array(rpc_type_cnt, i, buffer); pack64_array(rpc_type_time, i, buffer); for (i = 1; i < rpc_user_size; i++) { if (rpc_user_id[i] == 0) break; } pack32(i, buffer); pack32_array(rpc_user_id, i, buffer); pack32_array(rpc_user_cnt, i, buffer); pack64_array(rpc_user_time, i, buffer); slurm_mutex_unlock(&rpc_mutex); *buffer_size = get_buf_offset(buffer); buffer_ptr[0] = xfer_buf_data(buffer); } /* _slurm_rpc_dump_stats - process RPC for statistics information */ inline static void _slurm_rpc_dump_stats(slurm_msg_t * msg) { char *dump; int dump_size; stats_info_request_msg_t *request_msg; slurm_msg_t response_msg; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); request_msg = (stats_info_request_msg_t *)msg->data; if ((request_msg->command_id == STAT_COMMAND_RESET) && !validate_operator(uid)) { error("Security violation: REQUEST_STATS_INFO reset " "from uid=%d", uid); slurm_send_rc_msg(msg, ESLURM_ACCESS_DENIED); return; } debug2("Processing RPC: REQUEST_STATS_INFO (command: %u)", request_msg->command_id); slurm_msg_t_init(&response_msg); response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_STATS_INFO; if (request_msg->command_id == STAT_COMMAND_RESET) { reset_stats(1); _clear_rpc_stats(); pack_all_stat(0, &dump, &dump_size, msg->protocol_version); _pack_rpc_stats(0, &dump, &dump_size, msg->protocol_version); response_msg.data = dump; response_msg.data_size = dump_size; } else { pack_all_stat(1, &dump, &dump_size, msg->protocol_version); _pack_rpc_stats(1, &dump, &dump_size, msg->protocol_version); response_msg.data = dump; response_msg.data_size = dump_size; } /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); } /* _slurm_rpc_dump_licenses() * * Pack the io buffer and send it back to the library. */ inline static void _slurm_rpc_dump_licenses(slurm_msg_t * msg) { DEF_TIMERS; char *dump; int dump_size; slurm_msg_t response_msg; license_info_request_msg_t *lic_req_msg; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("%s: Processing RPC: REQUEST_LICENSE_INFO uid=%d", __func__, uid); lic_req_msg = (license_info_request_msg_t *)msg->data; if ((lic_req_msg->last_update - 1) >= last_license_update) { /* Dont send unnecessary data */ debug2("%s: no change SLURM_NO_CHANGE_IN_DATA", __func__); slurm_send_rc_msg(msg, SLURM_NO_CHANGE_IN_DATA); return; } get_all_license_info(&dump, &dump_size, uid, msg->protocol_version); END_TIMER2("_slurm_rpc_dump_licenses"); debug2("%s: size=%d %s", __func__, dump_size, TIME_STR); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_LICENSE_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); /* Ciao! */ } /* Free memory used to track RPC usage by type and user */ extern void free_rpc_stats(void) { slurm_mutex_lock(&rpc_mutex); xfree(rpc_type_cnt); xfree(rpc_type_id); xfree(rpc_type_time); rpc_type_size = 0; xfree(rpc_user_cnt); xfree(rpc_user_id); xfree(rpc_user_time); rpc_user_size = 0; slurm_mutex_unlock(&rpc_mutex); } /* _slurm_rpc_kill_job2() */ inline static void _slurm_rpc_kill_job2(slurm_msg_t *msg) { static int active_rpc_cnt = 0; DEF_TIMERS; job_step_kill_msg_t *kill; slurmctld_lock_t lock = {READ_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; uid_t uid; int cc; kill = (job_step_kill_msg_t *)msg->data; uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; info("%s: REQUEST_KILL_JOB job %s uid %d", __func__, kill->sjob_id, uid); _throttle_start(&active_rpc_cnt); lock_slurmctld(lock); cc = job_str_signal(kill->sjob_id, kill->signal, kill->flags, uid, 0); unlock_slurmctld(lock); _throttle_fini(&active_rpc_cnt); if (cc == ESLURM_ALREADY_DONE) { debug2("%s: job_str_signal() job %s sig %d returned %s", __func__, kill->sjob_id, kill->signal, slurm_strerror(cc)); } else if (cc != SLURM_SUCCESS) { info("%s: job_str_signal() job %s sig %d returned %s", __func__, kill->sjob_id, kill->signal, slurm_strerror(cc)); } else { slurmctld_diag_stats.jobs_canceled++; } slurm_send_rc_msg(msg, cc); END_TIMER2("_slurm_rpc_kill_job2"); } /* Return the number of micro-seconds between now and argument "tv" */ static int _delta_tv(struct timeval *tv) { struct timeval now = {0, 0}; int delta_t; if (gettimeofday(&now, NULL)) return 1; /* Some error */ delta_t = (now.tv_sec - tv->tv_sec) * 1000000; delta_t += (now.tv_usec - tv->tv_usec); return delta_t; } /* The batch messages when made for the comp_msg need to be freed * differently than the normal free, so do that here. */ static void _slurmctld_free_comp_msg_list(void *x) { slurm_msg_t *msg = (slurm_msg_t*)x; if (msg) { if (msg->msg_type == REQUEST_BATCH_JOB_LAUNCH) { slurmctld_free_batch_job_launch_msg(msg->data); msg->data = NULL; } slurm_free_comp_msg_list(msg); } } static void _slurm_rpc_composite_msg(slurm_msg_t *msg) { static time_t config_update = 0; static bool defer_sched = false; static int sched_timeout = 0; static int active_rpc_cnt = 0; struct timeval start_tv; bool run_scheduler = false; composite_msg_t *comp_msg, comp_resp_msg; /* Locks: Read configuration, write job, write node */ slurmctld_lock_t job_write_lock = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; memset(&comp_resp_msg, 0, sizeof(composite_msg_t)); comp_resp_msg.msg_list = list_create(_slurmctld_free_comp_msg_list); comp_msg = (composite_msg_t *) msg->data; if (slurmctld_conf.debug_flags & DEBUG_FLAG_ROUTE) info("Processing RPC: MESSAGE_COMPOSITE msg with %d messages", comp_msg->msg_list ? list_count(comp_msg->msg_list) : 0); if (config_update != slurmctld_conf.last_update) { char *sched_params = slurm_get_sched_params(); int time_limit; char *tmp_ptr; defer_sched = (sched_params && strstr(sched_params, "defer")); time_limit = slurm_get_msg_timeout() / 2; if (sched_params && (tmp_ptr = strstr(sched_params, "max_sched_time="))) { sched_timeout = atoi(tmp_ptr + 15); if ((sched_timeout <= 0) || (sched_timeout > time_limit)) { error("Invalid max_sched_time: %d", sched_timeout); sched_timeout = 0; } } if (sched_timeout == 0) { sched_timeout = MAX(time_limit, 1); sched_timeout = MIN(sched_timeout, 2); sched_timeout *= 1000000; } xfree(sched_params); config_update = slurmctld_conf.last_update; } _throttle_start(&active_rpc_cnt); lock_slurmctld(job_write_lock); gettimeofday(&start_tv, NULL); _slurm_rpc_comp_msg_list(comp_msg, &run_scheduler, comp_resp_msg.msg_list, &start_tv, sched_timeout); unlock_slurmctld(job_write_lock); _throttle_fini(&active_rpc_cnt); if (list_count(comp_resp_msg.msg_list)) { slurm_msg_t resp_msg; slurm_msg_t_init(&resp_msg); resp_msg.flags = msg->flags; resp_msg.protocol_version = msg->protocol_version; memcpy(&resp_msg.address, &comp_msg->sender, sizeof(slurm_addr_t)); resp_msg.msg_type = RESPONSE_MESSAGE_COMPOSITE; resp_msg.data = &comp_resp_msg; slurm_send_only_node_msg(&resp_msg); } FREE_NULL_LIST(comp_resp_msg.msg_list); /* Functions below provide their own locking */ if (run_scheduler) { /* * In defer mode, avoid triggering the scheduler logic * for every epilog complete message. * As one epilog message is sent from every node of each * job at termination, the number of simultaneous schedule * calls can be very high for large machine or large number * of managed jobs. */ if (!LOTS_OF_AGENTS && !defer_sched) (void) schedule(0); /* Has own locking */ schedule_node_save(); /* Has own locking */ schedule_job_save(); /* Has own locking */ } } static void _slurm_rpc_comp_msg_list(composite_msg_t * comp_msg, bool *run_scheduler, List msg_list_in, struct timeval *start_tv, int timeout) { ListIterator itr; slurm_msg_t *next_msg; composite_msg_t *ncomp_msg; composite_msg_t *comp_resp_msg; /* Locks: Read configuration, write job, write node */ slurmctld_lock_t job_write_lock = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, NO_LOCK, NO_LOCK }; DEF_TIMERS; START_TIMER; itr = list_iterator_create(comp_msg->msg_list); while ((next_msg = list_next(itr))) { if (_delta_tv(start_tv) >= timeout) { END_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_ROUTE) info("composite message processing " "yielding locks after running for %s", TIME_STR); unlock_slurmctld(job_write_lock); usleep(10); lock_slurmctld(job_write_lock); gettimeofday(start_tv, NULL); START_TIMER; } /* The ret_list is used by slurm_send_rc_msg to house replys going back to the nodes. */ FREE_NULL_LIST(next_msg->ret_list); next_msg->ret_list = msg_list_in; switch (next_msg->msg_type) { case MESSAGE_COMPOSITE: comp_resp_msg = xmalloc(sizeof(composite_msg_t)); comp_resp_msg->msg_list = list_create(_slurmctld_free_comp_msg_list); ncomp_msg = (composite_msg_t *) next_msg->data; if (slurmctld_conf.debug_flags & DEBUG_FLAG_ROUTE) info("Processing embedded MESSAGE_COMPOSITE " "msg with %d direct " "messages", ncomp_msg->msg_list ? list_count(ncomp_msg->msg_list) : 0); _slurm_rpc_comp_msg_list(ncomp_msg, run_scheduler, comp_resp_msg->msg_list, start_tv, timeout); if (list_count(comp_resp_msg->msg_list)) { slurm_msg_t *resp_msg = xmalloc_nz(sizeof(slurm_msg_t)); slurm_msg_t_init(resp_msg); resp_msg->msg_index = next_msg->msg_index; resp_msg->flags = next_msg->flags; resp_msg->protocol_version = next_msg->protocol_version; resp_msg->msg_type = RESPONSE_MESSAGE_COMPOSITE; /* You can't just set the * resp_msg->address here, it won't * make it to where it needs to be * used, set the sender and let it be * handled on the tree node. */ memcpy(&comp_resp_msg->sender, &ncomp_msg->sender, sizeof(slurm_addr_t)); resp_msg->data = comp_resp_msg; list_append(msg_list_in, resp_msg); } else slurm_free_composite_msg(comp_resp_msg); break; case REQUEST_COMPLETE_BATCH_SCRIPT: case REQUEST_COMPLETE_BATCH_JOB: _slurm_rpc_complete_batch_script(next_msg, run_scheduler, 1); break; case REQUEST_STEP_COMPLETE: _slurm_rpc_step_complete(next_msg, 1); break; case MESSAGE_EPILOG_COMPLETE: _slurm_rpc_epilog_complete(next_msg, run_scheduler, 1); break; case MESSAGE_NODE_REGISTRATION_STATUS: _slurm_rpc_node_registration(next_msg, 1); break; default: error("_slurm_rpc_comp_msg_list: invalid msg type"); break; } next_msg->ret_list = NULL; } list_iterator_destroy(itr); END_TIMER; /* NOTE: RPC has no response */ } /* _slurm_rpc_assoc_mgr_info() * * Pack the assoc_mgr lists and return it back to the caller. */ static void _slurm_rpc_assoc_mgr_info(slurm_msg_t * msg) { DEF_TIMERS; char *dump = NULL; int dump_size = 0; slurm_msg_t response_msg; uid_t uid = g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); START_TIMER; debug2("%s: Processing RPC: REQUEST_ASSOC_MGR_INFO uid=%d", __func__, uid); /* do RPC call */ /* Security is handled in the assoc_mgr */ assoc_mgr_info_get_pack_msg(&dump, &dump_size, (assoc_mgr_info_request_msg_t *)msg->data, uid, acct_db_conn, msg->protocol_version); END_TIMER2("_slurm_rpc_assoc_mgr_info"); debug2("%s: size=%d %s", __func__, dump_size, TIME_STR); /* init response_msg structure */ slurm_msg_t_init(&response_msg); response_msg.flags = msg->flags; response_msg.protocol_version = msg->protocol_version; response_msg.address = msg->address; response_msg.msg_type = RESPONSE_ASSOC_MGR_INFO; response_msg.data = dump; response_msg.data_size = dump_size; /* send message */ slurm_send_node_msg(msg->conn_fd, &response_msg); xfree(dump); /* Ciao! */ }
adammoody/slurm
src/slurmctld/proc_req.c
C
gpl-2.0
195,794
/* Theme Name: Twenty Twelve Adding support for language written in a Right To Left (RTL) direction is easy - it's just a matter of overwriting all the horizontal positioning attributes of your CSS stylesheet in a separate stylesheet file named rtl.css. http://codex.wordpress.org/Right_to_Left_Language_Support */ body { direction: rtl; unicode-bidi: embed; } caption, th, td { text-align: right; } /* =Repeatable patterns -------------------------------------------------------------- */ /* Images */ .site-content .gallery-columns-4 .gallery-item { padding-left: 2%; padding-right: 0; } .site-content .gallery-columns-5 .gallery-item { padding-left: 2%; padding-right: 0; } /* Navigation */ .nav-previous, .previous-image { float: right; } .nav-next, .next-image { float: left; text-align: left; } /* Author profiles */ #author-avatar { float: right; } #author-description { float: right; margin-right: 15px; margin-right: 1.071428571rem; margin-left: auto; } /* =Basic structure -------------------------------------------------------------- */ .main-navigation li ul ul { margin-left: 0; margin-right: 40px; margin-right: 2.857142857rem; } /* =Main Content ----------------------------------------------- */ .comment-content ol, .comment-content ul { margin: 0 24px 0 0; margin: 0 1.714285714rem 0 0; } /* =Basic post styling -------------------------------------------------------------- */ .entry-content li, .comment-content li { margin: 0 24px 0 0; margin: 0 1.714285714rem 0 0; } .entry-content td, .comment-content td { padding: 6px 0 6px 10px; } /* =Aside post styling -------------------------------------------------------------- */ article.format-aside .aside { border-right: 22px solid #a8bfe8; border-left: none; } /* =Link post styling -------------------------------------------------------------- */ article.format-link header { float: left; } article.format-link .entry-content { float: right; } /* =Comment styling -------------------------------------------------------------- */ .comments-area article header img { float: right; } .comments-area article header cite, .comments-area article header time { margin-right: 85px; margin-right: 6.071428571rem; margin-left: auto; } .comments-area article header h4 { left: 0; right: auto; } .comments-area li.bypostauthor cite span { margin-right: 5px; margin-right: 0.357142857rem; margin-left: auto; } .commentlist .children { margin-right: 48px; margin-right: 3.428571429rem; margin-left: auto; } /* Comment form */ #respond h3#reply-title #cancel-comment-reply-link { margin-right: 10px; margin-right: 0.714285714rem; margin-left: auto; } label ~ span.required { float: right; margin: -18px -16px 0 0; margin: -1.285714286rem -1.142857143rem 0 0; } /* =Home page template styling -------------------------------------------------------------- */ .page-template-homepage-php .widget-area .widget_text img { float: right; margin: 8px 0 8px 24px; margin: 0.571428571rem 0 0.571428571rem 1.714285714rem; } /* =Widget styling -------------------------------------------------------------- */ .widget-area .widget ul ul { margin-right: 12px; margin-right: 0.857142857rem; margin-left: auto; } .widget_recent_entries .post-date, .widget_rss .rss-date { margin-right: 12px; margin-right: 0.857142857rem; margin-left: auto; } #wp-calendar th, #wp-calendar td, #wp-calendar caption { text-align: right; } #wp-calendar #next { padding-left: 24px; padding-left: 1.714285714rem; text-align: left; padding-right: 0; } /* =Media queries -------------------------------------------------------------- */ /* Minimum width of 600 pixels. */ @media screen and (min-width: 600px) { .site-content, .page-template-homepage-php.has-post-thumbnail article { float: right; } .widget-area, .entry-page-image { float: left; } .site-header h1, .site-header h2 { text-align: right; } .entry-content p, .entry-summary p { text-align: right; } .page-template-homepage-php .widget-area .widget_text img { float: right; margin: 8px 0 8px 24px; } .page-template-homepage-php .widget-area .widget, .page-template-homepage-php .widget-area.two .home-widgets { float: right; } .page-template-homepage-php .widget-area .widget:nth-child(odd) { clear: left; } .page-template-homepage-php .widget-area .widget:nth-child(even), .page-template-homepage-php .widget-area.two .home-widgets + .home-widgets { float: left; margin: 0 24px 0; margin: 0 1.714285714rem 0; } .main-navigation li { margin-left: 40px; margin-left: 2.857142857rem; margin-right: auto; } .main-navigation li ul ul { margin-right: 0; right: 100%; left: auto; } .main-navigation ul li:hover > ul { border-right: 0; border-left: none; } }
justintadlock/wordpress
wp-content/themes/twentytwelve/rtl.css
CSS
gpl-2.0
4,792
#include "CounterpartyTypeDelegate.h" CounterpartyTypeDelegate::CounterpartyTypeDelegate(QObject *parent) : QSqlRelationalDelegate(parent) { } void CounterpartyTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { QComboBox *comboBox = dynamic_cast<QComboBox*>(editor); if(comboBox && (comboBox->objectName().compare("comboBoxType") == 0) && (comboBox->count() > 0)) { const int myCompany = ( (comboBox->count() > 1) ? 1 : 0) + 1;//skips my company and adds 1 because SQL starts from 1 model->setData(index, comboBox->currentIndex() + myCompany, Qt::EditRole); } else { QSqlRelationalDelegate::setModelData(editor, model, index); } }
tkQCompany/qcompany
qfaktury/src/ui/CounterpartyTypeDelegate.cpp
C++
gpl-2.0
832
<?php /** * File containing the LogicalNot Criterion parser class * * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. * @license http://ez.no/licenses/gnu_gpl GNU General Public License v2.0 * @version 2012.9 */ namespace eZ\Publish\Core\REST\Server\Input\Parser\Criterion; use eZ\Publish\Core\REST\Server\Input\Parser\Criterion as CriterionParser; use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher; use eZ\Publish\Core\REST\Common\UrlHandler; use eZ\Publish\Core\REST\Common\Exceptions; use eZ\Publish\API\Repository\Values\Content\Query\Criterion\LogicalNot as LogicalNotCriterion; /** * Parser for LogicalNot Criterion */ class LogicalNot extends CriterionParser { /** * Parses input structure to a Criterion object * * @param array $data * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher * * @throws \eZ\Publish\Core\REST\Common\Exceptions\Parser * @return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\LogicalNot */ public function parse( array $data, ParsingDispatcher $parsingDispatcher ) { if ( !array_key_exists( "NOT", $data ) && !is_array( $data["NOT"] ) ) { throw new Exceptions\Parser( "Invalid <NOT> format" ); } if ( count( $data['NOT'] ) > 1 ) { throw new Exceptions\Parser( "NOT element can only contain one subitem" ); } list( $criterionName, $criterionData ) = each( $data['NOT'] ); $criteria = $this->dispatchCriterion( $criterionName, $criterionData, $parsingDispatcher ); return new LogicalNotCriterion( $criteria ); } }
davidrousse/ezpuplish
vendor/ezsystems/ezpublish/eZ/Publish/Core/REST/Server/Input/Parser/Criterion/LogicalNot.php
PHP
gpl-2.0
1,678
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright © 2004 Chris Friesen <chris_friesen@sympatico.ca> * Copyright © 2009 Canonical Ltd. * Copyright © 2009 Scott James Remnant <scott@netsplit.com> */ #include <errno.h> #include <fcntl.h> #include <getopt.h> #include <signal.h> #include <stdbool.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/epoll.h> #include <sys/file.h> #include <sys/inotify.h> #include <sys/ioctl.h> #include <sys/mount.h> #include <sys/prctl.h> #include <sys/signalfd.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/wait.h> #include <unistd.h> #include "sd-daemon.h" #include "sd-event.h" #include "alloc-util.h" #include "build.h" #include "cgroup-util.h" #include "cpu-set-util.h" #include "dev-setup.h" #include "device-monitor-private.h" #include "device-private.h" #include "device-util.h" #include "event-util.h" #include "fd-util.h" #include "fileio.h" #include "format-util.h" #include "fs-util.h" #include "hashmap.h" #include "io-util.h" #include "libudev-device-internal.h" #include "limits-util.h" #include "list.h" #include "main-func.h" #include "mkdir.h" #include "netlink-util.h" #include "parse-util.h" #include "pretty-print.h" #include "proc-cmdline.h" #include "process-util.h" #include "selinux-util.h" #include "signal-util.h" #include "socket-util.h" #include "string-util.h" #include "strv.h" #include "strxcpyx.h" #include "syslog-util.h" #include "udev-builtin.h" #include "udev-ctrl.h" #include "udev-event.h" #include "udev-util.h" #include "udev-watch.h" #include "user-util.h" #define WORKER_NUM_MAX 2048U static bool arg_debug = false; static int arg_daemonize = false; static ResolveNameTiming arg_resolve_name_timing = RESOLVE_NAME_EARLY; static unsigned arg_children_max = 0; static usec_t arg_exec_delay_usec = 0; static usec_t arg_event_timeout_usec = 180 * USEC_PER_SEC; typedef struct Manager { sd_event *event; Hashmap *workers; LIST_HEAD(struct event, events); const char *cgroup; pid_t pid; /* the process that originally allocated the manager object */ UdevRules *rules; Hashmap *properties; sd_netlink *rtnl; sd_device_monitor *monitor; struct udev_ctrl *ctrl; int fd_inotify; int worker_watch[2]; sd_event_source *inotify_event; sd_event_source *kill_workers_event; usec_t last_usec; bool stop_exec_queue:1; bool exit:1; } Manager; enum event_state { EVENT_UNDEF, EVENT_QUEUED, EVENT_RUNNING, }; struct event { Manager *manager; struct worker *worker; enum event_state state; sd_device *dev; sd_device *dev_kernel; /* clone of originally received device */ uint64_t seqnum; uint64_t delaying_seqnum; sd_event_source *timeout_warning_event; sd_event_source *timeout_event; LIST_FIELDS(struct event, event); }; static void event_queue_cleanup(Manager *manager, enum event_state type); enum worker_state { WORKER_UNDEF, WORKER_RUNNING, WORKER_IDLE, WORKER_KILLED, }; struct worker { Manager *manager; pid_t pid; sd_device_monitor *monitor; enum worker_state state; struct event *event; }; /* passed from worker to main process */ struct worker_message { }; static void event_free(struct event *event) { if (!event) return; assert(event->manager); LIST_REMOVE(event, event->manager->events, event); sd_device_unref(event->dev); sd_device_unref(event->dev_kernel); sd_event_source_unref(event->timeout_warning_event); sd_event_source_unref(event->timeout_event); if (event->worker) event->worker->event = NULL; /* only clean up the queue from the process that created it */ if (LIST_IS_EMPTY(event->manager->events) && event->manager->pid == getpid_cached()) if (unlink("/run/udev/queue") < 0) log_warning_errno(errno, "Failed to unlink /run/udev/queue: %m"); free(event); } static void worker_free(struct worker *worker) { if (!worker) return; assert(worker->manager); hashmap_remove(worker->manager->workers, PID_TO_PTR(worker->pid)); sd_device_monitor_unref(worker->monitor); event_free(worker->event); free(worker); } DEFINE_TRIVIAL_CLEANUP_FUNC(struct worker *, worker_free); DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(worker_hash_op, void, trivial_hash_func, trivial_compare_func, struct worker, worker_free); static int worker_new(struct worker **ret, Manager *manager, sd_device_monitor *worker_monitor, pid_t pid) { _cleanup_(worker_freep) struct worker *worker = NULL; int r; assert(ret); assert(manager); assert(worker_monitor); assert(pid > 1); /* close monitor, but keep address around */ device_monitor_disconnect(worker_monitor); worker = new(struct worker, 1); if (!worker) return -ENOMEM; *worker = (struct worker) { .manager = manager, .monitor = sd_device_monitor_ref(worker_monitor), .pid = pid, }; r = hashmap_ensure_allocated(&manager->workers, &worker_hash_op); if (r < 0) return r; r = hashmap_put(manager->workers, PID_TO_PTR(pid), worker); if (r < 0) return r; *ret = TAKE_PTR(worker); return 0; } static int on_event_timeout(sd_event_source *s, uint64_t usec, void *userdata) { struct event *event = userdata; assert(event); assert(event->worker); kill_and_sigcont(event->worker->pid, SIGKILL); event->worker->state = WORKER_KILLED; log_device_error(event->dev, "Worker ["PID_FMT"] processing SEQNUM=%"PRIu64" killed", event->worker->pid, event->seqnum); return 1; } static int on_event_timeout_warning(sd_event_source *s, uint64_t usec, void *userdata) { struct event *event = userdata; assert(event); assert(event->worker); log_device_warning(event->dev, "Worker ["PID_FMT"] processing SEQNUM=%"PRIu64" is taking a long time", event->worker->pid, event->seqnum); return 1; } static void worker_attach_event(struct worker *worker, struct event *event) { sd_event *e; uint64_t usec; assert(worker); assert(worker->manager); assert(event); assert(!event->worker); assert(!worker->event); worker->state = WORKER_RUNNING; worker->event = event; event->state = EVENT_RUNNING; event->worker = worker; e = worker->manager->event; assert_se(sd_event_now(e, CLOCK_MONOTONIC, &usec) >= 0); (void) sd_event_add_time(e, &event->timeout_warning_event, CLOCK_MONOTONIC, usec + udev_warn_timeout(arg_event_timeout_usec), USEC_PER_SEC, on_event_timeout_warning, event); (void) sd_event_add_time(e, &event->timeout_event, CLOCK_MONOTONIC, usec + arg_event_timeout_usec, USEC_PER_SEC, on_event_timeout, event); } static void manager_clear_for_worker(Manager *manager) { assert(manager); manager->inotify_event = sd_event_source_unref(manager->inotify_event); manager->kill_workers_event = sd_event_source_unref(manager->kill_workers_event); manager->event = sd_event_unref(manager->event); manager->workers = hashmap_free(manager->workers); event_queue_cleanup(manager, EVENT_UNDEF); manager->monitor = sd_device_monitor_unref(manager->monitor); manager->ctrl = udev_ctrl_unref(manager->ctrl); manager->worker_watch[READ_END] = safe_close(manager->worker_watch[READ_END]); } static void manager_free(Manager *manager) { if (!manager) return; udev_builtin_exit(); if (manager->pid == getpid_cached()) udev_ctrl_cleanup(manager->ctrl); manager_clear_for_worker(manager); sd_netlink_unref(manager->rtnl); hashmap_free_free_free(manager->properties); udev_rules_free(manager->rules); safe_close(manager->fd_inotify); safe_close_pair(manager->worker_watch); free(manager); } DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free); static int worker_send_message(int fd) { struct worker_message message = {}; return loop_write(fd, &message, sizeof(message), false); } static int worker_lock_block_device(sd_device *dev, int *ret_fd) { _cleanup_close_ int fd = -1; const char *val; int r; assert(dev); assert(ret_fd); /* * Take a shared lock on the device node; this establishes * a concept of device "ownership" to serialize device * access. External processes holding an exclusive lock will * cause udev to skip the event handling; in the case udev * acquired the lock, the external process can block until * udev has finished its event handling. */ if (device_for_action(dev, DEVICE_ACTION_REMOVE)) return 0; r = sd_device_get_subsystem(dev, &val); if (r < 0) return log_device_debug_errno(dev, r, "Failed to get subsystem: %m"); if (!streq(val, "block")) return 0; r = sd_device_get_sysname(dev, &val); if (r < 0) return log_device_debug_errno(dev, r, "Failed to get sysname: %m"); if (STARTSWITH_SET(val, "dm-", "md", "drbd")) return 0; r = sd_device_get_devtype(dev, &val); if (r < 0 && r != -ENOENT) return log_device_debug_errno(dev, r, "Failed to get devtype: %m"); if (r >= 0 && streq(val, "partition")) { r = sd_device_get_parent(dev, &dev); if (r < 0) return log_device_debug_errno(dev, r, "Failed to get parent device: %m"); } r = sd_device_get_devname(dev, &val); if (r == -ENOENT) return 0; if (r < 0) return log_device_debug_errno(dev, r, "Failed to get devname: %m"); fd = open(val, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); if (fd < 0) { log_device_debug_errno(dev, errno, "Failed to open '%s', ignoring: %m", val); return 0; } if (flock(fd, LOCK_SH|LOCK_NB) < 0) return log_device_debug_errno(dev, errno, "Failed to flock(%s): %m", val); *ret_fd = TAKE_FD(fd); return 1; } static int worker_process_device(Manager *manager, sd_device *dev) { _cleanup_(udev_event_freep) UdevEvent *udev_event = NULL; _cleanup_close_ int fd_lock = -1; DeviceAction action; uint64_t seqnum; int r; assert(manager); assert(dev); r = device_get_seqnum(dev, &seqnum); if (r < 0) return log_device_debug_errno(dev, r, "Failed to get SEQNUM: %m"); r = device_get_action(dev, &action); if (r < 0) return log_device_debug_errno(dev, r, "Failed to get ACTION: %m"); log_device_debug(dev, "Processing device (SEQNUM=%"PRIu64", ACTION=%s)", seqnum, device_action_to_string(action)); udev_event = udev_event_new(dev, arg_exec_delay_usec, manager->rtnl); if (!udev_event) return -ENOMEM; r = worker_lock_block_device(dev, &fd_lock); if (r < 0) return r; /* apply rules, create node, symlinks */ r = udev_event_execute_rules(udev_event, arg_event_timeout_usec, manager->properties, manager->rules); if (r < 0) return r; udev_event_execute_run(udev_event, arg_event_timeout_usec); if (!manager->rtnl) /* in case rtnl was initialized */ manager->rtnl = sd_netlink_ref(udev_event->rtnl); /* apply/restore inotify watch */ if (udev_event->inotify_watch) { (void) udev_watch_begin(dev); r = device_update_db(dev); if (r < 0) return log_device_debug_errno(dev, r, "Failed to update database under /run/udev/data/: %m"); } log_device_debug(dev, "Device (SEQNUM=%"PRIu64", ACTION=%s) processed", seqnum, device_action_to_string(action)); return 0; } static int worker_device_monitor_handler(sd_device_monitor *monitor, sd_device *dev, void *userdata) { Manager *manager = userdata; int r; assert(dev); assert(manager); r = worker_process_device(manager, dev); if (r < 0) log_device_warning_errno(dev, r, "Failed to process device, ignoring: %m"); /* send processed event back to libudev listeners */ r = device_monitor_send_device(monitor, NULL, dev); if (r < 0) log_device_warning_errno(dev, r, "Failed to send device, ignoring: %m"); /* send udevd the result of the event execution */ r = worker_send_message(manager->worker_watch[WRITE_END]); if (r < 0) log_device_warning_errno(dev, r, "Failed to send signal to main daemon, ignoring: %m"); return 1; } static int worker_main(Manager *_manager, sd_device_monitor *monitor, sd_device *first_device) { _cleanup_(sd_device_unrefp) sd_device *dev = first_device; _cleanup_(manager_freep) Manager *manager = _manager; int r; assert(manager); assert(monitor); assert(dev); unsetenv("NOTIFY_SOCKET"); assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, -1) >= 0); /* Reset OOM score, we only protect the main daemon. */ r = set_oom_score_adjust(0); if (r < 0) log_debug_errno(r, "Failed to reset OOM score, ignoring: %m"); /* Clear unnecessary data in Manager object.*/ manager_clear_for_worker(manager); r = sd_event_new(&manager->event); if (r < 0) return log_error_errno(r, "Failed to allocate event loop: %m"); r = sd_event_add_signal(manager->event, NULL, SIGTERM, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to set SIGTERM event: %m"); r = sd_device_monitor_attach_event(monitor, manager->event); if (r < 0) return log_error_errno(r, "Failed to attach event loop to device monitor: %m"); r = sd_device_monitor_start(monitor, worker_device_monitor_handler, manager); if (r < 0) return log_error_errno(r, "Failed to start device monitor: %m"); (void) sd_event_source_set_description(sd_device_monitor_get_event_source(monitor), "worker-device-monitor"); /* Process first device */ (void) worker_device_monitor_handler(monitor, dev, manager); r = sd_event_loop(manager->event); if (r < 0) return log_error_errno(r, "Event loop failed: %m"); return 0; } static int worker_spawn(Manager *manager, struct event *event) { _cleanup_(sd_device_monitor_unrefp) sd_device_monitor *worker_monitor = NULL; struct worker *worker; pid_t pid; int r; /* listen for new events */ r = device_monitor_new_full(&worker_monitor, MONITOR_GROUP_NONE, -1); if (r < 0) return r; /* allow the main daemon netlink address to send devices to the worker */ r = device_monitor_allow_unicast_sender(worker_monitor, manager->monitor); if (r < 0) return log_error_errno(r, "Worker: Failed to set unicast sender: %m"); r = device_monitor_enable_receiving(worker_monitor); if (r < 0) return log_error_errno(r, "Worker: Failed to enable receiving of device: %m"); r = safe_fork(NULL, FORK_DEATHSIG, &pid); if (r < 0) { event->state = EVENT_QUEUED; return log_error_errno(r, "Failed to fork() worker: %m"); } if (r == 0) { /* Worker process */ r = worker_main(manager, worker_monitor, sd_device_ref(event->dev)); log_close(); _exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS); } r = worker_new(&worker, manager, worker_monitor, pid); if (r < 0) return log_error_errno(r, "Failed to create worker object: %m"); worker_attach_event(worker, event); log_device_debug(event->dev, "Worker ["PID_FMT"] is forked for processing SEQNUM=%"PRIu64".", pid, event->seqnum); return 0; } static void event_run(Manager *manager, struct event *event) { static bool log_children_max_reached = true; struct worker *worker; Iterator i; int r; assert(manager); assert(event); HASHMAP_FOREACH(worker, manager->workers, i) { if (worker->state != WORKER_IDLE) continue; r = device_monitor_send_device(manager->monitor, worker->monitor, event->dev); if (r < 0) { log_device_error_errno(event->dev, r, "Worker ["PID_FMT"] did not accept message, killing the worker: %m", worker->pid); (void) kill(worker->pid, SIGKILL); worker->state = WORKER_KILLED; continue; } worker_attach_event(worker, event); return; } if (hashmap_size(manager->workers) >= arg_children_max) { /* Avoid spamming the debug logs if the limit is already reached and * many events still need to be processed */ if (log_children_max_reached && arg_children_max > 1) { log_debug("Maximum number (%u) of children reached.", hashmap_size(manager->workers)); log_children_max_reached = false; } return; } /* Re-enable the debug message for the next batch of events */ log_children_max_reached = true; /* start new worker and pass initial device */ worker_spawn(manager, event); } static int event_queue_insert(Manager *manager, sd_device *dev) { _cleanup_(sd_device_unrefp) sd_device *clone = NULL; struct event *event; DeviceAction action; uint64_t seqnum; int r; assert(manager); assert(dev); /* only one process can add events to the queue */ assert(manager->pid == getpid_cached()); /* We only accepts devices received by device monitor. */ r = device_get_seqnum(dev, &seqnum); if (r < 0) return r; /* Refuse devices do not have ACTION property. */ r = device_get_action(dev, &action); if (r < 0) return r; /* Save original device to restore the state on failures. */ r = device_shallow_clone(dev, &clone); if (r < 0) return r; r = device_copy_properties(clone, dev); if (r < 0) return r; event = new(struct event, 1); if (!event) return -ENOMEM; *event = (struct event) { .manager = manager, .dev = sd_device_ref(dev), .dev_kernel = TAKE_PTR(clone), .seqnum = seqnum, .state = EVENT_QUEUED, }; if (LIST_IS_EMPTY(manager->events)) { r = touch("/run/udev/queue"); if (r < 0) log_warning_errno(r, "Failed to touch /run/udev/queue: %m"); } LIST_APPEND(event, manager->events, event); log_device_debug(dev, "Device (SEQNUM=%"PRIu64", ACTION=%s) is queued", seqnum, device_action_to_string(action)); return 0; } static void manager_kill_workers(Manager *manager) { struct worker *worker; Iterator i; assert(manager); HASHMAP_FOREACH(worker, manager->workers, i) { if (worker->state == WORKER_KILLED) continue; worker->state = WORKER_KILLED; (void) kill(worker->pid, SIGTERM); } } /* lookup event for identical, parent, child device */ static int is_device_busy(Manager *manager, struct event *event) { const char *subsystem, *devpath, *devpath_old = NULL; dev_t devnum = makedev(0, 0); struct event *loop_event; size_t devpath_len; int r, ifindex = 0; bool is_block; r = sd_device_get_subsystem(event->dev, &subsystem); if (r < 0) return r; is_block = streq(subsystem, "block"); r = sd_device_get_devpath(event->dev, &devpath); if (r < 0) return r; devpath_len = strlen(devpath); r = sd_device_get_property_value(event->dev, "DEVPATH_OLD", &devpath_old); if (r < 0 && r != -ENOENT) return r; r = sd_device_get_devnum(event->dev, &devnum); if (r < 0 && r != -ENOENT) return r; r = sd_device_get_ifindex(event->dev, &ifindex); if (r < 0 && r != -ENOENT) return r; /* check if queue contains events we depend on */ LIST_FOREACH(event, loop_event, manager->events) { size_t loop_devpath_len, common; const char *loop_devpath; /* we already found a later event, earlier cannot block us, no need to check again */ if (loop_event->seqnum < event->delaying_seqnum) continue; /* event we checked earlier still exists, no need to check again */ if (loop_event->seqnum == event->delaying_seqnum) return true; /* found ourself, no later event can block us */ if (loop_event->seqnum >= event->seqnum) break; /* check major/minor */ if (major(devnum) != 0) { const char *s; dev_t d; if (sd_device_get_subsystem(loop_event->dev, &s) < 0) continue; if (sd_device_get_devnum(loop_event->dev, &d) >= 0 && devnum == d && is_block == streq(s, "block")) goto set_delaying_seqnum; } /* check network device ifindex */ if (ifindex > 0) { int i; if (sd_device_get_ifindex(loop_event->dev, &i) >= 0 && ifindex == i) goto set_delaying_seqnum; } if (sd_device_get_devpath(loop_event->dev, &loop_devpath) < 0) continue; /* check our old name */ if (devpath_old && streq(devpath_old, loop_devpath)) goto set_delaying_seqnum; loop_devpath_len = strlen(loop_devpath); /* compare devpath */ common = MIN(devpath_len, loop_devpath_len); /* one devpath is contained in the other? */ if (!strneq(devpath, loop_devpath, common)) continue; /* identical device event found */ if (devpath_len == loop_devpath_len) goto set_delaying_seqnum; /* parent device event found */ if (devpath[common] == '/') goto set_delaying_seqnum; /* child device event found */ if (loop_devpath[common] == '/') goto set_delaying_seqnum; } return false; set_delaying_seqnum: event->delaying_seqnum = loop_event->seqnum; return true; } static int on_exit_timeout(sd_event_source *s, uint64_t usec, void *userdata) { Manager *manager = userdata; assert(manager); log_error("Giving up waiting for workers to finish."); sd_event_exit(manager->event, -ETIMEDOUT); return 1; } static void manager_exit(Manager *manager) { uint64_t usec; int r; assert(manager); manager->exit = true; sd_notify(false, "STOPPING=1\n" "STATUS=Starting shutdown..."); /* close sources of new events and discard buffered events */ manager->ctrl = udev_ctrl_unref(manager->ctrl); manager->inotify_event = sd_event_source_unref(manager->inotify_event); manager->fd_inotify = safe_close(manager->fd_inotify); manager->monitor = sd_device_monitor_unref(manager->monitor); /* discard queued events and kill workers */ event_queue_cleanup(manager, EVENT_QUEUED); manager_kill_workers(manager); assert_se(sd_event_now(manager->event, CLOCK_MONOTONIC, &usec) >= 0); r = sd_event_add_time(manager->event, NULL, CLOCK_MONOTONIC, usec + 30 * USEC_PER_SEC, USEC_PER_SEC, on_exit_timeout, manager); if (r < 0) return; } /* reload requested, HUP signal received, rules changed, builtin changed */ static void manager_reload(Manager *manager) { assert(manager); sd_notify(false, "RELOADING=1\n" "STATUS=Flushing configuration..."); manager_kill_workers(manager); manager->rules = udev_rules_free(manager->rules); udev_builtin_exit(); sd_notifyf(false, "READY=1\n" "STATUS=Processing with %u children at max", arg_children_max); } static int on_kill_workers_event(sd_event_source *s, uint64_t usec, void *userdata) { Manager *manager = userdata; assert(manager); log_debug("Cleanup idle workers"); manager_kill_workers(manager); return 1; } static void event_queue_start(Manager *manager) { struct event *event; usec_t usec; int r; assert(manager); if (LIST_IS_EMPTY(manager->events) || manager->exit || manager->stop_exec_queue) return; assert_se(sd_event_now(manager->event, CLOCK_MONOTONIC, &usec) >= 0); /* check for changed config, every 3 seconds at most */ if (manager->last_usec == 0 || usec - manager->last_usec > 3 * USEC_PER_SEC) { if (udev_rules_check_timestamp(manager->rules) || udev_builtin_validate()) manager_reload(manager); manager->last_usec = usec; } r = event_source_disable(manager->kill_workers_event); if (r < 0) log_warning_errno(r, "Failed to disable event source for cleaning up idle workers, ignoring: %m"); udev_builtin_init(); if (!manager->rules) { r = udev_rules_new(&manager->rules, arg_resolve_name_timing); if (r < 0) { log_warning_errno(r, "Failed to read udev rules: %m"); return; } } LIST_FOREACH(event, event, manager->events) { if (event->state != EVENT_QUEUED) continue; /* do not start event if parent or child event is still running */ if (is_device_busy(manager, event) != 0) continue; event_run(manager, event); } } static void event_queue_cleanup(Manager *manager, enum event_state match_type) { struct event *event, *tmp; LIST_FOREACH_SAFE(event, event, tmp, manager->events) { if (match_type != EVENT_UNDEF && match_type != event->state) continue; event_free(event); } } static int on_worker(sd_event_source *s, int fd, uint32_t revents, void *userdata) { Manager *manager = userdata; assert(manager); for (;;) { struct worker_message msg; struct iovec iovec = { .iov_base = &msg, .iov_len = sizeof(msg), }; union { struct cmsghdr cmsghdr; uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; } control = {}; struct msghdr msghdr = { .msg_iov = &iovec, .msg_iovlen = 1, .msg_control = &control, .msg_controllen = sizeof(control), }; struct cmsghdr *cmsg; ssize_t size; struct ucred *ucred = NULL; struct worker *worker; size = recvmsg(fd, &msghdr, MSG_DONTWAIT); if (size < 0) { if (errno == EINTR) continue; else if (errno == EAGAIN) /* nothing more to read */ break; return log_error_errno(errno, "Failed to receive message: %m"); } else if (size != sizeof(struct worker_message)) { log_warning("Ignoring worker message with invalid size %zi bytes", size); continue; } CMSG_FOREACH(cmsg, &msghdr) if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS && cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred))) ucred = (struct ucred*) CMSG_DATA(cmsg); if (!ucred || ucred->pid <= 0) { log_warning("Ignoring worker message without valid PID"); continue; } /* lookup worker who sent the signal */ worker = hashmap_get(manager->workers, PID_TO_PTR(ucred->pid)); if (!worker) { log_debug("Worker ["PID_FMT"] returned, but is no longer tracked", ucred->pid); continue; } if (worker->state != WORKER_KILLED) worker->state = WORKER_IDLE; /* worker returned */ event_free(worker->event); } /* we have free workers, try to schedule events */ event_queue_start(manager); return 1; } static int on_uevent(sd_device_monitor *monitor, sd_device *dev, void *userdata) { Manager *manager = userdata; int r; assert(manager); device_ensure_usec_initialized(dev, NULL); r = event_queue_insert(manager, dev); if (r < 0) { log_device_error_errno(dev, r, "Failed to insert device into event queue: %m"); return 1; } /* we have fresh events, try to schedule them */ event_queue_start(manager); return 1; } /* receive the udevd message from userspace */ static int on_ctrl_msg(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, const union udev_ctrl_msg_value *value, void *userdata) { Manager *manager = userdata; int r; assert(value); assert(manager); switch (type) { case UDEV_CTRL_SET_LOG_LEVEL: log_debug("Received udev control message (SET_LOG_LEVEL), setting log_priority=%i", value->intval); log_set_max_level_realm(LOG_REALM_UDEV, value->intval); log_set_max_level_realm(LOG_REALM_SYSTEMD, value->intval); manager_kill_workers(manager); break; case UDEV_CTRL_STOP_EXEC_QUEUE: log_debug("Received udev control message (STOP_EXEC_QUEUE)"); manager->stop_exec_queue = true; break; case UDEV_CTRL_START_EXEC_QUEUE: log_debug("Received udev control message (START_EXEC_QUEUE)"); manager->stop_exec_queue = false; event_queue_start(manager); break; case UDEV_CTRL_RELOAD: log_debug("Received udev control message (RELOAD)"); manager_reload(manager); break; case UDEV_CTRL_SET_ENV: { _cleanup_free_ char *key = NULL, *val = NULL, *old_key = NULL, *old_val = NULL; const char *eq; eq = strchr(value->buf, '='); if (!eq) { log_error("Invalid key format '%s'", value->buf); return 1; } key = strndup(value->buf, eq - value->buf); if (!key) { log_oom(); return 1; } old_val = hashmap_remove2(manager->properties, key, (void **) &old_key); r = hashmap_ensure_allocated(&manager->properties, &string_hash_ops); if (r < 0) { log_oom(); return 1; } eq++; if (!isempty(eq)) { log_debug("Received udev control message (ENV), unsetting '%s'", key); r = hashmap_put(manager->properties, key, NULL); if (r < 0) { log_oom(); return 1; } } else { val = strdup(eq); if (!val) { log_oom(); return 1; } log_debug("Received udev control message (ENV), setting '%s=%s'", key, val); r = hashmap_put(manager->properties, key, val); if (r < 0) { log_oom(); return 1; } } key = val = NULL; manager_kill_workers(manager); break; } case UDEV_CTRL_SET_CHILDREN_MAX: if (value->intval <= 0) { log_debug("Received invalid udev control message (SET_MAX_CHILDREN, %i), ignoring.", value->intval); return 0; } log_debug("Received udev control message (SET_MAX_CHILDREN), setting children_max=%i", value->intval); arg_children_max = value->intval; (void) sd_notifyf(false, "READY=1\n" "STATUS=Processing with %u children at max", arg_children_max); break; case UDEV_CTRL_PING: log_debug("Received udev control message (PING)"); break; case UDEV_CTRL_EXIT: log_debug("Received udev control message (EXIT)"); manager_exit(manager); break; default: log_debug("Received unknown udev control message, ignoring"); } return 1; } static int synthesize_change(sd_device *dev) { const char *subsystem, *sysname, *devname, *syspath, *devtype; char filename[PATH_MAX]; int r; r = sd_device_get_subsystem(dev, &subsystem); if (r < 0) return r; r = sd_device_get_sysname(dev, &sysname); if (r < 0) return r; r = sd_device_get_devname(dev, &devname); if (r < 0) return r; r = sd_device_get_syspath(dev, &syspath); if (r < 0) return r; r = sd_device_get_devtype(dev, &devtype); if (r < 0) return r; if (streq_ptr("block", subsystem) && streq_ptr("disk", devtype) && !startswith(sysname, "dm-")) { _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL; bool part_table_read = false, has_partitions = false; sd_device *d; int fd; /* * Try to re-read the partition table. This only succeeds if * none of the devices is busy. The kernel returns 0 if no * partition table is found, and we will not get an event for * the disk. */ fd = open(devname, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); if (fd >= 0) { r = flock(fd, LOCK_EX|LOCK_NB); if (r >= 0) r = ioctl(fd, BLKRRPART, 0); close(fd); if (r >= 0) part_table_read = true; } /* search for partitions */ r = sd_device_enumerator_new(&e); if (r < 0) return r; r = sd_device_enumerator_allow_uninitialized(e); if (r < 0) return r; r = sd_device_enumerator_add_match_parent(e, dev); if (r < 0) return r; r = sd_device_enumerator_add_match_subsystem(e, "block", true); if (r < 0) return r; FOREACH_DEVICE(e, d) { const char *t; if (sd_device_get_devtype(d, &t) < 0 || !streq("partition", t)) continue; has_partitions = true; break; } /* * We have partitions and re-read the table, the kernel already sent * out a "change" event for the disk, and "remove/add" for all * partitions. */ if (part_table_read && has_partitions) return 0; /* * We have partitions but re-reading the partition table did not * work, synthesize "change" for the disk and all partitions. */ log_debug("Device '%s' is closed, synthesising 'change'", devname); strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); FOREACH_DEVICE(e, d) { const char *t, *n, *s; if (sd_device_get_devtype(d, &t) < 0 || !streq("partition", t)) continue; if (sd_device_get_devname(d, &n) < 0 || sd_device_get_syspath(d, &s) < 0) continue; log_debug("Device '%s' is closed, synthesising partition '%s' 'change'", devname, n); strscpyl(filename, sizeof(filename), s, "/uevent", NULL); write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); } return 0; } log_debug("Device %s is closed, synthesising 'change'", devname); strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); return 0; } static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userdata) { Manager *manager = userdata; union inotify_event_buffer buffer; struct inotify_event *e; ssize_t l; int r; assert(manager); r = event_source_disable(manager->kill_workers_event); if (r < 0) log_warning_errno(r, "Failed to disable event source for cleaning up idle workers, ignoring: %m"); l = read(fd, &buffer, sizeof(buffer)); if (l < 0) { if (IN_SET(errno, EAGAIN, EINTR)) return 1; return log_error_errno(errno, "Failed to read inotify fd: %m"); } FOREACH_INOTIFY_EVENT(e, buffer, l) { _cleanup_(sd_device_unrefp) sd_device *dev = NULL; const char *devnode; if (udev_watch_lookup(e->wd, &dev) <= 0) continue; if (sd_device_get_devname(dev, &devnode) < 0) continue; log_device_debug(dev, "Inotify event: %x for %s", e->mask, devnode); if (e->mask & IN_CLOSE_WRITE) synthesize_change(dev); else if (e->mask & IN_IGNORED) udev_watch_end(dev); } return 1; } static int on_sigterm(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { Manager *manager = userdata; assert(manager); manager_exit(manager); return 1; } static int on_sighup(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { Manager *manager = userdata; assert(manager); manager_reload(manager); return 1; } static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { Manager *manager = userdata; int r; assert(manager); for (;;) { pid_t pid; int status; struct worker *worker; pid = waitpid(-1, &status, WNOHANG); if (pid <= 0) break; worker = hashmap_get(manager->workers, PID_TO_PTR(pid)); if (!worker) { log_warning("Worker ["PID_FMT"] is unknown, ignoring", pid); continue; } if (WIFEXITED(status)) { if (WEXITSTATUS(status) == 0) log_debug("Worker ["PID_FMT"] exited", pid); else log_warning("Worker ["PID_FMT"] exited with return code %i", pid, WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) log_warning("Worker ["PID_FMT"] terminated by signal %i (%s)", pid, WTERMSIG(status), signal_to_string(WTERMSIG(status))); else if (WIFSTOPPED(status)) { log_info("Worker ["PID_FMT"] stopped", pid); continue; } else if (WIFCONTINUED(status)) { log_info("Worker ["PID_FMT"] continued", pid); continue; } else log_warning("Worker ["PID_FMT"] exit with status 0x%04x", pid, status); if ((!WIFEXITED(status) || WEXITSTATUS(status) != 0) && worker->event) { log_device_error(worker->event->dev, "Worker ["PID_FMT"] failed", pid); /* delete state from disk */ device_delete_db(worker->event->dev); device_tag_index(worker->event->dev, NULL, false); /* forward kernel event without amending it */ r = device_monitor_send_device(manager->monitor, NULL, worker->event->dev_kernel); if (r < 0) log_device_error_errno(worker->event->dev_kernel, r, "Failed to send back device to kernel: %m"); } worker_free(worker); } /* we can start new workers, try to schedule events */ event_queue_start(manager); /* Disable unnecessary cleanup event */ if (hashmap_isempty(manager->workers)) { r = event_source_disable(manager->kill_workers_event); if (r < 0) log_warning_errno(r, "Failed to disable event source for cleaning up idle workers, ignoring: %m"); } return 1; } static int on_post(sd_event_source *s, void *userdata) { Manager *manager = userdata; assert(manager); if (!LIST_IS_EMPTY(manager->events)) return 1; /* There are no pending events. Let's cleanup idle process. */ if (!hashmap_isempty(manager->workers)) { /* There are idle workers */ (void) event_reset_time(manager->event, &manager->kill_workers_event, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 3 * USEC_PER_SEC, USEC_PER_SEC, on_kill_workers_event, manager, 0, "kill-workers-event", false); return 1; } /* There are no idle workers. */ if (manager->exit) return sd_event_exit(manager->event, 0); if (manager->cgroup) /* cleanup possible left-over processes in our cgroup */ (void) cg_kill(SYSTEMD_CGROUP_CONTROLLER, manager->cgroup, SIGKILL, CGROUP_IGNORE_SELF, NULL, NULL, NULL); return 1; } static int listen_fds(int *ret_ctrl, int *ret_netlink) { int ctrl_fd = -1, netlink_fd = -1; int fd, n; assert(ret_ctrl); assert(ret_netlink); n = sd_listen_fds(true); if (n < 0) return n; for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1) > 0) { if (ctrl_fd >= 0) return -EINVAL; ctrl_fd = fd; continue; } if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1) > 0) { if (netlink_fd >= 0) return -EINVAL; netlink_fd = fd; continue; } return -EINVAL; } *ret_ctrl = ctrl_fd; *ret_netlink = netlink_fd; return 0; } /* * read the kernel command line, in case we need to get into debug mode * udev.log_priority=<level> syslog priority * udev.children_max=<number of workers> events are fully serialized if set to 1 * udev.exec_delay=<number of seconds> delay execution of every executed program * udev.event_timeout=<number of seconds> seconds to wait before terminating an event */ static int parse_proc_cmdline_item(const char *key, const char *value, void *data) { int r = 0; assert(key); if (!value) return 0; if (proc_cmdline_key_streq(key, "udev.log_priority")) { if (proc_cmdline_value_missing(key, value)) return 0; r = log_level_from_string(value); if (r >= 0) log_set_max_level(r); } else if (proc_cmdline_key_streq(key, "udev.event_timeout")) { if (proc_cmdline_value_missing(key, value)) return 0; r = parse_sec(value, &arg_event_timeout_usec); } else if (proc_cmdline_key_streq(key, "udev.children_max")) { if (proc_cmdline_value_missing(key, value)) return 0; r = safe_atou(value, &arg_children_max); } else if (proc_cmdline_key_streq(key, "udev.exec_delay")) { if (proc_cmdline_value_missing(key, value)) return 0; r = parse_sec(value, &arg_exec_delay_usec); } else if (startswith(key, "udev.")) log_warning("Unknown udev kernel command line option \"%s\", ignoring", key); if (r < 0) log_warning_errno(r, "Failed to parse \"%s=%s\", ignoring: %m", key, value); return 0; } static int help(void) { _cleanup_free_ char *link = NULL; int r; r = terminal_urlify_man("systemd-udevd.service", "8", &link); if (r < 0) return log_oom(); printf("%s [OPTIONS...]\n\n" "Manages devices.\n\n" " -h --help Print this message\n" " -V --version Print version of the program\n" " -d --daemon Detach and run in the background\n" " -D --debug Enable debug output\n" " -c --children-max=INT Set maximum number of workers\n" " -e --exec-delay=SECONDS Seconds to wait before executing RUN=\n" " -t --event-timeout=SECONDS Seconds to wait before terminating an event\n" " -N --resolve-names=early|late|never\n" " When to resolve users and groups\n" "\nSee the %s for details.\n" , program_invocation_short_name , link ); return 0; } static int parse_argv(int argc, char *argv[]) { static const struct option options[] = { { "daemon", no_argument, NULL, 'd' }, { "debug", no_argument, NULL, 'D' }, { "children-max", required_argument, NULL, 'c' }, { "exec-delay", required_argument, NULL, 'e' }, { "event-timeout", required_argument, NULL, 't' }, { "resolve-names", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, {} }; int c, r; assert(argc >= 0); assert(argv); while ((c = getopt_long(argc, argv, "c:de:Dt:N:hV", options, NULL)) >= 0) { switch (c) { case 'd': arg_daemonize = true; break; case 'c': r = safe_atou(optarg, &arg_children_max); if (r < 0) log_warning_errno(r, "Failed to parse --children-max= value '%s', ignoring: %m", optarg); break; case 'e': r = parse_sec(optarg, &arg_exec_delay_usec); if (r < 0) log_warning_errno(r, "Failed to parse --exec-delay= value '%s', ignoring: %m", optarg); break; case 't': r = parse_sec(optarg, &arg_event_timeout_usec); if (r < 0) log_warning_errno(r, "Failed to parse --event-timeout= value '%s', ignoring: %m", optarg); break; case 'D': arg_debug = true; break; case 'N': { ResolveNameTiming t; t = resolve_name_timing_from_string(optarg); if (t < 0) log_warning("Invalid --resolve-names= value '%s', ignoring.", optarg); else arg_resolve_name_timing = t; break; } case 'h': return help(); case 'V': printf("%s\n", GIT_VERSION); return 0; case '?': return -EINVAL; default: assert_not_reached("Unhandled option"); } } return 1; } static int manager_new(Manager **ret, int fd_ctrl, int fd_uevent, const char *cgroup) { _cleanup_(manager_freep) Manager *manager = NULL; int r; assert(ret); manager = new(Manager, 1); if (!manager) return log_oom(); *manager = (Manager) { .fd_inotify = -1, .worker_watch = { -1, -1 }, .cgroup = cgroup, }; r = udev_ctrl_new_from_fd(&manager->ctrl, fd_ctrl); if (r < 0) return log_error_errno(r, "Failed to initialize udev control socket: %m"); r = udev_ctrl_enable_receiving(manager->ctrl); if (r < 0) return log_error_errno(r, "Failed to bind udev control socket: %m"); r = device_monitor_new_full(&manager->monitor, MONITOR_GROUP_KERNEL, fd_uevent); if (r < 0) return log_error_errno(r, "Failed to initialize device monitor: %m"); (void) sd_device_monitor_set_receive_buffer_size(manager->monitor, 128 * 1024 * 1024); r = device_monitor_enable_receiving(manager->monitor); if (r < 0) return log_error_errno(r, "Failed to bind netlink socket: %m"); *ret = TAKE_PTR(manager); return 0; } static int main_loop(Manager *manager) { int fd_worker, r; manager->pid = getpid_cached(); /* unnamed socket from workers to the main daemon */ r = socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, manager->worker_watch); if (r < 0) return log_error_errno(errno, "Failed to create socketpair for communicating with workers: %m"); fd_worker = manager->worker_watch[READ_END]; r = setsockopt_int(fd_worker, SOL_SOCKET, SO_PASSCRED, true); if (r < 0) return log_error_errno(r, "Failed to enable SO_PASSCRED: %m"); r = udev_watch_init(); if (r < 0) return log_error_errno(r, "Failed to create inotify descriptor: %m"); manager->fd_inotify = r; udev_watch_restore(); /* block and listen to all signals on signalfd */ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, SIGHUP, SIGCHLD, -1) >= 0); r = sd_event_default(&manager->event); if (r < 0) return log_error_errno(r, "Failed to allocate event loop: %m"); r = sd_event_add_signal(manager->event, NULL, SIGINT, on_sigterm, manager); if (r < 0) return log_error_errno(r, "Failed to create SIGINT event source: %m"); r = sd_event_add_signal(manager->event, NULL, SIGTERM, on_sigterm, manager); if (r < 0) return log_error_errno(r, "Failed to create SIGTERM event source: %m"); r = sd_event_add_signal(manager->event, NULL, SIGHUP, on_sighup, manager); if (r < 0) return log_error_errno(r, "Failed to create SIGHUP event source: %m"); r = sd_event_add_signal(manager->event, NULL, SIGCHLD, on_sigchld, manager); if (r < 0) return log_error_errno(r, "Failed to create SIGCHLD event source: %m"); r = sd_event_set_watchdog(manager->event, true); if (r < 0) return log_error_errno(r, "Failed to create watchdog event source: %m"); r = udev_ctrl_attach_event(manager->ctrl, manager->event); if (r < 0) return log_error_errno(r, "Failed to attach event to udev control: %m"); r = udev_ctrl_start(manager->ctrl, on_ctrl_msg, manager); if (r < 0) return log_error_errno(r, "Failed to start device monitor: %m"); /* This needs to be after the inotify and uevent handling, to make sure * that the ping is send back after fully processing the pending uevents * (including the synthetic ones we may create due to inotify events). */ r = sd_event_source_set_priority(udev_ctrl_get_event_source(manager->ctrl), SD_EVENT_PRIORITY_IDLE); if (r < 0) return log_error_errno(r, "Failed to set IDLE event priority for udev control event source: %m"); r = sd_event_add_io(manager->event, &manager->inotify_event, manager->fd_inotify, EPOLLIN, on_inotify, manager); if (r < 0) return log_error_errno(r, "Failed to create inotify event source: %m"); r = sd_device_monitor_attach_event(manager->monitor, manager->event); if (r < 0) return log_error_errno(r, "Failed to attach event to device monitor: %m"); r = sd_device_monitor_start(manager->monitor, on_uevent, manager); if (r < 0) return log_error_errno(r, "Failed to start device monitor: %m"); (void) sd_event_source_set_description(sd_device_monitor_get_event_source(manager->monitor), "device-monitor"); r = sd_event_add_io(manager->event, NULL, fd_worker, EPOLLIN, on_worker, manager); if (r < 0) return log_error_errno(r, "Failed to create worker event source: %m"); r = sd_event_add_post(manager->event, NULL, on_post, manager); if (r < 0) return log_error_errno(r, "Failed to create post event source: %m"); udev_builtin_init(); r = udev_rules_new(&manager->rules, arg_resolve_name_timing); if (!manager->rules) return log_error_errno(r, "Failed to read udev rules: %m"); r = udev_rules_apply_static_dev_perms(manager->rules); if (r < 0) log_error_errno(r, "Failed to apply permissions on static device nodes: %m"); (void) sd_notifyf(false, "READY=1\n" "STATUS=Processing with %u children at max", arg_children_max); r = sd_event_loop(manager->event); if (r < 0) log_error_errno(r, "Event loop failed: %m"); sd_notify(false, "STOPPING=1\n" "STATUS=Shutting down..."); return r; } static int run(int argc, char *argv[]) { _cleanup_free_ char *cgroup = NULL; _cleanup_(manager_freep) Manager *manager = NULL; int fd_ctrl = -1, fd_uevent = -1; int r; log_set_target(LOG_TARGET_AUTO); udev_parse_config_full(&arg_children_max, &arg_exec_delay_usec, &arg_event_timeout_usec, &arg_resolve_name_timing); log_parse_environment(); log_open(); r = parse_argv(argc, argv); if (r <= 0) return r; r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX); if (r < 0) log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); if (arg_debug) { log_set_target(LOG_TARGET_CONSOLE); log_set_max_level(LOG_DEBUG); } log_set_max_level_realm(LOG_REALM_SYSTEMD, log_get_max_level()); r = must_be_root(); if (r < 0) return r; if (arg_children_max == 0) { unsigned long cpu_limit, mem_limit; unsigned long cpu_count = 1; cpu_set_t cpu_set; if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == 0) cpu_count = CPU_COUNT(&cpu_set); cpu_limit = cpu_count * 2 + 16; mem_limit = MAX(physical_memory() / (128UL*1024*1024), 10U); arg_children_max = MIN(cpu_limit, mem_limit); arg_children_max = MIN(WORKER_NUM_MAX, arg_children_max); log_debug("Set children_max to %u", arg_children_max); } /* set umask before creating any file/directory */ r = chdir("/"); if (r < 0) return log_error_errno(errno, "Failed to change dir to '/': %m"); umask(022); r = mac_selinux_init(); if (r < 0) return log_error_errno(r, "Could not initialize labelling: %m"); r = mkdir_errno_wrapper("/run/udev", 0755); if (r < 0 && r != -EEXIST) return log_error_errno(r, "Failed to create /run/udev: %m"); dev_setup(NULL, UID_INVALID, GID_INVALID); if (getppid() == 1 && sd_booted() > 0) { /* Get our own cgroup, we regularly kill everything udev has left behind. * We only do this on systemd systems, and only if we are directly spawned * by PID1. Otherwise we are not guaranteed to have a dedicated cgroup. */ r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &cgroup); if (r < 0) { if (IN_SET(r, -ENOENT, -ENOMEDIUM)) log_debug_errno(r, "Dedicated cgroup not found: %m"); else log_warning_errno(r, "Failed to get cgroup: %m"); } } r = listen_fds(&fd_ctrl, &fd_uevent); if (r < 0) return log_error_errno(r, "Failed to listen on fds: %m"); r = manager_new(&manager, fd_ctrl, fd_uevent, cgroup); if (r < 0) return log_error_errno(r, "Failed to create manager: %m"); if (arg_daemonize) { pid_t pid; log_info("Starting version " GIT_VERSION); /* connect /dev/null to stdin, stdout, stderr */ if (log_get_max_level() < LOG_DEBUG) { r = make_null_stdio(); if (r < 0) log_warning_errno(r, "Failed to redirect standard streams to /dev/null: %m"); } pid = fork(); if (pid < 0) return log_error_errno(errno, "Failed to fork daemon: %m"); if (pid > 0) /* parent */ return 0; /* child */ (void) setsid(); r = set_oom_score_adjust(-1000); if (r < 0) log_debug_errno(r, "Failed to adjust OOM score, ignoring: %m"); } return main_loop(manager); } DEFINE_MAIN_FUNCTION(run);
pwithnall/systemd
src/udev/udevd.c
C
gpl-2.0
63,050
/* pbrt source code Copyright(c) 1998-2009 Matt Pharr and Greg Humphreys. This file is part of pbrt. pbrt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Note that the text contents of the book "Physically Based Rendering" are *not* licensed under the GNU GPL. pbrt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PBRT_INTEGRATORS_IGI_H #define PBRT_INTEGRATORS_IGI_H // integrators/igi.h* #include "pbrt.h" #include "integrator.h" // IGIIntegrator Local Structures struct VirtualLight { VirtualLight() { } VirtualLight(const Point &pp, const Normal &nn, const Spectrum &c, float reps) : p(pp), n(nn), pathContrib(c), rayEpsilon(reps) { } Point p; Normal n; Spectrum pathContrib; float rayEpsilon; }; // IGIIntegrator Declarations class IGIIntegrator : public SurfaceIntegrator { public: // IGIIntegrator Public Methods ~IGIIntegrator(); Spectrum Li(const Scene *scene, const Renderer *renderer, const RayDifferential &ray, const Intersection &isect, const Sample *sample, RNG &rng, MemoryArena &arena) const; void RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene); void Preprocess(const Scene *, const Camera *, const Renderer *); IGIIntegrator(uint32_t nl, uint32_t ns, float rrt, int maxd, float gl, int ng) { nLightPaths = RoundUpPow2(nl); nLightSets = RoundUpPow2(ns); rrThreshold = rrt; maxSpecularDepth = maxd; virtualLights.resize(nLightSets); gLimit = gl; nGatherSamples = ng; lightSampleOffsets = NULL; bsdfSampleOffsets = NULL; } private: // IGIIntegrator Private Data // Declare sample parameters for light source sampling LightSampleOffsets *lightSampleOffsets; BSDFSampleOffsets *bsdfSampleOffsets; uint32_t nLightPaths, nLightSets; float gLimit; int nGatherSamples; float rrThreshold; int maxSpecularDepth; int vlSetOffset; BSDFSampleOffsets gatherSampleOffset; vector<vector<VirtualLight> > virtualLights; }; IGIIntegrator *CreateIGISurfaceIntegrator(const ParamSet &params); #endif // PBRT_INTEGRATORS_IGI_H
truskhan/ray-hierarchy-
integrators/igi.h
C
gpl-2.0
2,730
#include "fast.h" #include <fstream> #include <strstream> using namespace std; AikSaurusFAST::AikSaurusFAST() { ifstream fin("thesaurus.in"); string index, words; while(fin >> index >> words) { vector<string> foo; for(unsigned int i = 0;i < words.size();++i) { if (words[i] == ',') words[i] = ' '; } istrstream ss(words.c_str()); string str; while(ss >> str) foo.push_back(str); d_data.insert(make_pair(index, foo)); } } const vector<string>& AikSaurusFAST::getSynonyms(const string& word) { map<string, vector<string> >::iterator thing = d_data.find(word); if (thing == d_data.end()) { return d_null; } else { return thing->second; } }
AbiWord/aiksaurus
data/0.12-dev/gen_pms/fast.cpp
C++
gpl-2.0
810
/* Copyright (C) 2003, 2010 - Wolfire Games This file is part of Lugaru. Lugaru is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _SKYBOX_H_ #define _SKYBOX_H_ #include "Quaternions.h" #include "TGALoader.h" #include "Quaternions.h" #include "gamegl.h" #include "Texture.h" class SkyBox { public: Texture front, left, back, right, up, down; void load(const char *ffront, const char *fleft, const char *fback, const char *fright, const char *fup, const char *fdown); void draw(); SkyBox() {} ~SkyBox(); }; #endif
MaddTheSane/Lugaru
Source/Skybox.h
C
gpl-2.0
1,182
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_77) on Thu Apr 14 20:32:35 EEST 2016 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Package com.kodeiinia (evoluutio 1.0-SNAPSHOT API)</title> <meta name="date" content="2016-04-14"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Package com.kodeiinia (evoluutio 1.0-SNAPSHOT API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="navBarCell1Rev">Use</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-all.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?com/kodeiinia/package-use.html" target="_top">Frames</a></li> <li><a href="package-use.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Uses of Package com.kodeiinia" class="title">Uses of Package<br>com.kodeiinia</h1> </div> <div class="contentContainer">No usage of com.kodeiinia</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="navBarCell1Rev">Use</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-all.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?com/kodeiinia/package-use.html" target="_top">Frames</a></li> <li><a href="package-use.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2016. All rights reserved.</small></p> </body> </html>
kodeiinikooprat/evoluutio
target/site/apidocs/com/kodeiinia/package-use.html
HTML
gpl-2.0
4,053
package com.ucan.app.common.utils; import java.io.File; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.MediaStore; import android.text.TextUtils; public class ExportImgUtil { private static final String TAG = "UCAN.ExportImgUtil"; public static void refreshingMediaScanner(Context context , String pathName) { if(TextUtils.isEmpty(pathName)) { return ; } File dir = new File(FileAccessor.EXPORT_DIR , pathName); // exportToGallery(context,dir.getAbsolutePath()); Uri uri = Uri.fromFile(dir); Intent action = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE ,uri); context.sendBroadcast(action); LogUtil.d(TAG , String.format("refreshing media scanner on path=%s" ,new Object[]{pathName})); } private static Uri exportToGallery(Context context ,String filename) { // Save the name and description of a video in a ContentValues map. final ContentValues values = new ContentValues(2); values.put(MediaStore.Video.Media.MIME_TYPE, "image/jpeg"); values.put(MediaStore.Video.Media.DATA, filename); // Add a new record (identified by uri) final Uri uri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); return uri; } }
sosoyiyi/ucan
src/com/ucan/app/common/utils/ExportImgUtil.java
Java
gpl-2.0
1,432
<!--#appendFooterCss/css/3.css;stylesheet;text/css;print#--> <!--#appendFooterCss/css/4.css#--> <!--#appendFooterJs/js/3.js;async#--> <footer> <ul> <!--{tempRow}--> <!--@ROW@--> <li><!--{name}--></li> <!--@ROW@--> </ul> </footer>
teodoroleckie/TBone
Projects/Tpl/Footer.html
HTML
gpl-2.0
269
#shopp_courtesy .inside hr{ border: none; border-bottom: 1px solid #DFDFDF; height: 1px; } #shopp_courtesy .inside em{ color: #A80000; } #shopp_courtesy p.description{ padding: 5px; } #shopp_courtesy .inside ul.option{ padding: 5px; } #shopp_courtesy .inside li.option_name{ font-weight: bold; } #shopp_courtesy .inside li.option_settings{ margin-left: 15px; } #stb-welcome p{ padding: 5px; font-size: 1.1em; } #stb-welcome hr{ border: none; border-bottom: 1px solid #DFDFDF; height: 1px; margin: 5px 0 5px 0; } .center{ margin: 0 auto; }
sharpmachine/prosperoussoul.com
wp-content/plugins/shopp-google-sitemap/css/stb-courtesy-admin.css
CSS
gpl-2.0
587
#!/usr/bin/env bash # Script information SCRIPT_NAME="WordPress Plugin The Test Suite Installer" SCRIPT_VERSION="1.0.1" # Scripts defining custom functions source $(dirname $0)/include/download.sh source $(dirname $0)/include/info.sh source $(dirname $0)/include/downloadWPCLI.sh source $(dirname $0)/include/downloadCodeception.sh # Parse arguments CONFIGURATION_FILE_PATH="settings.cfg" REINSTALL_PROJECT_FILES=0 while getopts “hpvt:c:” OPTION do case $OPTION in h) printUsage exit 1 ;; v) printVersion exit 1 ;; p) echo "Reinstalling project files." REINSTALL_PROJECT_FILES=1 ;; c) CONFIGURATION_FILE_PATH=$OPTARG ;; ?) echo option not found printUsage exit 1 ;; esac done # Configuration File if [ ! -f "$CONFIGURATION_FILE_PATH" ]; then echo The setting file could not be loaded. exit 1 fi source "$CONFIGURATION_FILE_PATH" echo "Using the configuration file: $CONFIGURATION_FILE_PATH" # Variables WORKING_DIR=$(pwd) if [[ -z "$PROJECT_DIR" ]]; then PROJECT_DIR=$(cd "$WORKING_DIR/.."; pwd) fi # convert it to an absolute path PROJECT_DIR="$(cd "$(dirname "$PROJECT_DIR")"; pwd)/$(basename "$PROJECT_DIR")" cd "$WORKING_DIR" TEMP=$([ -z "${TEMP}" ] && echo "/tmp" || echo "$TEMP") WP_CLI="$TEMP/wp-cli.phar" CODECEPT="$TEMP/codecept.phar" C3="$TEMP/c3.php" TEMP_PROJECT_DIR="$TEMP/$PROJECT_SLUG" # Fix: Fatal error: Class 'WP_REST_Server' not found in .../wordpress-tests-lib/includes/spy-rest-server.php on line 3 if echo $WP_VERSION | grep -E '[0-9]+\.[0-9]+(\.[0-9]+)?' > /dev/null then WP_TESTS_TAG="tags/$WP_VERSION" else # http serves a single offer, whereas https serves multiple. we only want one download http://api.wordpress.org/core/version-check/1.7/ "$TEMP/wp-latest.json" if [[ $(uname -s) == 'Darwin' ]]; then SED_REGEXOPTION='-E' #For Max OSX else SED_REGEXOPTION='-r' #Other OSes fi LATEST_VERSION=$(sed $SED_REGEXOPTION 's/.*"version":"([0-9]+\.[0-9]+(\.[0-9]+)?)".*$/\1/g' "$TEMP/wp-latest.json") if [[ -z "$LATEST_VERSION" ]]; then echo "The latest WordPress version could not be found. Script exiting." exit 1 fi WP_TESTS_TAG="tags/$LATEST_VERSION" fi # convert any relative path or Windows path to linux/unix path to be usable for some path related commands such as basename if [ ! -d "$WP_TEST_DIR" ]; then mkdir -p "$WP_TEST_DIR" fi cd "$WP_TEST_DIR" WP_TEST_DIR=$(pwd) cd "$WORKING_DIR" echo "Project Dir: $PROJECT_DIR" echo "Working Dir: $WORKING_DIR" echo "WP Test Dir: $WP_TEST_DIR" echo "WP TESTS TAG: $WP_TESTS_TAG" # Exit on errors, xtrace # set -x # set -ex set -e # On Travis, the working directory looks like: # /home/travis/build/michaeluno/sample-tdd-plugin installWordPress() { # Remove the destination folder if exists to perform a clean install # If the project directory path is the test site directory, which is the case of on Travis CI, do not delete it. if [ ! "$PROJECT_DIR" == "$WP_TEST_DIR" ]; then rm -rf "$WP_TEST_DIR" fi # We use wp-cli command php "$WP_CLI" core download --force --path="$WP_TEST_DIR" # Change directory to the test WordPres install directory. cd "$WP_TEST_DIR" rm -f wp-config.php dbpass= if [[ $DB_PASS ]]; then echo 'db pass is not empty' dbpass=--dbpass="${DB_PASS}" fi php "$WP_CLI" core config --dbname=$DB_NAME --dbuser="$DB_USER" $dbpass --extra-php <<PHP define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); \$table_prefix = '$WP_TABLE_PREFIX'; PHP # Renew the database table setup_database_table # Create/renew the database - if the environment variable WP_MULTISITE is set, install multi site network Wordpress. if [[ $WP_MULTISITE = 1 ]]; then php "$WP_CLI" core multisite-install --url="$WP_URL" --title="$WP_SITE_TITLE" --admin_user="$WP_ADMIN_USER_NAME" --admin_password="$WP_ADMIN_PASSWORD" --admin_email="$WP_ADMIN_EMAIL" else php "$WP_CLI" core install --url="$WP_URL" --title="$WP_SITE_TITLE" --admin_user="$WP_ADMIN_USER_NAME" --admin_password="$WP_ADMIN_PASSWORD" --admin_email="$WP_ADMIN_EMAIL" fi } setup_database_table(){ # If the database table already exists, drop it. # if [[ -z "$DB_PASS" ]]; then # DB_PASS="\"\"" # fi dbpass= if [[ $DB_PASS ]]; then echo 'db pass is not empty' dbpass="-p${DB_PASS}" fi # RESULT=`mysql -u$DB_USER -p$DB_PASS --skip-column-names -e "SHOW DATABASES LIKE '$DB_NAME'"` RESULT=`mysql -u$DB_USER $dbpass --skip-column-names -e "SHOW DATABASES LIKE '$DB_NAME'"` if [ "$RESULT" == "$DB_NAME" ]; then php "$WP_CLI" db drop --yes fi # mysql -u $DB_USER -p$DB_PASS -e --f "DROP $DB_NAME" # mysqladmin -u$#DB_USER -p$DB_PASS drop -f $DB_NAME php "$WP_CLI" db create } # Installs WordPress test suite utilities installWPTestSuite() { # portable in-place argument for both GNU sed and Mac OSX sed if [[ $(uname -s) == 'Darwin' ]]; then local ioption='-i .bak' else local ioption='-i' fi # Download WordPress unit test suite library local WP_TEST_SUITES_TEMP_DIR="$TEMP/wordpress-tests-lib" svn export --force --quiet "https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/" "$WP_TEST_SUITES_TEMP_DIR/includes" svn export --force --quiet "https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/" "$WP_TEST_SUITES_TEMP_DIR/data" # if [[ $WP_MULTISITE = 1 ]]; then # may download multisite.xml for phpUnit # fi # Set up WordPress testing suite library cd "$WP_TEST_DIR" # Some paths written in wp-tests-config.php needs to be modified and on Windows systems, it is difficult to modify them to absolute path. # so in order to use dirname(), the test suites library needs to be placed close to the test site directory. local WP_TEST_SUITES_DIR="$(pwd)/wordpress-tests-lib" # Copy the downloaded files to the test WordPress site directory cp -r "$WP_TEST_SUITES_TEMP_DIR/" "$WP_TEST_DIR" # Make sure the configuration file does not exist. if [ -f "$WP_TEST_SUITES_DIR/wp-tests-config.php" ]; then rm -f "$WP_TEST_SUITES_DIR/wp-tests-config.php" fi download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TEST_SUITES_DIR/wp-tests-config.php" # Edit the tests configuration file. cd "$WP_TEST_SUITES_DIR" sed $ioption "s:dirname( __FILE__ ) . '/src/':dirname( dirname( __FILE__ ) ) . '/':" wp-tests-config.php sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php # Set the environment variable which is accessed from the unit test bootstrap script. export WP_TESTS_DIR="$WP_TEST_SUITES_DIR" } # Uninstalls default plugins uninstallPlugins() { cd "$WP_TEST_DIR" php "$WP_CLI" plugin uninstall akismet php "$WP_CLI" plugin uninstall hello } # Evacuates plugin project files. # This needs to be done before installing the Wordpress files. # When the test WordPress site needs to be placed under the project directory such as on Travis CI, # simply copying the entire project files into the sub-directory of itself is not possible. # so evacuate the project files to a temporary location first and then after installing WordPress, copy them back to the WordPress plugin directory. evacuateProjectFiles() { # Make sure no old file exists. if [ -d "$TEMP_PROJECT_DIR" ]; then rm -rf "$TEMP_PROJECT_DIR" fi # The `ln` command gives "Protocol Error" on Windows hosts so use the cp command. # The below cp command appends an asterisk to drop hidden items especially the .git directory but in that case, the destination directory needs to exist. mkdir -p "$TEMP_PROJECT_DIR" # Drop hidden files from being copied cp -r "$PROJECT_DIR/"* "$TEMP_PROJECT_DIR" 2>/dev/null } # Installs the project plugin installPlugins() { # Install user specified plugins if [[ $WP_MULTISITE = 1 ]]; then local OPTION_ACTIVATE="--activate-network" else local OPTION_ACTIVATE="--activate" fi for _INSTALL_PLUGIN in "${INSTALL_PLUGINS[@]}" do : php "$WP_CLI" plugin install "$_INSTALL_PLUGIN" $OPTION_ACTIVATE done } ## This Project Plugin installProjectFiles() { # Make sure no old file exists. if [ -d "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG" ]; then # Directly removing the directory sometimes fails saying it's not empty. So move it to a different location and then remove. # mv -f "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG" "$TEMP/$PROJECT_SLUG" # rm -rf "$TEMP/$PROJECT_SLUG" # Sometimes moving fails so remove the directory in case. rm -rf "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG" fi # The `ln` command gives "Protocol Error" on Windows hosts so use the cp command. # The below cp command appends an asterisk to drop hidden items especially the .git directory but in that case, the destination directory needs to exist. mkdir -p "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG" # drop hidden files from being copied # cp -r "$PROJECT_DIR/"* "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG" cp -r "$TEMP_PROJECT_DIR" "$WP_TEST_DIR/wp-content/plugins" # wp cli command cd $WP_TEST_DIR if [[ $WP_MULTISITE = 1 ]]; then php "$WP_CLI" plugin activate --network $PROJECT_SLUG else php "$WP_CLI" plugin activate $PROJECT_SLUG fi echo Installed project files. } installCodeception() { # Make sure no old test files exist # if [ -d "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests" ]; then # rm -rf "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests" # fi # Rename `codeception.dist.yaml` temporarily to avoid an error. # @see https://github.com/Codeception/Codeception/issues/5253 CONFIG_DIST_FILE="$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/codeception.dist.yml" CONFIG_DIST_FILE_BACKUP="$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/codeception.dist.yml.bak" mv "$CONFIG_DIST_FILE" "$CONFIG_DIST_FILE_BACKUP" # Run the bootstrap to generate necessary files. echo Creating Codeception configuration files. php "$CODECEPT" bootstrap "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/" # Restore the global configuration distribution file. (codeception.dist.yml) mv "$CONFIG_DIST_FILE_BACKUP" "$CONFIG_DIST_FILE" # @deprecated This seems to be redundant as the entire `tests` directory is copied. # Copy bootstrap scripts. # cp -r "$PROJECT_DIR/test/tests/acceptance/_bootstrap.php" "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests/acceptance/_bootstrap.php" # cp -r "$PROJECT_DIR/test/tests/functional/_bootstrap.php" "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests/functional/_bootstrap.php" # cp -r "$PROJECT_DIR/test/tests/unit/_bootstrap.php" "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests/unit/_bootstrap.php" # Create an acceptance setting file. FILE="$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests/acceptance.suite.yml" cat <<EOM >$FILE modules: config: PhpBrowser: url: '$WP_URL' EOM # Create a Codeception global setting file FILE="$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/codeception.yml" cat <<EOM >$FILE modules: config: Db: dsn: 'mysql:host=$DB_HOST;dbname=$DB_NAME' user: '$DB_USER' password: '$DB_PASS' EOM # Make it load c3.php # cp -r "$C3" "$WP_TEST_DIR/c3.php" # cd "$WP_TEST_DIR" # sed -i "s:<?php:<?php require( dirname( __FILE__ ) . '/c3.php' );:" index.php # Create sub-directories used by c3 # mkdir -p "$WP_TEST_DIR/report" # mkdir -p "$WP_TEST_DIR/c3tmp" # Dump sql database file. cd "$WP_TEST_DIR" mkdir -p "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests/_data/" php "$WP_CLI" db export "$WP_TEST_DIR/wp-content/plugins/$PROJECT_SLUG/test/tests/_data/dump.sql" } # Download necessary applications downloadWPCLI "$WP_CLI" downloadCodeception "$CODECEPT" evacuateProjectFiles # Install components if [[ REINSTALL_PROJECT_FILES -ne 1 ]]; then installWordPress echo Installed WordPress installWPTestSuite echo Installed WordPress test suite utilities uninstallPlugins echo Installed installPlugins fi installProjectFiles installCodeception # Let the user know it's finished if [[ REINSTALL_PROJECT_FILES -eq 1 ]]; then echo Reinstallation has been completed! else echo Installation has been completed! fi
michaeluno/custom-scrollbar
test/install.sh
Shell
gpl-2.0
13,448
/* * Copyright (C) 2021-2022 Colin Ian King * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ static inline void clflush(void *ptr) { asm volatile("clflush (%0)\n" : : "r"(ptr) : "memory"); } int main(int argc, char **argv) { char buf[64]; clflush(buf); return 0; }
ColinIanKing/stress-ng
test/test-asm-x86-clflush.c
C
gpl-2.0
953
<?php /** * @file * Drupal site-specific configuration file. * * IMPORTANT NOTE: * This file may have been set to read-only by the Drupal installation program. * If you make changes to this file, be sure to protect it again after making * your modifications. Failure to remove write permissions to this file is a * security risk. * * The configuration file to be loaded is based upon the rules below. However * if the multisite aliasing file named sites/sites.php is present, it will be * loaded, and the aliases in the array $sites will override the default * directory rules below. See sites/example.sites.php for more information about * aliases. * * The configuration directory will be discovered by stripping the website's * hostname from left to right and pathname from right to left. The first * configuration file found will be used and any others will be ignored. If no * other configuration file is found then the default configuration file at * 'sites/default' will be used. * * For example, for a fictitious site installed at * http://www.drupal.org:8080/mysite/test/, the 'settings.php' file is searched * for in the following directories: * * - sites/8080.www.drupal.org.mysite.test * - sites/www.drupal.org.mysite.test * - sites/drupal.org.mysite.test * - sites/org.mysite.test * * - sites/8080.www.drupal.org.mysite * - sites/www.drupal.org.mysite * - sites/drupal.org.mysite * - sites/org.mysite * * - sites/8080.www.drupal.org * - sites/www.drupal.org * - sites/drupal.org * - sites/org * * - sites/default * * Note that if you are installing on a non-standard port number, prefix the * hostname with that number. For example, * http://www.drupal.org:8080/mysite/test/ could be loaded from * sites/8080.www.drupal.org.mysite.test/. * * @see example.sites.php * @see conf_path() */ /** * Database settings: * * The $databases array specifies the database connection or * connections that Drupal may use. Drupal is able to connect * to multiple databases, including multiple types of databases, * during the same request. * * Each database connection is specified as an array of settings, * similar to the following: * @code * array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'port' => 3306, * 'prefix' => 'myprefix_', * 'collation' => 'utf8_general_ci', * ); * @endcode * * The "driver" property indicates what Drupal database driver the * connection should use. This is usually the same as the name of the * database type, such as mysql or sqlite, but not always. The other * properties will vary depending on the driver. For SQLite, you must * specify a database file name in a directory that is writable by the * webserver. For most other drivers, you must specify a * username, password, host, and database name. * * Transaction support is enabled by default for all drivers that support it, * including MySQL. To explicitly disable it, set the 'transactions' key to * FALSE. * Note that some configurations of MySQL, such as the MyISAM engine, don't * support it and will proceed silently even if enabled. If you experience * transaction related crashes with such configuration, set the 'transactions' * key to FALSE. * * For each database, you may optionally specify multiple "target" databases. * A target database allows Drupal to try to send certain queries to a * different database if it can but fall back to the default connection if not. * That is useful for master/slave replication, as Drupal may try to connect * to a slave server when appropriate and if one is not available will simply * fall back to the single master server. * * The general format for the $databases array is as follows: * @code * $databases['default']['default'] = $info_array; * $databases['default']['slave'][] = $info_array; * $databases['default']['slave'][] = $info_array; * $databases['extra']['default'] = $info_array; * @endcode * * In the above example, $info_array is an array of settings described above. * The first line sets a "default" database that has one master database * (the second level default). The second and third lines create an array * of potential slave databases. Drupal will select one at random for a given * request as needed. The fourth line creates a new database with a name of * "extra". * * For a single database configuration, the following is sufficient: * @code * $databases['default']['default'] = array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'prefix' => 'main_', * 'collation' => 'utf8_general_ci', * ); * @endcode * * For handling full UTF-8 in MySQL, including multi-byte characters such as * emojis, Asian symbols, and mathematical symbols, you may set the collation * and charset to "utf8mb4" prior to running install.php: * @code * $databases['default']['default'] = array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'charset' => 'utf8mb4', * 'collation' => 'utf8mb4_general_ci', * ); * @endcode * When using this setting on an existing installation, ensure that all existing * tables have been converted to the utf8mb4 charset, for example by using the * utf8mb4_convert contributed project available at * https://www.drupal.org/project/utf8mb4_convert, so as to prevent mixing data * with different charsets. * Note this should only be used when all of the following conditions are met: * - In order to allow for large indexes, MySQL must be set up with the * following my.cnf settings: * [mysqld] * innodb_large_prefix=true * innodb_file_format=barracuda * innodb_file_per_table=true * These settings are available as of MySQL 5.5.14, and are defaults in * MySQL 5.7.7 and up. * - The PHP MySQL driver must support the utf8mb4 charset (libmysqlclient * 5.5.3 and up, as well as mysqlnd 5.0.9 and up). * - The MySQL server must support the utf8mb4 charset (5.5.3 and up). * * You can optionally set prefixes for some or all database table names * by using the 'prefix' setting. If a prefix is specified, the table * name will be prepended with its value. Be sure to use valid database * characters only, usually alphanumeric and underscore. If no prefixes * are desired, leave it as an empty string ''. * * To have all database names prefixed, set 'prefix' as a string: * @code * 'prefix' => 'main_', * @endcode * To provide prefixes for specific tables, set 'prefix' as an array. * The array's keys are the table names and the values are the prefixes. * The 'default' element is mandatory and holds the prefix for any tables * not specified elsewhere in the array. Example: * @code * 'prefix' => array( * 'default' => 'main_', * 'users' => 'shared_', * 'sessions' => 'shared_', * 'role' => 'shared_', * 'authmap' => 'shared_', * ), * @endcode * You can also use a reference to a schema/database as a prefix. This may be * useful if your Drupal installation exists in a schema that is not the default * or you want to access several databases from the same code base at the same * time. * Example: * @code * 'prefix' => array( * 'default' => 'main.', * 'users' => 'shared.', * 'sessions' => 'shared.', * 'role' => 'shared.', * 'authmap' => 'shared.', * ); * @endcode * NOTE: MySQL and SQLite's definition of a schema is a database. * * Advanced users can add or override initial commands to execute when * connecting to the database server, as well as PDO connection settings. For * example, to enable MySQL SELECT queries to exceed the max_join_size system * variable, and to reduce the database connection timeout to 5 seconds: * * @code * $databases['default']['default'] = array( * 'init_commands' => array( * 'big_selects' => 'SET SQL_BIG_SELECTS=1', * ), * 'pdo' => array( * PDO::ATTR_TIMEOUT => 5, * ), * ); * @endcode * * WARNING: These defaults are designed for database portability. Changing them * may cause unexpected behavior, including potential data loss. * * @see DatabaseConnection_mysql::__construct * @see DatabaseConnection_pgsql::__construct * @see DatabaseConnection_sqlite::__construct * * Database configuration format: * @code * $databases['default']['default'] = array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'prefix' => '', * ); * $databases['default']['default'] = array( * 'driver' => 'pgsql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'prefix' => '', * ); * $databases['default']['default'] = array( * 'driver' => 'sqlite', * 'database' => '/path/to/databasefilename', * ); * @endcode */ $databases = array ( 'default' => array ( 'default' => array ( 'database' => 'conext', 'username' => 'conext', 'password' => '@uhgkj&*(k', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), ); /** * Access control for update.php script. * * If you are updating your Drupal installation using the update.php script but * are not logged in using either an account with the "Administer software * updates" permission or the site maintenance account (the account that was * created during installation), you will need to modify the access check * statement below. Change the FALSE to a TRUE to disable the access check. * After finishing the upgrade, be sure to open this file again and change the * TRUE back to a FALSE! */ $update_free_access = FALSE; /** * Salt for one-time login links and cancel links, form tokens, etc. * * This variable will be set to a random value by the installer. All one-time * login links will be invalidated if the value is changed. Note that if your * site is deployed on a cluster of web servers, you must ensure that this * variable has the same value on each server. If this variable is empty, a hash * of the serialized database credentials will be used as a fallback salt. * * For enhanced security, you may set this variable to a value using the * contents of a file outside your docroot that is never saved together * with any backups of your Drupal files and database. * * Example: * $drupal_hash_salt = file_get_contents('/home/example/salt.txt'); * */ $drupal_hash_salt = 'ed3gSIcBN--3nmq-Ydnmr8DDV5jpBgCG96pSgd4WP1s'; /** * Base URL (optional). * * If Drupal is generating incorrect URLs on your site, which could * be in HTML headers (links to CSS and JS files) or visible links on pages * (such as in menus), uncomment the Base URL statement below (remove the * leading hash sign) and fill in the absolute URL to your Drupal installation. * * You might also want to force users to use a given domain. * See the .htaccess file for more information. * * Examples: * $base_url = 'http://www.example.com'; * $base_url = 'http://www.example.com:8888'; * $base_url = 'http://www.example.com/drupal'; * $base_url = 'https://www.example.com:8888/drupal'; * * It is not allowed to have a trailing slash; Drupal will add it * for you. */ # $base_url = 'http://www.example.com'; // NO trailing slash! /** * PHP settings: * * To see what PHP settings are possible, including whether they can be set at * runtime (by using ini_set()), read the PHP documentation: * http://www.php.net/manual/ini.list.php * See drupal_environment_initialize() in includes/bootstrap.inc for required * runtime settings and the .htaccess file for non-runtime settings. Settings * defined there should not be duplicated here so as to avoid conflict issues. */ /** * Some distributions of Linux (most notably Debian) ship their PHP * installations with garbage collection (gc) disabled. Since Drupal depends on * PHP's garbage collection for clearing sessions, ensure that garbage * collection occurs by using the most common settings. */ ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100); /** * Set session lifetime (in seconds), i.e. the time from the user's last visit * to the active session may be deleted by the session garbage collector. When * a session is deleted, authenticated users are logged out, and the contents * of the user's $_SESSION variable is discarded. */ ini_set('session.gc_maxlifetime', 200000); /** * Set session cookie lifetime (in seconds), i.e. the time from the session is * created to the cookie expires, i.e. when the browser is expected to discard * the cookie. The value 0 means "until the browser is closed". */ ini_set('session.cookie_lifetime', 2000000); /** * If you encounter a situation where users post a large amount of text, and * the result is stripped out upon viewing but can still be edited, Drupal's * output filter may not have sufficient memory to process it. If you * experience this issue, you may wish to uncomment the following two lines * and increase the limits of these variables. For more information, see * http://php.net/manual/pcre.configuration.php. */ # ini_set('pcre.backtrack_limit', 200000); # ini_set('pcre.recursion_limit', 200000); /** * Drupal automatically generates a unique session cookie name for each site * based on its full domain name. If you have multiple domains pointing at the * same Drupal site, you can either redirect them all to a single domain (see * comment in .htaccess), or uncomment the line below and specify their shared * base domain. Doing so assures that users remain logged in as they cross * between your various domains. Make sure to always start the $cookie_domain * with a leading dot, as per RFC 2109. */ # $cookie_domain = '.example.com'; /** * Variable overrides: * * To override specific entries in the 'variable' table for this site, * set them here. You usually don't need to use this feature. This is * useful in a configuration file for a vhost or directory, rather than * the default settings.php. Any configuration setting from the 'variable' * table can be given a new value. Note that any values you provide in * these variable overrides will not be modifiable from the Drupal * administration interface. * * The following overrides are examples: * - site_name: Defines the site's name. * - theme_default: Defines the default theme for this site. * - anonymous: Defines the human-readable name of anonymous users. * Remove the leading hash signs to enable. */ # $conf['site_name'] = 'My Drupal site'; # $conf['theme_default'] = 'garland'; # $conf['anonymous'] = 'Visitor'; /** * A custom theme can be set for the offline page. This applies when the site * is explicitly set to maintenance mode through the administration page or when * the database is inactive due to an error. It can be set through the * 'maintenance_theme' key. The template file should also be copied into the * theme. It is located inside 'modules/system/maintenance-page.tpl.php'. * Note: This setting does not apply to installation and update pages. */ # $conf['maintenance_theme'] = 'bartik'; /** * Reverse Proxy Configuration: * * Reverse proxy servers are often used to enhance the performance * of heavily visited sites and may also provide other site caching, * security, or encryption benefits. In an environment where Drupal * is behind a reverse proxy, the real IP address of the client should * be determined such that the correct client IP address is available * to Drupal's logging, statistics, and access management systems. In * the most simple scenario, the proxy server will add an * X-Forwarded-For header to the request that contains the client IP * address. However, HTTP headers are vulnerable to spoofing, where a * malicious client could bypass restrictions by setting the * X-Forwarded-For header directly. Therefore, Drupal's proxy * configuration requires the IP addresses of all remote proxies to be * specified in $conf['reverse_proxy_addresses'] to work correctly. * * Enable this setting to get Drupal to determine the client IP from * the X-Forwarded-For header (or $conf['reverse_proxy_header'] if set). * If you are unsure about this setting, do not have a reverse proxy, * or Drupal operates in a shared hosting environment, this setting * should remain commented out. * * In order for this setting to be used you must specify every possible * reverse proxy IP address in $conf['reverse_proxy_addresses']. * If a complete list of reverse proxies is not available in your * environment (for example, if you use a CDN) you may set the * $_SERVER['REMOTE_ADDR'] variable directly in settings.php. * Be aware, however, that it is likely that this would allow IP * address spoofing unless more advanced precautions are taken. */ # $conf['reverse_proxy'] = TRUE; /** * Specify every reverse proxy IP address in your environment. * This setting is required if $conf['reverse_proxy'] is TRUE. */ # $conf['reverse_proxy_addresses'] = array('a.b.c.d', ...); /** * Set this value if your proxy server sends the client IP in a header * other than X-Forwarded-For. */ # $conf['reverse_proxy_header'] = 'HTTP_X_CLUSTER_CLIENT_IP'; /** * Page caching: * * By default, Drupal sends a "Vary: Cookie" HTTP header for anonymous page * views. This tells a HTTP proxy that it may return a page from its local * cache without contacting the web server, if the user sends the same Cookie * header as the user who originally requested the cached page. Without "Vary: * Cookie", authenticated users would also be served the anonymous page from * the cache. If the site has mostly anonymous users except a few known * editors/administrators, the Vary header can be omitted. This allows for * better caching in HTTP proxies (including reverse proxies), i.e. even if * clients send different cookies, they still get content served from the cache. * However, authenticated users should access the site directly (i.e. not use an * HTTP proxy, and bypass the reverse proxy if one is used) in order to avoid * getting cached pages from the proxy. */ # $conf['omit_vary_cookie'] = TRUE; /** * CSS/JS aggregated file gzip compression: * * By default, when CSS or JS aggregation and clean URLs are enabled Drupal will * store a gzip compressed (.gz) copy of the aggregated files. If this file is * available then rewrite rules in the default .htaccess file will serve these * files to browsers that accept gzip encoded content. This allows pages to load * faster for these users and has minimal impact on server load. If you are * using a webserver other than Apache httpd, or a caching reverse proxy that is * configured to cache and compress these files itself you may want to uncomment * one or both of the below lines, which will prevent gzip files being stored. */ # $conf['css_gzip_compression'] = FALSE; # $conf['js_gzip_compression'] = FALSE; /** * Block caching: * * Block caching may not be compatible with node access modules depending on * how the original block cache policy is defined by the module that provides * the block. By default, Drupal therefore disables block caching when one or * more modules implement hook_node_grants(). If you consider block caching to * be safe on your site and want to bypass this restriction, uncomment the line * below. */ # $conf['block_cache_bypass_node_grants'] = TRUE; /** * String overrides: * * To override specific strings on your site with or without enabling the Locale * module, add an entry to this list. This functionality allows you to change * a small number of your site's default English language interface strings. * * Remove the leading hash signs to enable. */ # $conf['locale_custom_strings_en'][''] = array( # 'forum' => 'Discussion board', # '@count min' => '@count minutes', # ); /** * * IP blocking: * * To bypass database queries for denied IP addresses, use this setting. * Drupal queries the {blocked_ips} table by default on every page request * for both authenticated and anonymous users. This allows the system to * block IP addresses from within the administrative interface and before any * modules are loaded. However on high traffic websites you may want to avoid * this query, allowing you to bypass database access altogether for anonymous * users under certain caching configurations. * * If using this setting, you will need to add back any IP addresses which * you may have blocked via the administrative interface. Each element of this * array represents a blocked IP address. Uncommenting the array and leaving it * empty will have the effect of disabling IP blocking on your site. * * Remove the leading hash signs to enable. */ # $conf['blocked_ips'] = array( # 'a.b.c.d', # ); /** * Fast 404 pages: * * Drupal can generate fully themed 404 pages. However, some of these responses * are for images or other resource files that are not displayed to the user. * This can waste bandwidth, and also generate server load. * * The options below return a simple, fast 404 page for URLs matching a * specific pattern: * - 404_fast_paths_exclude: A regular expression to match paths to exclude, * such as images generated by image styles, or dynamically-resized images. * The default pattern provided below also excludes the private file system. * If you need to add more paths, you can add '|path' to the expression. * - 404_fast_paths: A regular expression to match paths that should return a * simple 404 page, rather than the fully themed 404 page. If you don't have * any aliases ending in htm or html you can add '|s?html?' to the expression. * - 404_fast_html: The html to return for simple 404 pages. * * Add leading hash signs if you would like to disable this functionality. */ $conf['404_fast_paths_exclude'] = '/\/(?:styles)|(?:system\/files)\//'; $conf['404_fast_paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'; $conf['404_fast_html'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>'; /** * By default the page request process will return a fast 404 page for missing * files if they match the regular expression set in '404_fast_paths' and not * '404_fast_paths_exclude' above. 404 errors will simultaneously be logged in * the Drupal system log. * * You can choose to return a fast 404 page earlier for missing pages (as soon * as settings.php is loaded) by uncommenting the line below. This speeds up * server response time when loading 404 error pages and prevents the 404 error * from being logged in the Drupal system log. In order to prevent valid pages * such as image styles and other generated content that may match the * '404_fast_paths' regular expression from returning 404 errors, it is * necessary to add them to the '404_fast_paths_exclude' regular expression * above. Make sure that you understand the effects of this feature before * uncommenting the line below. */ # drupal_fast_404(); /** * External access proxy settings: * * If your site must access the Internet via a web proxy then you can enter * the proxy settings here. Currently only basic authentication is supported * by using the username and password variables. The proxy_user_agent variable * can be set to NULL for proxies that require no User-Agent header or to a * non-empty string for proxies that limit requests to a specific agent. The * proxy_exceptions variable is an array of host names to be accessed directly, * not via proxy. */ # $conf['proxy_server'] = ''; # $conf['proxy_port'] = 8080; # $conf['proxy_username'] = ''; # $conf['proxy_password'] = ''; # $conf['proxy_user_agent'] = ''; # $conf['proxy_exceptions'] = array('127.0.0.1', 'localhost'); /** * Authorized file system operations: * * The Update manager module included with Drupal provides a mechanism for * site administrators to securely install missing updates for the site * directly through the web user interface. On securely-configured servers, * the Update manager will require the administrator to provide SSH or FTP * credentials before allowing the installation to proceed; this allows the * site to update the new files as the user who owns all the Drupal files, * instead of as the user the webserver is running as. On servers where the * webserver user is itself the owner of the Drupal files, the administrator * will not be prompted for SSH or FTP credentials (note that these server * setups are common on shared hosting, but are inherently insecure). * * Some sites might wish to disable the above functionality, and only update * the code directly via SSH or FTP themselves. This setting completely * disables all functionality related to these authorized file operations. * * @see http://drupal.org/node/244924 * * Remove the leading hash signs to disable. */ # $conf['allow_authorize_operations'] = FALSE; /** * Theme debugging: * * When debugging is enabled: * - The markup of each template is surrounded by HTML comments that contain * theming information, such as template file name suggestions. * - Note that this debugging markup will cause automated tests that directly * check rendered HTML to fail. * * For more information about debugging theme templates, see * https://www.drupal.org/node/223440#theme-debug. * * Not recommended in production environments. * * Remove the leading hash sign to enable. */ # $conf['theme_debug'] = TRUE; /** * CSS identifier double underscores allowance: * * To allow CSS identifiers to contain double underscores (.example__selector) * for Drupal's BEM-style naming standards, uncomment the line below. * Note that if you change this value in existing sites, existing page styles * may be broken. * * @see drupal_clean_css_identifier() */ # $conf['allow_css_double_underscores'] = TRUE;
triharyono333/conext
sites/all/libraries/settings.php
PHP
gpl-2.0
26,555
package fr.npellegrin.xebia.mower.exceptions; /** * Represents and exception thrown by the parser. */ public class ParserException extends Exception { private static final long serialVersionUID = -5690949595972473232L; public ParserException() { super(); } public ParserException(final String message, final Throwable cause) { super(message, cause); } public ParserException(final String message) { super(message); } public ParserException(final Throwable cause) { super(cause); } }
npellegrin/MowItNow
src/main/java/fr/npellegrin/xebia/mower/exceptions/ParserException.java
Java
gpl-2.0
508
/* * Copyright (c) 2007-2008 NVIDIA Corporation. All rights reserved. * * NVIDIA Corporation and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation * and any modifications thereto. Any use, reproduction, disclosure or * distribution of this software and related documentation without an express * license agreement from NVIDIA Corporation is strictly prohibited. * */ #include "nvrm_i2c_private.h" #include "nvassert.h" #define NVRM_SOFT_I2C_ENABLE_PRINTF (0) #if (NV_DEBUG && NVRM_SOFT_I2C_ENABLE_PRINTF) #define I2C_DUMP1(x) NvOsDebugPrintf x #define I2C_DUMP(x) NvOsDebugPrintf x #else #define I2C_DUMP1(x) #define I2C_DUMP(x) #endif #define WAIT_USEC(x) NvOsWaitUS(x) static void I2CSetHigh( NvRmI2cController *c ); static void I2CStart( NvRmI2cController *c ); static void I2CStop( NvRmI2cController *c ); static NvU8 I2CReadByte( NvRmI2cController *c ); static NvError I2CWriteByte( NvRmI2cController *c, NvU8 data); static NvU8 I2CReadBit( NvRmI2cController *c ); static NvError I2CWriteBit( NvRmI2cController *c, NvU8 bit); NV_INLINE static void I2CClockHigh(NvRmI2cController *c); NV_INLINE static void I2CClockLow(NvRmI2cController *c); NV_INLINE static void I2CDataHigh( NvRmI2cController *c ); NV_INLINE static void I2CDataLow(NvRmI2cController *c); NV_INLINE static void I2CWaitDataHigh(NvRmI2cController *c); NV_INLINE static NvU8 I2CDataRead( NvRmI2cController *c ); NvError NvRmGpioI2cRead( NvRmI2cController *c, NvU32 slaveAddr, NvU8 *pDataBytes, NvU32 len, NvU32 flags); NvError NvRmGpioI2cWrite( NvRmI2cController *c, NvU32 slaveAddr, NvU8 *pDataBytes, NvU32 len, NvU32 flags); NvError NvRmGpioI2cTransaction( NvRmI2cController *c, NvU32 I2cPinMap, NvU8 *Data, NvU32 DataLength, NvRmI2cTransactionInfo * Transaction, NvU32 NumOfTransactions) { NvU32 i; NvError status = NvSuccess; NvU32 clockPeriod; NvRmGpioPinState val = 0; NV_ASSERT(Transaction); NV_ASSERT(Data); NV_ASSERT((c->hSdaPin && !I2cPinMap) || (!c->hSdaPin && I2cPinMap)); /* Convert frequency to period */ clockPeriod = (NvU32)(1000 / c->clockfreq); if (clockPeriod * c->clockfreq < 1000) { /* This is a ciel operation */ clockPeriod++; } c->I2cClockPeriod = clockPeriod; if (I2cPinMap) { NvU32 scl, sda; if ((c->GetGpioPins)(c, I2cPinMap, &scl, &sda)) { status = NvRmGpioAcquirePinHandle(c->hGpio, (scl>>16), (scl&0xffff), &c->hSclPin); if(!status) status = NvRmGpioAcquirePinHandle(c->hGpio, (sda>>16), (sda&0xffff), &c->hSdaPin); if(status) { NvRmGpioReleasePinHandles(c->hGpio, &c->hSclPin, 1); NvRmGpioReleasePinHandles(c->hGpio, &c->hSdaPin, 1); c->hSclPin = 0; c->hSdaPin = 0; return status; } } else return NvError_NotSupported; } NV_ASSERT(c->hSclPin && c->hSdaPin); I2C_DUMP1(("Clock period = %d", clockPeriod)); /* Load the outputs register to 0, as we always drive the pin low, if at all * we are driving the pin. Otherwise, we make put the pin input mode, * causing the pin to be tristated. */ NvRmGpioWritePins(c->hGpio, &c->hSdaPin, &val, 1); NvRmGpioWritePins(c->hGpio, &c->hSclPin, &val, 1); NvRmGpioConfigPins(c->hGpio, &c->hSdaPin, 1, NvRmGpioPinMode_InputData); NvRmGpioConfigPins(c->hGpio, &c->hSclPin, 1, NvRmGpioPinMode_InputData); /* No support yet for repeat start */ i = 0; while ( i < NumOfTransactions ) { if ( Transaction[i].Flags & NVRM_I2C_WRITE ) { status = NvRmGpioI2cWrite(c, Transaction[i].Address, Data, Transaction[i].NumBytes, Transaction[i].Flags); } else if ( Transaction[i].Flags & NVRM_I2C_READ ) { status = NvRmGpioI2cRead(c, Transaction[i].Address, Data, Transaction[i].NumBytes, Transaction[i].Flags); } Data += Transaction[i].NumBytes; i++; if (status != NvSuccess) break; } /* Put back the pins in function mode */ NvRmGpioConfigPins(c->hGpio, &c->hSdaPin, 1, NvRmGpioPinMode_Function); NvRmGpioConfigPins(c->hGpio, &c->hSclPin, 1, NvRmGpioPinMode_Function); if (I2cPinMap) { NvRmGpioReleasePinHandles(c->hGpio, &c->hSclPin, 1); NvRmGpioReleasePinHandles(c->hGpio, &c->hSdaPin, 1); c->hSclPin = 0; c->hSdaPin = 0; } return status; } NvError NvRmGpioI2cRead( NvRmI2cController *c, NvU32 slaveAddr, NvU8 *pDataBytes, NvU32 len, NvU32 flags) { NV_ASSERT(c->hGpio); /* LSB is always 1 for reads */ slaveAddr = slaveAddr | 0x1; I2CStart( c ); if (I2CWriteByte( c, (NvU8)slaveAddr) != NvSuccess) { I2C_DUMP1(("I2CReadPacket : no ACK for the slave address %x", (slaveAddr >> 1))); I2CStop( c ); return NvError_I2cDeviceNotFound; } while ( len-- ) { *pDataBytes++ = I2CReadByte( c ); /* For all reads execpt the last byte, master should send the ACK. For * the last byte, it should send the NAK */ if (!len) { I2CDataHigh( c ); } else { I2CDataLow( c ); } /* Pulse the clock line */ I2CClockHigh( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); I2CClockLow( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); /* Release the data line */ I2CDataHigh( c ); } if (flags & NVRM_I2C_NOSTOP) { I2CSetHigh( c ); } else { I2CStop( c ); } return NvSuccess; } NvError NvRmGpioI2cWrite( NvRmI2cController *c, NvU32 slaveAddr, NvU8 *pDataBytes, NvU32 len, NvU32 flags) { NvError err = NvSuccess; NV_ASSERT(c); slaveAddr = slaveAddr & ~0x1; I2CStart( c ); if (I2CWriteByte( c, (NvU8)slaveAddr ) != NvSuccess) { I2C_DUMP1(("I2CWrite : no ACK for the slave address %x", slaveAddr)); err = NvError_I2cDeviceNotFound; goto fail; } while ( len-- ) { if (I2CWriteByte( c, *pDataBytes++ ) != NvSuccess) { I2C_DUMP(("I2CWrite: no ACK for the data\r\n")); err = NvError_I2cDeviceNotFound; goto fail; } } if (flags & NVRM_I2C_NOSTOP) { I2CSetHigh(c); } else fail: { I2CStop( c ); } return err; } static void I2CSetHigh( NvRmI2cController *c ) { I2CWaitDataHigh( c ); I2CClockHigh( c ); } static void I2CStart( NvRmI2cController *c ) { I2CDataLow( c ); I2CClockLow( c ); } static void I2CStop( NvRmI2cController *c ) { I2CDataLow( c ); I2CClockHigh( c ); I2CDataHigh( c ); } static NvU8 I2CReadByte( NvRmI2cController *c ) { int ctr; NvU8 data; data = 0; for ( ctr = 0; ctr < 8; ctr++ ) { data = (data << 1) | I2CReadBit( c ); } return data; } static NvError I2CWriteByte( NvRmI2cController *c, NvU8 data ) { NvU32 err = NvSuccess; NvU32 SDA = 0; NvU8 ctr, bit; for ( ctr = 0; ctr < 8; ctr++ ) { bit = (data >> (7 - ctr)) & 0x01; (void)I2CWriteBit( c, bit ); } /* Wait for ACK from slave i.e tristate the Data and pulse the clock and * check if the data line is driven low during the clock high stage. */ I2CDataHigh( c ); I2CClockHigh( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); SDA = I2CDataRead( c ); if (SDA) { err = NvError_I2cDeviceNotFound; } I2CClockLow( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); return err; } static NvU8 I2CReadBit( NvRmI2cController *c ) { NvU8 SDA = 0; I2CDataHigh( c ); // DATA set to high first I2CClockHigh( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); SDA = I2CDataRead( c ); I2CClockLow( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); return SDA; } static NvError I2CWriteBit( NvRmI2cController *c, NvU8 bit ) { if ( bit & 0x1 ) I2CDataHigh( c ); else I2CDataLow( c ); I2CClockHigh( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); I2CClockLow( c ); WAIT_USEC( (c->I2cClockPeriod + 1) / 2 ); return NvSuccess; } static void I2CClockHigh( NvRmI2cController *c ) { // The scheme is to make SCL pin in tri-state, thus depends on // outside pull-up to generate High condition. To be in this // tri-state, enable SCL pin with IN direction. Then, always // clear the latched SDA and SCL bits in the register in preparation // for any next switching to Data Low condition (pin direction changed // to OUT). NvU32 timeout = c->timeout * 1000 / c->I2cClockPeriod ; NvU32 inout; NvRmGpioConfigPins(c->hGpio, &c->hSclPin, 1, NvRmGpioPinMode_InputData); // check whether slave doesn't hold SCL low // if so, wait for certain timeout for release by slave do { WAIT_USEC( c->I2cClockPeriod ); NvRmGpioReadPins(c->hGpio, &c->hSclPin, (NvRmGpioPinState *)&inout, 1); if ( inout ) { return; } } while ( timeout-- ); } NV_INLINE static void I2CClockLow( NvRmI2cController *c ) { NvRmGpioConfigPins(c->hGpio, &c->hSclPin, 1, NvRmGpioPinMode_Output); } NV_INLINE static void I2CDataHigh( NvRmI2cController *c ) { NvRmGpioConfigPins(c->hGpio, &c->hSdaPin, 1, NvRmGpioPinMode_InputData); } NV_INLINE static void I2CDataLow( NvRmI2cController *c ) { NvRmGpioConfigPins(c->hGpio, &c->hSdaPin, 1, NvRmGpioPinMode_Output); } NV_INLINE static void I2CWaitDataHigh( NvRmI2cController *c ) { NvU32 timeout = c->timeout * 1000 / c->I2cClockPeriod ; NvU32 inout; do { WAIT_USEC( c->I2cClockPeriod ); NvRmGpioConfigPins(c->hGpio, &c->hSdaPin, 1, NvRmGpioPinMode_InputData); NvRmGpioReadPins(c->hGpio, &c->hSdaPin, (NvRmGpioPinState *)&inout, 1); if ( inout ) { return; } } while ( timeout-- ); } NV_INLINE static NvU8 I2CDataRead( NvRmI2cController *c ) { NvU32 data; NvRmGpioConfigPins(c->hGpio, &c->hSdaPin, 1, NvRmGpioPinMode_InputData); NvRmGpioReadPins(c->hGpio, &c->hSdaPin, (NvRmGpioPinState *)&data, 1); return (NvU8)(data); }
DmitryADP/diff_qc750
vendor/nvidia/tegra/core/drivers/nvrm/nvrmkernel/io/common/nvrm_gpioi2c.c
C
gpl-2.0
10,969
/* * linux/drivers/ide/ide.c Version 6.31 June 9, 2000 * * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) */ /* * Mostly written by Mark Lord <mlord@pobox.com> * and Gadi Oxman <gadio@netvision.net.il> * and Andre Hedrick <andre@linux-ide.org> * * See linux/MAINTAINERS for address of current maintainer. * * This is the multiple IDE interface driver, as evolved from hd.c. * It supports up to MAX_HWIFS IDE interfaces, on one or more IRQs (usually 14 & 15). * There can be up to two drives per interface, as per the ATA-2 spec. * * Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64 * Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64 * Tertiary: ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64 * Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64 * ... * * From hd.c: * | * | It traverses the request-list, using interrupts to jump between functions. * | As nearly all functions can be called within interrupts, we may not sleep. * | Special care is recommended. Have Fun! * | * | modified by Drew Eckhardt to check nr of hd's from the CMOS. * | * | Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug * | in the early extended-partition checks and added DM partitions. * | * | Early work on error handling by Mika Liljeberg (liljeber@cs.Helsinki.FI). * | * | IRQ-unmask, drive-id, multiple-mode, support for ">16 heads", * | and general streamlining by Mark Lord (mlord@pobox.com). * * October, 1994 -- Complete line-by-line overhaul for linux 1.1.x, by: * * Mark Lord (mlord@pobox.com) (IDE Perf.Pkg) * Delman Lee (delman@ieee.org) ("Mr. atdisk2") * Scott Snyder (snyder@fnald0.fnal.gov) (ATAPI IDE cd-rom) * * This was a rewrite of just about everything from hd.c, though some original * code is still sprinkled about. Think of it as a major evolution, with * inspiration from lots of linux users, esp. hamish@zot.apana.org.au * * Version 1.0 ALPHA initial code, primary i/f working okay * Version 1.3 BETA dual i/f on shared irq tested & working! * Version 1.4 BETA added auto probing for irq(s) * Version 1.5 BETA added ALPHA (untested) support for IDE cd-roms, * ... * Version 5.50 allow values as small as 20 for idebus= * Version 5.51 force non io_32bit in drive_cmd_intr() * change delay_10ms() to delay_50ms() to fix problems * Version 5.52 fix incorrect invalidation of removable devices * add "hdx=slow" command line option * Version 5.60 start to modularize the driver; the disk and ATAPI * drivers can be compiled as loadable modules. * move IDE probe code to ide-probe.c * move IDE disk code to ide-disk.c * add support for generic IDE device subdrivers * add m68k code from Geert Uytterhoeven * probe all interfaces by default * add ioctl to (re)probe an interface * Version 6.00 use per device request queues * attempt to optimize shared hwgroup performance * add ioctl to manually adjust bandwidth algorithms * add kerneld support for the probe module * fix bug in ide_error() * fix bug in the first ide_get_lock() call for Atari * don't flush leftover data for ATAPI devices * Version 6.01 clear hwgroup->active while the hwgroup sleeps * support HDIO_GETGEO for floppies * Version 6.02 fix ide_ack_intr() call * check partition table on floppies * Version 6.03 handle bad status bit sequencing in ide_wait_stat() * Version 6.10 deleted old entries from this list of updates * replaced triton.c with ide-dma.c generic PCI DMA * added support for BIOS-enabled UltraDMA * rename all "promise" things to "pdc4030" * fix EZ-DRIVE handling on small disks * Version 6.11 fix probe error in ide_scan_devices() * fix ancient "jiffies" polling bugs * mask all hwgroup interrupts on each irq entry * Version 6.12 integrate ioctl and proc interfaces * fix parsing of "idex=" command line parameter * Version 6.13 add support for ide4/ide5 courtesy rjones@orchestream.com * Version 6.14 fixed IRQ sharing among PCI devices * Version 6.15 added SMP awareness to IDE drivers * Version 6.16 fixed various bugs; even more SMP friendly * Version 6.17 fix for newest EZ-Drive problem * Version 6.18 default unpartitioned-disk translation now "BIOS LBA" * Version 6.19 Re-design for a UNIFORM driver for all platforms, * model based on suggestions from Russell King and * Geert Uytterhoeven * Promise DC4030VL now supported. * add support for ide6/ide7 * delay_50ms() changed to ide_delay_50ms() and exported. * Version 6.20 Added/Fixed Generic ATA-66 support and hwif detection. * Added hdx=flash to allow for second flash disk * detection w/o the hang loop. * Added support for ide8/ide9 * Added idex=ata66 for the quirky chipsets that are * ATA-66 compliant, but have yet to determine a method * of verification of the 80c cable presence. * Specifically Promise's PDC20262 chipset. * Version 6.21 Fixing/Fixed SMP spinlock issue with insight from an old * hat that clarified original low level driver design. * Version 6.30 Added SMP support; fixed multmode issues. -ml * Version 6.31 Debug Share INTR's and request queue streaming * Native ATA-100 support * Prep for Cascades Project * * Some additional driver compile-time options are in ./include/linux/ide.h * * To do, in likely order of completion: * - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f * */ #define REVISION "Revision: 6.31" #define VERSION "Id: ide.c 6.31 2000/06/09" #undef REALLY_SLOW_IO /* most systems can safely undef this */ #define _IDE_C /* Tell ide.h it's really us */ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/timer.h> #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/major.h> #include <linux/errno.h> #include <linux/genhd.h> #include <linux/blkpg.h> #include <linux/slab.h> #ifndef MODULE #include <linux/init.h> #endif /* MODULE */ #include <linux/pci.h> #include <linux/delay.h> #include <linux/ide.h> #include <linux/devfs_fs_kernel.h> #include <linux/completion.h> #include <asm/byteorder.h> #include <asm/irq.h> #include <asm/uaccess.h> #include <asm/io.h> #include <asm/bitops.h> #include "ide_modes.h" #ifdef CONFIG_KMOD #include <linux/kmod.h> #endif /* CONFIG_KMOD */ /* default maximum number of failures */ #define IDE_DEFAULT_MAX_FAILURES 1 static const byte ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR, IDE4_MAJOR, IDE5_MAJOR, IDE6_MAJOR, IDE7_MAJOR, IDE8_MAJOR, IDE9_MAJOR }; static int idebus_parameter; /* holds the "idebus=" parameter */ static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */ static int initializing; /* set while initializing built-in drivers */ #ifdef CONFIG_BLK_DEV_IDEPCI static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ #endif /* CONFIG_BLK_DEV_IDEPCI */ #if defined(__mc68000__) || defined(CONFIG_APUS) /* * ide_lock is used by the Atari code to obtain access to the IDE interrupt, * which is shared between several drivers. */ static int ide_lock; #endif /* __mc68000__ || CONFIG_APUS */ int noautodma = 0; /* * ide_modules keeps track of the available IDE chipset/probe/driver modules. */ ide_module_t *ide_modules; ide_module_t *ide_probe; /* * This is declared extern in ide.h, for access by other IDE modules: */ ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */ #if (DISK_RECOVERY_TIME > 0) /* * For really screwy hardware (hey, at least it *can* be used with Linux) * we can enforce a minimum delay time between successive operations. */ static unsigned long read_timer (void) { unsigned long t, flags; int i; __save_flags(flags); /* local CPU only */ __cli(); /* local CPU only */ t = jiffies * 11932; outb_p(0, 0x43); i = inb_p(0x40); i |= inb(0x40) << 8; __restore_flags(flags); /* local CPU only */ return (t - i); } #endif /* DISK_RECOVERY_TIME */ static inline void set_recovery_timer (ide_hwif_t *hwif) { #if (DISK_RECOVERY_TIME > 0) hwif->last_time = read_timer(); #endif /* DISK_RECOVERY_TIME */ } /* * Do not even *think* about calling this! */ static void init_hwif_data (unsigned int index) { unsigned int unit; ide_hwif_t *hwif = &ide_hwifs[index]; /* bulk initialize hwif & drive info with zeros */ memset(hwif, 0, sizeof(ide_hwif_t)); /* fill in any non-zero initial values */ hwif->index = index; hwif->noprobe = 1; hwif->major = ide_hwif_to_major[index]; hwif->name[0] = 'i'; hwif->name[1] = 'd'; hwif->name[2] = 'e'; hwif->name[3] = '0' + index; hwif->bus_state = BUSSTATE_ON; for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; drive->media = ide_disk; drive->select.all = (unit<<4)|0xa0; drive->hwif = hwif; drive->ctl = 0x08; drive->ready_stat = READY_STAT; drive->bad_wstat = BAD_W_STAT; drive->special.b.recalibrate = 1; drive->special.b.set_geometry = 1; drive->name[0] = 'h'; drive->name[1] = 'd'; drive->name[2] = 'a' + (index * MAX_DRIVES) + unit; drive->max_failures = IDE_DEFAULT_MAX_FAILURES; init_waitqueue_head(&drive->wqueue); } } /* * Old compatability function - initialise ports using ide_default_io_base */ static void ide_old_init_default_hwifs(void) { unsigned int index; ide_ioreg_t base; ide_hwif_t *hwif; for (index = 0; index < MAX_HWIFS; index++) { hwif = &ide_hwifs[index]; base = ide_default_io_base(index); if (base) { ide_init_hwif_ports(&hwif->hw, base, 0, &hwif->hw.irq); memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); hwif->noprobe = 0; } } } /* * init_ide_data() sets reasonable default values into all fields * of all instances of the hwifs and drives, but only on the first call. * Subsequent calls have no effect (they don't wipe out anything). * * This routine is normally called at driver initialization time, * but may also be called MUCH earlier during kernel "command-line" * parameter processing. As such, we cannot depend on any other parts * of the kernel (such as memory allocation) to be functioning yet. * * This is too bad, as otherwise we could dynamically allocate the * ide_drive_t structs as needed, rather than always consuming memory * for the max possible number (MAX_HWIFS * MAX_DRIVES) of them. */ #define MAGIC_COOKIE 0x12345678 static void __init init_ide_data (void) { unsigned int index; static unsigned long magic_cookie = MAGIC_COOKIE; if (magic_cookie != MAGIC_COOKIE) return; /* already initialized */ magic_cookie = 0; /* Initialise all interface structures */ for (index = 0; index < MAX_HWIFS; ++index) init_hwif_data(index); /* Add default hw interfaces */ ide_old_init_default_hwifs(); ide_init_default_hwifs(); #ifdef CONFIG_BLK_DEV_HD /* Check for any clashes with hd.c driver */ for (index = 0; index < MAX_HWIFS; ++index) if (ide_hwifs[index].hw.io_ports[IDE_DATA_OFFSET] == HD_DATA) hwif->noprobe = 1; /* may be overridden by ide_setup() */ #endif /* CONFIG_BLK_DEV_HD */ idebus_parameter = 0; system_bus_speed = 0; } /* * CompactFlash cards and their brethern pretend to be removable hard disks, except: * (1) they never have a slave unit, and * (2) they don't have doorlock mechanisms. * This test catches them, and is invoked elsewhere when setting appropriate config bits. * * FIXME: This treatment is probably applicable for *all* PCMCIA (PC CARD) devices, * so in linux 2.3.x we should change this to just treat all PCMCIA drives this way, * and get rid of the model-name tests below (too big of an interface change for 2.2.x). * At that time, we might also consider parameterizing the timeouts and retries, * since these are MUCH faster than mechanical drives. -M.Lord */ int drive_is_flashcard (ide_drive_t *drive) { struct hd_driveid *id = drive->id; if (drive->removable && id != NULL) { if (id->config == 0x848a) return 1; /* CompactFlash */ if (!strncmp(id->model, "KODAK ATA_FLASH", 15) /* Kodak */ || !strncmp(id->model, "Hitachi CV", 10) /* Hitachi */ || !strncmp(id->model, "SunDisk SDCFB", 13) /* SunDisk */ || !strncmp(id->model, "HAGIWARA HPC", 12) /* Hagiwara */ || !strncmp(id->model, "LEXAR ATA_FLASH", 15) /* Lexar */ || !strncmp(id->model, "ATA_FLASH", 9)) /* Simple Tech */ { return 1; /* yes, it is a flash memory card */ } } return 0; /* no, it is not a flash memory card */ } /* * ide_system_bus_speed() returns what we think is the system VESA/PCI * bus speed (in MHz). This is used for calculating interface PIO timings. * The default is 40 for known PCI systems, 50 otherwise. * The "idebus=xx" parameter can be used to override this value. * The actual value to be used is computed/displayed the first time through. */ int ide_system_bus_speed (void) { if (!system_bus_speed) { if (idebus_parameter) system_bus_speed = idebus_parameter; /* user supplied value */ #ifdef CONFIG_PCI else if (pci_present()) system_bus_speed = 33; /* safe default value for PCI */ #endif /* CONFIG_PCI */ else system_bus_speed = 50; /* safe default value for VESA and PCI */ printk("ide: Assuming %dMHz system bus speed for PIO modes%s\n", system_bus_speed, idebus_parameter ? "" : "; override with idebus=xx"); } return system_bus_speed; } #if SUPPORT_VLB_SYNC /* * Some localbus EIDE interfaces require a special access sequence * when using 32-bit I/O instructions to transfer data. We call this * the "vlb_sync" sequence, which consists of three successive reads * of the sector count register location, with interrupts disabled * to ensure that the reads all happen together. */ static inline void do_vlb_sync (ide_ioreg_t port) { (void) inb (port); (void) inb (port); (void) inb (port); } #endif /* SUPPORT_VLB_SYNC */ /* * This is used for most PIO data transfers *from* the IDE interface */ void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount) { byte io_32bit; /* first check if this controller has defined a special function * for handling polled ide transfers */ if(HWIF(drive)->ideproc) { HWIF(drive)->ideproc(ideproc_ide_input_data, drive, buffer, wcount); return; } io_32bit = drive->io_32bit; if (io_32bit) { #if SUPPORT_VLB_SYNC if (io_32bit & 2) { unsigned long flags; __save_flags(flags); /* local CPU only */ __cli(); /* local CPU only */ do_vlb_sync(IDE_NSECTOR_REG); insl(IDE_DATA_REG, buffer, wcount); __restore_flags(flags); /* local CPU only */ } else #endif /* SUPPORT_VLB_SYNC */ insl(IDE_DATA_REG, buffer, wcount); } else { #if SUPPORT_SLOW_DATA_PORTS if (drive->slow) { unsigned short *ptr = (unsigned short *) buffer; while (wcount--) { *ptr++ = inw_p(IDE_DATA_REG); *ptr++ = inw_p(IDE_DATA_REG); } } else #endif /* SUPPORT_SLOW_DATA_PORTS */ insw(IDE_DATA_REG, buffer, wcount<<1); } } /* * This is used for most PIO data transfers *to* the IDE interface */ void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount) { byte io_32bit; if(HWIF(drive)->ideproc) { HWIF(drive)->ideproc(ideproc_ide_output_data, drive, buffer, wcount); return; } io_32bit = drive->io_32bit; if (io_32bit) { #if SUPPORT_VLB_SYNC if (io_32bit & 2) { unsigned long flags; __save_flags(flags); /* local CPU only */ __cli(); /* local CPU only */ do_vlb_sync(IDE_NSECTOR_REG); outsl(IDE_DATA_REG, buffer, wcount); __restore_flags(flags); /* local CPU only */ } else #endif /* SUPPORT_VLB_SYNC */ outsl(IDE_DATA_REG, buffer, wcount); } else { #if SUPPORT_SLOW_DATA_PORTS if (drive->slow) { unsigned short *ptr = (unsigned short *) buffer; while (wcount--) { outw_p(*ptr++, IDE_DATA_REG); outw_p(*ptr++, IDE_DATA_REG); } } else #endif /* SUPPORT_SLOW_DATA_PORTS */ outsw(IDE_DATA_REG, buffer, wcount<<1); } } /* * The following routines are mainly used by the ATAPI drivers. * * These routines will round up any request for an odd number of bytes, * so if an odd bytecount is specified, be sure that there's at least one * extra byte allocated for the buffer. */ void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) { if(HWIF(drive)->ideproc) { HWIF(drive)->ideproc(ideproc_atapi_input_bytes, drive, buffer, bytecount); return; } ++bytecount; #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) if (MACH_IS_ATARI || MACH_IS_Q40) { /* Atari has a byte-swapped IDE interface */ insw_swapw(IDE_DATA_REG, buffer, bytecount / 2); return; } #endif /* CONFIG_ATARI */ ide_input_data (drive, buffer, bytecount / 4); if ((bytecount & 0x03) >= 2) insw (IDE_DATA_REG, ((byte *)buffer) + (bytecount & ~0x03), 1); } void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) { if(HWIF(drive)->ideproc) { HWIF(drive)->ideproc(ideproc_atapi_output_bytes, drive, buffer, bytecount); return; } ++bytecount; #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) if (MACH_IS_ATARI || MACH_IS_Q40) { /* Atari has a byte-swapped IDE interface */ outsw_swapw(IDE_DATA_REG, buffer, bytecount / 2); return; } #endif /* CONFIG_ATARI */ ide_output_data (drive, buffer, bytecount / 4); if ((bytecount & 0x03) >= 2) outsw (IDE_DATA_REG, ((byte *)buffer) + (bytecount & ~0x03), 1); } /* * Needed for PCI irq sharing */ static inline int drive_is_ready (ide_drive_t *drive) { byte stat = 0; if (drive->waiting_for_dma) return HWIF(drive)->dmaproc(ide_dma_test_irq, drive); #if 0 udelay(1); /* need to guarantee 400ns since last command was issued */ #endif #ifdef CONFIG_IDEPCI_SHARE_IRQ /* * We do a passive status test under shared PCI interrupts on * cards that truly share the ATA side interrupt, but may also share * an interrupt with another pci card/device. We make no assumptions * about possible isa-pnp and pci-pnp issues yet. */ if (IDE_CONTROL_REG) stat = GET_ALTSTAT(); else #endif /* CONFIG_IDEPCI_SHARE_IRQ */ stat = GET_STAT(); /* Note: this may clear a pending IRQ!! */ if (stat & BUSY_STAT) return 0; /* drive busy: definitely not interrupting */ return 1; /* drive ready: *might* be interrupting */ } /* * This is our end_request replacement function. */ void ide_end_request (byte uptodate, ide_hwgroup_t *hwgroup) { struct request *rq; unsigned long flags; ide_drive_t *drive = hwgroup->drive; spin_lock_irqsave(&io_request_lock, flags); rq = hwgroup->rq; /* * decide whether to reenable DMA -- 3 is a random magic for now, * if we DMA timeout more than 3 times, just stay in PIO */ if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { drive->state = 0; hwgroup->hwif->dmaproc(ide_dma_on, drive); } if (!end_that_request_first(rq, uptodate, hwgroup->drive->name)) { add_blkdev_randomness(MAJOR(rq->rq_dev)); blkdev_dequeue_request(rq); hwgroup->rq = NULL; end_that_request_last(rq); } spin_unlock_irqrestore(&io_request_lock, flags); } /* * This should get invoked any time we exit the driver to * wait for an interrupt response from a drive. handler() points * at the appropriate code to handle the next interrupt, and a * timer is started to prevent us from waiting forever in case * something goes wrong (see the ide_timer_expiry() handler later on). */ void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry) { unsigned long flags; ide_hwgroup_t *hwgroup = HWGROUP(drive); spin_lock_irqsave(&io_request_lock, flags); if (hwgroup->handler != NULL) { printk("%s: ide_set_handler: handler not null; old=%p, new=%p\n", drive->name, hwgroup->handler, handler); } hwgroup->handler = handler; hwgroup->expiry = expiry; hwgroup->timer.expires = jiffies + timeout; add_timer(&hwgroup->timer); spin_unlock_irqrestore(&io_request_lock, flags); } /* * current_capacity() returns the capacity (in sectors) of a drive * according to its current geometry/LBA settings. */ unsigned long current_capacity (ide_drive_t *drive) { if (!drive->present) return 0; if (drive->driver != NULL) return DRIVER(drive)->capacity(drive); return 0; } extern struct block_device_operations ide_fops[]; /* * ide_geninit() is called exactly *once* for each interface. */ void ide_geninit (ide_hwif_t *hwif) { unsigned int unit; struct gendisk *gd = hwif->gd; for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; if (!drive->present) continue; if (drive->media!=ide_disk && drive->media!=ide_floppy) continue; register_disk(gd,MKDEV(hwif->major,unit<<PARTN_BITS), #ifdef CONFIG_BLK_DEV_ISAPNP (drive->forced_geom && drive->noprobe) ? 1 : #endif /* CONFIG_BLK_DEV_ISAPNP */ 1<<PARTN_BITS, ide_fops, current_capacity(drive)); } } static ide_startstop_t do_reset1 (ide_drive_t *, int); /* needed below */ /* * atapi_reset_pollfunc() gets invoked to poll the interface for completion every 50ms * during an atapi drive reset operation. If the drive has not yet responded, * and we have not yet hit our maximum waiting time, then the timer is restarted * for another 50ms. */ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) { ide_hwgroup_t *hwgroup = HWGROUP(drive); byte stat; SELECT_DRIVE(HWIF(drive),drive); udelay (10); if (OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) { printk("%s: ATAPI reset complete\n", drive->name); } else { if (0 < (signed long)(hwgroup->poll_timeout - jiffies)) { ide_set_handler (drive, &atapi_reset_pollfunc, HZ/20, NULL); return ide_started; /* continue polling */ } hwgroup->poll_timeout = 0; /* end of polling */ printk("%s: ATAPI reset timed-out, status=0x%02x\n", drive->name, stat); return do_reset1 (drive, 1); /* do it the old fashioned way */ } hwgroup->poll_timeout = 0; /* done polling */ return ide_stopped; } /* * reset_pollfunc() gets invoked to poll the interface for completion every 50ms * during an ide reset operation. If the drives have not yet responded, * and we have not yet hit our maximum waiting time, then the timer is restarted * for another 50ms. */ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) { ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwif_t *hwif = HWIF(drive); byte tmp; if (!OK_STAT(tmp=GET_STAT(), 0, BUSY_STAT)) { if (0 < (signed long)(hwgroup->poll_timeout - jiffies)) { ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL); return ide_started; /* continue polling */ } printk("%s: reset timed-out, status=0x%02x\n", hwif->name, tmp); drive->failures++; } else { printk("%s: reset: ", hwif->name); if ((tmp = GET_ERR()) == 1) { printk("success\n"); drive->failures = 0; } else { drive->failures++; #if FANCY_STATUS_DUMPS printk("master: "); switch (tmp & 0x7f) { case 1: printk("passed"); break; case 2: printk("formatter device error"); break; case 3: printk("sector buffer error"); break; case 4: printk("ECC circuitry error"); break; case 5: printk("controlling MPU error"); break; default:printk("error (0x%02x?)", tmp); } if (tmp & 0x80) printk("; slave: failed"); printk("\n"); #else printk("failed\n"); #endif /* FANCY_STATUS_DUMPS */ } } hwgroup->poll_timeout = 0; /* done polling */ return ide_stopped; } static void check_dma_crc (ide_drive_t *drive) { if (drive->crc_count) { (void) HWIF(drive)->dmaproc(ide_dma_off_quietly, drive); if ((HWIF(drive)->speedproc) != NULL) HWIF(drive)->speedproc(drive, ide_auto_reduce_xfer(drive)); if (drive->current_speed >= XFER_SW_DMA_0) (void) HWIF(drive)->dmaproc(ide_dma_on, drive); } else { (void) HWIF(drive)->dmaproc(ide_dma_off, drive); } } static void pre_reset (ide_drive_t *drive) { if (drive->driver != NULL) DRIVER(drive)->pre_reset(drive); if (!drive->keep_settings) { if (drive->using_dma) { check_dma_crc(drive); } else { drive->unmask = 0; drive->io_32bit = 0; } return; } if (drive->using_dma) check_dma_crc(drive); } /* * do_reset1() attempts to recover a confused drive by resetting it. * Unfortunately, resetting a disk drive actually resets all devices on * the same interface, so it can really be thought of as resetting the * interface rather than resetting the drive. * * ATAPI devices have their own reset mechanism which allows them to be * individually reset without clobbering other devices on the same interface. * * Unfortunately, the IDE interface does not generate an interrupt to let * us know when the reset operation has finished, so we must poll for this. * Equally poor, though, is the fact that this may a very long time to complete, * (up to 30 seconds worstcase). So, instead of busy-waiting here for it, * we set a timer to poll at 50ms intervals. */ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) { unsigned int unit; unsigned long flags; ide_hwif_t *hwif = HWIF(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive); __save_flags(flags); /* local CPU only */ __cli(); /* local CPU only */ /* For an ATAPI device, first try an ATAPI SRST. */ if (drive->media != ide_disk && !do_not_try_atapi) { pre_reset(drive); SELECT_DRIVE(hwif,drive); udelay (20); OUT_BYTE (WIN_SRST, IDE_COMMAND_REG); hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; ide_set_handler (drive, &atapi_reset_pollfunc, HZ/20, NULL); __restore_flags (flags); /* local CPU only */ return ide_started; } /* * First, reset any device state data we were maintaining * for any of the drives on this interface. */ for (unit = 0; unit < MAX_DRIVES; ++unit) pre_reset(&hwif->drives[unit]); #if OK_TO_RESET_CONTROLLER if (!IDE_CONTROL_REG) { __restore_flags(flags); return ide_stopped; } /* * Note that we also set nIEN while resetting the device, * to mask unwanted interrupts from the interface during the reset. * However, due to the design of PC hardware, this will cause an * immediate interrupt due to the edge transition it produces. * This single interrupt gives us a "fast poll" for drives that * recover from reset very quickly, saving us the first 50ms wait time. */ OUT_BYTE(drive->ctl|6,IDE_CONTROL_REG); /* set SRST and nIEN */ udelay(10); /* more than enough time */ OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG); /* clear SRST, leave nIEN */ udelay(10); /* more than enough time */ hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; ide_set_handler (drive, &reset_pollfunc, HZ/20, NULL); /* * Some weird controller like resetting themselves to a strange * state when the disks are reset this way. At least, the Winbond * 553 documentation says that */ if (hwif->resetproc != NULL) hwif->resetproc(drive); #endif /* OK_TO_RESET_CONTROLLER */ __restore_flags (flags); /* local CPU only */ return ide_started; } /* * ide_do_reset() is the entry point to the drive/interface reset code. */ ide_startstop_t ide_do_reset (ide_drive_t *drive) { return do_reset1 (drive, 0); } /* * Clean up after success/failure of an explicit drive cmd */ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err) { unsigned long flags; struct request *rq; spin_lock_irqsave(&io_request_lock, flags); rq = HWGROUP(drive)->rq; spin_unlock_irqrestore(&io_request_lock, flags); if (rq->cmd == IDE_DRIVE_CMD) { byte *args = (byte *) rq->buffer; rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); if (args) { args[0] = stat; args[1] = err; args[2] = IN_BYTE(IDE_NSECTOR_REG); } } else if (rq->cmd == IDE_DRIVE_TASK) { byte *args = (byte *) rq->buffer; rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); if (args) { args[0] = stat; args[1] = err; args[2] = IN_BYTE(IDE_NSECTOR_REG); args[3] = IN_BYTE(IDE_SECTOR_REG); args[4] = IN_BYTE(IDE_LCYL_REG); args[5] = IN_BYTE(IDE_HCYL_REG); args[6] = IN_BYTE(IDE_SELECT_REG); } } spin_lock_irqsave(&io_request_lock, flags); blkdev_dequeue_request(rq); HWGROUP(drive)->rq = NULL; end_that_request_last(rq); spin_unlock_irqrestore(&io_request_lock, flags); } /* * Error reporting, in human readable form (luxurious, but a memory hog). */ byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat) { unsigned long flags; byte err = 0; __save_flags (flags); /* local CPU only */ ide__sti(); /* local CPU only */ printk("%s: %s: status=0x%02x", drive->name, msg, stat); #if FANCY_STATUS_DUMPS printk(" { "); if (stat & BUSY_STAT) printk("Busy "); else { if (stat & READY_STAT) printk("DriveReady "); if (stat & WRERR_STAT) printk("DeviceFault "); if (stat & SEEK_STAT) printk("SeekComplete "); if (stat & DRQ_STAT) printk("DataRequest "); if (stat & ECC_STAT) printk("CorrectedError "); if (stat & INDEX_STAT) printk("Index "); if (stat & ERR_STAT) printk("Error "); } printk("}"); #endif /* FANCY_STATUS_DUMPS */ printk("\n"); if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { err = GET_ERR(); printk("%s: %s: error=0x%02x", drive->name, msg, err); #if FANCY_STATUS_DUMPS if (drive->media == ide_disk) { printk(" { "); if (err & ABRT_ERR) printk("DriveStatusError "); if (err & ICRC_ERR) printk("%s", (err & ABRT_ERR) ? "BadCRC " : "BadSector "); if (err & ECC_ERR) printk("UncorrectableError "); if (err & ID_ERR) printk("SectorIdNotFound "); if (err & TRK0_ERR) printk("TrackZeroNotFound "); if (err & MARK_ERR) printk("AddrMarkNotFound "); printk("}"); if ((err & (BBD_ERR | ABRT_ERR)) == BBD_ERR || (err & (ECC_ERR|ID_ERR|MARK_ERR))) { byte cur = IN_BYTE(IDE_SELECT_REG); if (cur & 0x40) { /* using LBA? */ printk(", LBAsect=%ld", (unsigned long) ((cur&0xf)<<24) |(IN_BYTE(IDE_HCYL_REG)<<16) |(IN_BYTE(IDE_LCYL_REG)<<8) | IN_BYTE(IDE_SECTOR_REG)); } else { printk(", CHS=%d/%d/%d", (IN_BYTE(IDE_HCYL_REG)<<8) + IN_BYTE(IDE_LCYL_REG), cur & 0xf, IN_BYTE(IDE_SECTOR_REG)); } if (HWGROUP(drive) && HWGROUP(drive)->rq) printk(", sector=%ld", HWGROUP(drive)->rq->sector); } } #endif /* FANCY_STATUS_DUMPS */ printk("\n"); } __restore_flags (flags); /* local CPU only */ return err; } /* * try_to_flush_leftover_data() is invoked in response to a drive * unexpectedly having its DRQ_STAT bit set. As an alternative to * resetting the drive, this routine tries to clear the condition * by read a sector's worth of data from the drive. Of course, * this may not help if the drive is *waiting* for data from *us*. */ static void try_to_flush_leftover_data (ide_drive_t *drive) { int i = (drive->mult_count ? drive->mult_count : 1) * SECTOR_WORDS; if (drive->media != ide_disk) return; while (i > 0) { u32 buffer[16]; unsigned int wcount = (i > 16) ? 16 : i; i -= wcount; ide_input_data (drive, buffer, wcount); } } /* * ide_error() takes action based on the error returned by the drive. */ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat) { struct request *rq; byte err; err = ide_dump_status(drive, msg, stat); if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL) return ide_stopped; /* retry only "normal" I/O: */ if (rq->cmd == IDE_DRIVE_CMD || rq->cmd == IDE_DRIVE_TASK) { rq->errors = 1; ide_end_drive_cmd(drive, stat, err); return ide_stopped; } if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) { /* other bits are useless when BUSY */ rq->errors |= ERROR_RESET; } else { if (drive->media == ide_disk && (stat & ERR_STAT)) { /* err has different meaning on cdrom and tape */ if (err == ABRT_ERR) { if (drive->select.b.lba && IN_BYTE(IDE_COMMAND_REG) == WIN_SPECIFY) return ide_stopped; /* some newer drives don't support WIN_SPECIFY */ } else if ((err & (ABRT_ERR | ICRC_ERR)) == (ABRT_ERR | ICRC_ERR)) { drive->crc_count++; /* UDMA crc error -- just retry the operation */ } else if (err & (BBD_ERR | ECC_ERR)) /* retries won't help these */ rq->errors = ERROR_MAX; else if (err & TRK0_ERR) /* help it find track zero */ rq->errors |= ERROR_RECAL; } if ((stat & DRQ_STAT) && rq->cmd != WRITE) try_to_flush_leftover_data(drive); } if (GET_STAT() & (BUSY_STAT|DRQ_STAT)) OUT_BYTE(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG); /* force an abort */ if (rq->errors >= ERROR_MAX) { if (drive->driver != NULL) DRIVER(drive)->end_request(0, HWGROUP(drive)); else ide_end_request(0, HWGROUP(drive)); } else { if ((rq->errors & ERROR_RESET) == ERROR_RESET) { ++rq->errors; return ide_do_reset(drive); } if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) drive->special.b.recalibrate = 1; ++rq->errors; } return ide_stopped; } /* * Issue a simple drive command * The drive must be selected beforehand. */ void ide_cmd (ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler) { ide_set_handler (drive, handler, WAIT_CMD, NULL); if (IDE_CONTROL_REG) OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* clear nIEN */ SELECT_MASK(HWIF(drive),drive,0); OUT_BYTE(nsect,IDE_NSECTOR_REG); OUT_BYTE(cmd,IDE_COMMAND_REG); } /* * drive_cmd_intr() is invoked on completion of a special DRIVE_CMD. */ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) { struct request *rq = HWGROUP(drive)->rq; byte *args = (byte *) rq->buffer; byte stat = GET_STAT(); int retries = 10; ide__sti(); /* local CPU only */ if ((stat & DRQ_STAT) && args && args[3]) { byte io_32bit = drive->io_32bit; drive->io_32bit = 0; ide_input_data(drive, &args[4], args[3] * SECTOR_WORDS); drive->io_32bit = io_32bit; while (((stat = GET_STAT()) & BUSY_STAT) && retries--) udelay(100); } if (!OK_STAT(stat, READY_STAT, BAD_STAT)) return ide_error(drive, "drive_cmd", stat); /* calls ide_end_drive_cmd */ ide_end_drive_cmd (drive, stat, GET_ERR()); return ide_stopped; } /* * do_special() is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT * commands to a drive. It used to do much more, but has been scaled back. */ static ide_startstop_t do_special (ide_drive_t *drive) { special_t *s = &drive->special; #ifdef DEBUG printk("%s: do_special: 0x%02x\n", drive->name, s->all); #endif if (s->b.set_tune) { ide_tuneproc_t *tuneproc = HWIF(drive)->tuneproc; s->b.set_tune = 0; if (tuneproc != NULL) tuneproc(drive, drive->tune_req); } else if (drive->driver != NULL) { return DRIVER(drive)->special(drive); } else if (s->all) { printk("%s: bad special flag: 0x%02x\n", drive->name, s->all); s->all = 0; } return ide_stopped; } /* * This routine busy-waits for the drive status to be not "busy". * It then checks the status for all of the "good" bits and none * of the "bad" bits, and if all is okay it returns 0. All other * cases return 1 after invoking ide_error() -- caller should just return. * * This routine should get fixed to not hog the cpu during extra long waits.. * That could be done by busy-waiting for the first jiffy or two, and then * setting a timer to wake up at half second intervals thereafter, * until timeout is achieved, before timing out. */ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, byte good, byte bad, unsigned long timeout) { byte stat; int i; unsigned long flags; /* bail early if we've exceeded max_failures */ if (drive->max_failures && (drive->failures > drive->max_failures)) { *startstop = ide_stopped; return 1; } udelay(1); /* spec allows drive 400ns to assert "BUSY" */ if ((stat = GET_STAT()) & BUSY_STAT) { __save_flags(flags); /* local CPU only */ ide__sti(); /* local CPU only */ timeout += jiffies; while ((stat = GET_STAT()) & BUSY_STAT) { if (0 < (signed long)(jiffies - timeout)) { __restore_flags(flags); /* local CPU only */ *startstop = ide_error(drive, "status timeout", stat); return 1; } } __restore_flags(flags); /* local CPU only */ } /* * Allow status to settle, then read it again. * A few rare drives vastly violate the 400ns spec here, * so we'll wait up to 10usec for a "good" status * rather than expensively fail things immediately. * This fix courtesy of Matthew Faupel & Niccolo Rigacci. */ for (i = 0; i < 10; i++) { udelay(1); if (OK_STAT((stat = GET_STAT()), good, bad)) return 0; } *startstop = ide_error(drive, "status error", stat); return 1; } /* * execute_drive_cmd() issues a special drive command, * usually initiated by ioctl() from the external hdparm program. */ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq) { byte *args = rq->buffer; if (args && rq->cmd == IDE_DRIVE_TASK) { byte sel; #ifdef DEBUG printk("%s: DRIVE_TASK_CMD data=x%02x cmd=0x%02x fr=0x%02x ns=0x%02x sc=0x%02x lcyl=0x%02x hcyl=0x%02x sel=0x%02x\n", drive->name, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); #endif OUT_BYTE(args[1], IDE_FEATURE_REG); OUT_BYTE(args[3], IDE_SECTOR_REG); OUT_BYTE(args[4], IDE_LCYL_REG); OUT_BYTE(args[5], IDE_HCYL_REG); sel = (args[6] & ~0x10); if (drive->select.b.unit) sel |= 0x10; OUT_BYTE(sel, IDE_SELECT_REG); ide_cmd(drive, args[0], args[2], &drive_cmd_intr); return ide_started; } else if (args) { #ifdef DEBUG printk("%s: DRIVE_CMD cmd=0x%02x sc=0x%02x fr=0x%02x xx=0x%02x\n", drive->name, args[0], args[1], args[2], args[3]); #endif if (args[0] == WIN_SMART) { OUT_BYTE(0x4f, IDE_LCYL_REG); OUT_BYTE(0xc2, IDE_HCYL_REG); OUT_BYTE(args[2],IDE_FEATURE_REG); OUT_BYTE(args[1],IDE_SECTOR_REG); ide_cmd(drive, args[0], args[3], &drive_cmd_intr); return ide_started; } OUT_BYTE(args[2],IDE_FEATURE_REG); ide_cmd(drive, args[0], args[1], &drive_cmd_intr); return ide_started; } else { /* * NULL is actually a valid way of waiting for * all current requests to be flushed from the queue. */ #ifdef DEBUG printk("%s: DRIVE_CMD (null)\n", drive->name); #endif ide_end_drive_cmd(drive, GET_STAT(), GET_ERR()); return ide_stopped; } } /* * start_request() initiates handling of a new I/O request */ static ide_startstop_t start_request (ide_drive_t *drive) { ide_startstop_t startstop; unsigned long block, blockend; struct request *rq = blkdev_entry_next_request(&drive->queue.queue_head); unsigned int minor = MINOR(rq->rq_dev), unit = minor >> PARTN_BITS; ide_hwif_t *hwif = HWIF(drive); #ifdef DEBUG printk("%s: start_request: current=0x%08lx\n", hwif->name, (unsigned long) rq); #endif /* bail early if we've exceeded max_failures */ if (drive->max_failures && (drive->failures > drive->max_failures)) { goto kill_rq; } if (unit >= MAX_DRIVES) { printk("%s: bad device number: %s\n", hwif->name, kdevname(rq->rq_dev)); goto kill_rq; } #ifdef DEBUG if (rq->bh && !buffer_locked(rq->bh)) { printk("%s: block not locked\n", drive->name); goto kill_rq; } #endif block = rq->sector; blockend = block + rq->nr_sectors; if ((rq->cmd == READ || rq->cmd == WRITE) && (drive->media == ide_disk || drive->media == ide_floppy)) { if ((blockend < block) || (blockend > drive->part[minor&PARTN_MASK].nr_sects)) { printk("%s%c: bad access: block=%ld, count=%ld\n", drive->name, (minor&PARTN_MASK)?'0'+(minor&PARTN_MASK):' ', block, rq->nr_sectors); goto kill_rq; } block += drive->part[minor&PARTN_MASK].start_sect + drive->sect0; } /* Yecch - this will shift the entire interval, possibly killing some innocent following sector */ if (block == 0 && drive->remap_0_to_1 == 1) block = 1; /* redirect MBR access to EZ-Drive partn table */ #if (DISK_RECOVERY_TIME > 0) while ((read_timer() - hwif->last_time) < DISK_RECOVERY_TIME); #endif SELECT_DRIVE(hwif, drive); if (ide_wait_stat(&startstop, drive, drive->ready_stat, BUSY_STAT|DRQ_STAT, WAIT_READY)) { printk("%s: drive not ready for command\n", drive->name); return startstop; } if (!drive->special.all) { if (rq->cmd == IDE_DRIVE_CMD || rq->cmd == IDE_DRIVE_TASK) { return execute_drive_cmd(drive, rq); } if (drive->driver != NULL) { return (DRIVER(drive)->do_request(drive, rq, block)); } printk("%s: media type %d not supported\n", drive->name, drive->media); goto kill_rq; } return do_special(drive); kill_rq: if (drive->driver != NULL) DRIVER(drive)->end_request(0, HWGROUP(drive)); else ide_end_request(0, HWGROUP(drive)); return ide_stopped; } ide_startstop_t restart_request (ide_drive_t *drive) { ide_hwgroup_t *hwgroup = HWGROUP(drive); unsigned long flags; spin_lock_irqsave(&io_request_lock, flags); hwgroup->handler = NULL; del_timer(&hwgroup->timer); spin_unlock_irqrestore(&io_request_lock, flags); return start_request(drive); } /* * ide_stall_queue() can be used by a drive to give excess bandwidth back * to the hwgroup by sleeping for timeout jiffies. */ void ide_stall_queue (ide_drive_t *drive, unsigned long timeout) { if (timeout > WAIT_WORSTCASE) timeout = WAIT_WORSTCASE; drive->sleep = timeout + jiffies; } #define WAKEUP(drive) ((drive)->service_start + 2 * (drive)->service_time) /* * choose_drive() selects the next drive which will be serviced. */ static inline ide_drive_t *choose_drive (ide_hwgroup_t *hwgroup) { ide_drive_t *drive, *best; repeat: best = NULL; drive = hwgroup->drive; do { if (!list_empty(&drive->queue.queue_head) && (!drive->sleep || 0 <= (signed long)(jiffies - drive->sleep))) { if (!best || (drive->sleep && (!best->sleep || 0 < (signed long)(best->sleep - drive->sleep))) || (!best->sleep && 0 < (signed long)(WAKEUP(best) - WAKEUP(drive)))) { if( !drive->queue.plugged ) best = drive; } } } while ((drive = drive->next) != hwgroup->drive); if (best && best->nice1 && !best->sleep && best != hwgroup->drive && best->service_time > WAIT_MIN_SLEEP) { long t = (signed long)(WAKEUP(best) - jiffies); if (t >= WAIT_MIN_SLEEP) { /* * We *may* have some time to spare, but first let's see if * someone can potentially benefit from our nice mood today.. */ drive = best->next; do { if (!drive->sleep && 0 < (signed long)(WAKEUP(drive) - (jiffies - best->service_time)) && 0 < (signed long)((jiffies + t) - WAKEUP(drive))) { ide_stall_queue(best, IDE_MIN(t, 10 * WAIT_MIN_SLEEP)); goto repeat; } } while ((drive = drive->next) != best); } } return best; } /* * Issue a new request to a drive from hwgroup * Caller must have already done spin_lock_irqsave(&io_request_lock, ..); * * A hwgroup is a serialized group of IDE interfaces. Usually there is * exactly one hwif (interface) per hwgroup, but buggy controllers (eg. CMD640) * may have both interfaces in a single hwgroup to "serialize" access. * Or possibly multiple ISA interfaces can share a common IRQ by being grouped * together into one hwgroup for serialized access. * * Note also that several hwgroups can end up sharing a single IRQ, * possibly along with many other devices. This is especially common in * PCI-based systems with off-board IDE controller cards. * * The IDE driver uses the single global io_request_lock spinlock to protect * access to the request queues, and to protect the hwgroup->busy flag. * * The first thread into the driver for a particular hwgroup sets the * hwgroup->busy flag to indicate that this hwgroup is now active, * and then initiates processing of the top request from the request queue. * * Other threads attempting entry notice the busy setting, and will simply * queue their new requests and exit immediately. Note that hwgroup->busy * remains set even when the driver is merely awaiting the next interrupt. * Thus, the meaning is "this hwgroup is busy processing a request". * * When processing of a request completes, the completing thread or IRQ-handler * will start the next request from the queue. If no more work remains, * the driver will clear the hwgroup->busy flag and exit. * * The io_request_lock (spinlock) is used to protect all access to the * hwgroup->busy flag, but is otherwise not needed for most processing in * the driver. This makes the driver much more friendlier to shared IRQs * than previous designs, while remaining 100% (?) SMP safe and capable. */ /* --BenH: made non-static as ide-pmac.c uses it to kick the hwgroup back * into life on wakeup from machine sleep. */ void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq) { ide_drive_t *drive; ide_hwif_t *hwif; ide_startstop_t startstop; ide_get_lock(&ide_lock, ide_intr, hwgroup); /* for atari only: POSSIBLY BROKEN HERE(?) */ __cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */ while (!hwgroup->busy) { hwgroup->busy = 1; drive = choose_drive(hwgroup); if (drive == NULL) { unsigned long sleep = 0; hwgroup->rq = NULL; drive = hwgroup->drive; do { if (drive->sleep && (!sleep || 0 < (signed long)(sleep - drive->sleep))) sleep = drive->sleep; } while ((drive = drive->next) != hwgroup->drive); if (sleep) { /* * Take a short snooze, and then wake up this hwgroup again. * This gives other hwgroups on the same a chance to * play fairly with us, just in case there are big differences * in relative throughputs.. don't want to hog the cpu too much. */ if (0 < (signed long)(jiffies + WAIT_MIN_SLEEP - sleep)) sleep = jiffies + WAIT_MIN_SLEEP; #if 1 if (timer_pending(&hwgroup->timer)) printk("ide_set_handler: timer already active\n"); #endif hwgroup->sleeping = 1; /* so that ide_timer_expiry knows what to do */ mod_timer(&hwgroup->timer, sleep); /* we purposely leave hwgroup->busy==1 while sleeping */ } else { /* Ugly, but how can we sleep for the lock otherwise? perhaps from tq_disk? */ ide_release_lock(&ide_lock); /* for atari only */ hwgroup->busy = 0; } return; /* no more work for this hwgroup (for now) */ } hwif = HWIF(drive); if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif && hwif->io_ports[IDE_CONTROL_OFFSET]) { /* set nIEN for previous hwif */ SELECT_INTERRUPT(hwif, drive); } hwgroup->hwif = hwif; hwgroup->drive = drive; drive->sleep = 0; drive->service_start = jiffies; if ( drive->queue.plugged ) /* paranoia */ printk("%s: Huh? nuking plugged queue\n", drive->name); hwgroup->rq = blkdev_entry_next_request(&drive->queue.queue_head); /* * Some systems have trouble with IDE IRQs arriving while * the driver is still setting things up. So, here we disable * the IRQ used by this interface while the request is being started. * This may look bad at first, but pretty much the same thing * happens anyway when any interrupt comes in, IDE or otherwise * -- the kernel masks the IRQ while it is being handled. */ if (masked_irq && hwif->irq != masked_irq) disable_irq_nosync(hwif->irq); spin_unlock(&io_request_lock); ide__sti(); /* allow other IRQs while we start this request */ startstop = start_request(drive); spin_lock_irq(&io_request_lock); if (masked_irq && hwif->irq != masked_irq) enable_irq(hwif->irq); if (startstop == ide_stopped) hwgroup->busy = 0; } } /* * ide_get_queue() returns the queue which corresponds to a given device. */ request_queue_t *ide_get_queue (kdev_t dev) { ide_hwif_t *hwif = (ide_hwif_t *)blk_dev[MAJOR(dev)].data; return &hwif->drives[DEVICE_NR(dev) & 1].queue; } /* * Passes the stuff to ide_do_request */ void do_ide_request(request_queue_t *q) { ide_do_request(q->queuedata, 0); } /* * un-busy the hwgroup etc, and clear any pending DMA status. we want to * retry the current request in pio mode instead of risking tossing it * all away */ void ide_dma_timeout_retry(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); struct request *rq; /* * end current dma transaction */ (void) hwif->dmaproc(ide_dma_end, drive); /* * complain a little, later we might remove some of this verbosity */ printk("%s: timeout waiting for DMA\n", drive->name); (void) hwif->dmaproc(ide_dma_timeout, drive); /* * disable dma for now, but remember that we did so because of * a timeout -- we'll reenable after we finish this next request * (or rather the first chunk of it) in pio. */ drive->retry_pio++; drive->state = DMA_PIO_RETRY; (void) hwif->dmaproc(ide_dma_off_quietly, drive); /* * un-busy drive etc (hwgroup->busy is cleared on return) and * make sure request is sane */ rq = HWGROUP(drive)->rq; HWGROUP(drive)->rq = NULL; rq->errors = 0; rq->sector = rq->bh->b_rsector; rq->current_nr_sectors = rq->bh->b_size >> 9; rq->buffer = rq->bh->b_data; } /* * ide_timer_expiry() is our timeout function for all drive operations. * But note that it can also be invoked as a result of a "sleep" operation * triggered by the mod_timer() call in ide_do_request. */ void ide_timer_expiry (unsigned long data) { ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data; ide_handler_t *handler; ide_expiry_t *expiry; unsigned long flags; unsigned long wait; spin_lock_irqsave(&io_request_lock, flags); del_timer(&hwgroup->timer); if ((handler = hwgroup->handler) == NULL) { /* * Either a marginal timeout occurred * (got the interrupt just as timer expired), * or we were "sleeping" to give other devices a chance. * Either way, we don't really want to complain about anything. */ if (hwgroup->sleeping) { hwgroup->sleeping = 0; hwgroup->busy = 0; } } else { ide_drive_t *drive = hwgroup->drive; if (!drive) { printk("ide_timer_expiry: hwgroup->drive was NULL\n"); hwgroup->handler = NULL; } else { ide_hwif_t *hwif; ide_startstop_t startstop; if (!hwgroup->busy) { hwgroup->busy = 1; /* paranoia */ printk("%s: ide_timer_expiry: hwgroup->busy was 0 ??\n", drive->name); } if ((expiry = hwgroup->expiry) != NULL) { /* continue */ if ((wait = expiry(drive)) != 0) { /* reset timer */ hwgroup->timer.expires = jiffies + wait; add_timer(&hwgroup->timer); spin_unlock_irqrestore(&io_request_lock, flags); return; } } hwgroup->handler = NULL; /* * We need to simulate a real interrupt when invoking * the handler() function, which means we need to globally * mask the specific IRQ: */ spin_unlock(&io_request_lock); hwif = HWIF(drive); #if DISABLE_IRQ_NOSYNC disable_irq_nosync(hwif->irq); #else disable_irq(hwif->irq); /* disable_irq_nosync ?? */ #endif /* DISABLE_IRQ_NOSYNC */ __cli(); /* local CPU only, as if we were handling an interrupt */ if (hwgroup->poll_timeout != 0) { startstop = handler(drive); } else if (drive_is_ready(drive)) { if (drive->waiting_for_dma) (void) hwgroup->hwif->dmaproc(ide_dma_lostirq, drive); (void)ide_ack_intr(hwif); printk("%s: lost interrupt\n", drive->name); startstop = handler(drive); } else { if (drive->waiting_for_dma) { startstop = ide_stopped; ide_dma_timeout_retry(drive); } else startstop = ide_error(drive, "irq timeout", GET_STAT()); } set_recovery_timer(hwif); drive->service_time = jiffies - drive->service_start; enable_irq(hwif->irq); spin_lock_irq(&io_request_lock); if (startstop == ide_stopped) hwgroup->busy = 0; } } ide_do_request(hwgroup, 0); spin_unlock_irqrestore(&io_request_lock, flags); } /* * There's nothing really useful we can do with an unexpected interrupt, * other than reading the status register (to clear it), and logging it. * There should be no way that an irq can happen before we're ready for it, * so we needn't worry much about losing an "important" interrupt here. * * On laptops (and "green" PCs), an unexpected interrupt occurs whenever the * drive enters "idle", "standby", or "sleep" mode, so if the status looks * "good", we just ignore the interrupt completely. * * This routine assumes __cli() is in effect when called. * * If an unexpected interrupt happens on irq15 while we are handling irq14 * and if the two interfaces are "serialized" (CMD640), then it looks like * we could screw up by interfering with a new request being set up for irq15. * * In reality, this is a non-issue. The new command is not sent unless the * drive is ready to accept one, in which case we know the drive is not * trying to interrupt us. And ide_set_handler() is always invoked before * completing the issuance of any new drive command, so we will not be * accidently invoked as a result of any valid command completion interrupt. * */ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup) { byte stat; ide_hwif_t *hwif = hwgroup->hwif; /* * handle the unexpected interrupt */ do { if (hwif->irq == irq) { stat = IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]); if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { /* Try to not flood the console with msgs */ static unsigned long last_msgtime, count; ++count; if (0 < (signed long)(jiffies - (last_msgtime + HZ))) { last_msgtime = jiffies; printk("%s%s: unexpected interrupt, status=0x%02x, count=%ld\n", hwif->name, (hwif->next == hwgroup->hwif) ? "" : "(?)", stat, count); } } } } while ((hwif = hwif->next) != hwgroup->hwif); } /* * entry point for all interrupts, caller does __cli() for us */ void ide_intr (int irq, void *dev_id, struct pt_regs *regs) { unsigned long flags; ide_hwgroup_t *hwgroup = (ide_hwgroup_t *)dev_id; ide_hwif_t *hwif; ide_drive_t *drive; ide_handler_t *handler; ide_startstop_t startstop; spin_lock_irqsave(&io_request_lock, flags); hwif = hwgroup->hwif; if (!ide_ack_intr(hwif)) { spin_unlock_irqrestore(&io_request_lock, flags); return; } if ((handler = hwgroup->handler) == NULL || hwgroup->poll_timeout != 0) { /* * Not expecting an interrupt from this drive. * That means this could be: * (1) an interrupt from another PCI device * sharing the same PCI INT# as us. * or (2) a drive just entered sleep or standby mode, * and is interrupting to let us know. * or (3) a spurious interrupt of unknown origin. * * For PCI, we cannot tell the difference, * so in that case we just ignore it and hope it goes away. */ #ifdef CONFIG_BLK_DEV_IDEPCI if (IDE_PCI_DEVID_EQ(hwif->pci_devid, IDE_PCI_DEVID_NULL)) #endif /* CONFIG_BLK_DEV_IDEPCI */ { /* * Probably not a shared PCI interrupt, * so we can safely try to do something about it: */ unexpected_intr(irq, hwgroup); #ifdef CONFIG_BLK_DEV_IDEPCI } else { /* * Whack the status register, just in case we have a leftover pending IRQ. */ (void) IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]); #endif /* CONFIG_BLK_DEV_IDEPCI */ } spin_unlock_irqrestore(&io_request_lock, flags); return; } drive = hwgroup->drive; if (!drive) { /* * This should NEVER happen, and there isn't much we could do about it here. */ spin_unlock_irqrestore(&io_request_lock, flags); return; } if (!drive_is_ready(drive)) { /* * This happens regularly when we share a PCI IRQ with another device. * Unfortunately, it can also happen with some buggy drives that trigger * the IRQ before their status register is up to date. Hopefully we have * enough advance overhead that the latter isn't a problem. */ spin_unlock_irqrestore(&io_request_lock, flags); return; } if (!hwgroup->busy) { hwgroup->busy = 1; /* paranoia */ printk("%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); } hwgroup->handler = NULL; del_timer(&hwgroup->timer); spin_unlock(&io_request_lock); if (drive->unmask) ide__sti(); /* local CPU only */ startstop = handler(drive); /* service this interrupt, may set handler for next interrupt */ spin_lock_irq(&io_request_lock); /* * Note that handler() may have set things up for another * interrupt to occur soon, but it cannot happen until * we exit from this routine, because it will be the * same irq as is currently being serviced here, and Linux * won't allow another of the same (on any CPU) until we return. */ set_recovery_timer(HWIF(drive)); drive->service_time = jiffies - drive->service_start; if (startstop == ide_stopped) { if (hwgroup->handler == NULL) { /* paranoia */ hwgroup->busy = 0; ide_do_request(hwgroup, hwif->irq); } else { printk("%s: ide_intr: huh? expected NULL handler on exit\n", drive->name); } } spin_unlock_irqrestore(&io_request_lock, flags); } /* * get_info_ptr() returns the (ide_drive_t *) for a given device number. * It returns NULL if the given device number does not match any present drives. */ ide_drive_t *get_info_ptr (kdev_t i_rdev) { int major = MAJOR(i_rdev); #if 0 int minor = MINOR(i_rdev) & PARTN_MASK; #endif unsigned int h; for (h = 0; h < MAX_HWIFS; ++h) { ide_hwif_t *hwif = &ide_hwifs[h]; if (hwif->present && major == hwif->major) { unsigned unit = DEVICE_NR(i_rdev); if (unit < MAX_DRIVES) { ide_drive_t *drive = &hwif->drives[unit]; #if 0 if ((drive->present) && (drive->part[minor].nr_sects)) #else if (drive->present) #endif return drive; } break; } } return NULL; } /* * This function is intended to be used prior to invoking ide_do_drive_cmd(). */ void ide_init_drive_cmd (struct request *rq) { memset(rq, 0, sizeof(*rq)); rq->cmd = IDE_DRIVE_CMD; } /* * This function issues a special IDE device request * onto the request queue. * * If action is ide_wait, then the rq is queued at the end of the * request queue, and the function sleeps until it has been processed. * This is for use when invoked from an ioctl handler. * * If action is ide_preempt, then the rq is queued at the head of * the request queue, displacing the currently-being-processed * request and this function returns immediately without waiting * for the new rq to be completed. This is VERY DANGEROUS, and is * intended for careful use by the ATAPI tape/cdrom driver code. * * If action is ide_next, then the rq is queued immediately after * the currently-being-processed-request (if any), and the function * returns without waiting for the new rq to be completed. As above, * This is VERY DANGEROUS, and is intended for careful use by the * ATAPI tape/cdrom driver code. * * If action is ide_end, then the rq is queued at the end of the * request queue, and the function returns immediately without waiting * for the new rq to be completed. This is again intended for careful * use by the ATAPI tape/cdrom driver code. */ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t action) { unsigned long flags; ide_hwgroup_t *hwgroup = HWGROUP(drive); unsigned int major = HWIF(drive)->major; struct list_head *queue_head = &drive->queue.queue_head; DECLARE_COMPLETION(wait); #ifdef CONFIG_BLK_DEV_PDC4030 if (HWIF(drive)->chipset == ide_pdc4030 && rq->buffer != NULL) return -ENOSYS; /* special drive cmds not supported */ #endif rq->errors = 0; rq->rq_status = RQ_ACTIVE; rq->rq_dev = MKDEV(major,(drive->select.b.unit)<<PARTN_BITS); if (action == ide_wait) rq->waiting = &wait; spin_lock_irqsave(&io_request_lock, flags); if (list_empty(queue_head) || action == ide_preempt) { if (action == ide_preempt) hwgroup->rq = NULL; } else { if (action == ide_wait || action == ide_end) { queue_head = queue_head->prev; } else queue_head = queue_head->next; } list_add(&rq->queue, queue_head); ide_do_request(hwgroup, 0); spin_unlock_irqrestore(&io_request_lock, flags); if (action == ide_wait) { wait_for_completion(&wait); /* wait for it to be serviced */ return rq->errors ? -EIO : 0; /* return -EIO if errors */ } return 0; } /* * This routine is called to flush all partitions and partition tables * for a changed disk, and then re-read the new partition table. * If we are revalidating a disk because of a media change, then we * enter with usage == 0. If we are using an ioctl, we automatically have * usage == 1 (we need an open channel to use an ioctl :-), so this * is our limit. */ int ide_revalidate_disk (kdev_t i_rdev) { ide_drive_t *drive; ide_hwgroup_t *hwgroup; unsigned int p, major, minor; long flags; if ((drive = get_info_ptr(i_rdev)) == NULL) return -ENODEV; major = MAJOR(i_rdev); minor = drive->select.b.unit << PARTN_BITS; hwgroup = HWGROUP(drive); spin_lock_irqsave(&io_request_lock, flags); if (drive->busy || (drive->usage > 1)) { spin_unlock_irqrestore(&io_request_lock, flags); return -EBUSY; }; drive->busy = 1; MOD_INC_USE_COUNT; spin_unlock_irqrestore(&io_request_lock, flags); for (p = 0; p < (1<<PARTN_BITS); ++p) { if (drive->part[p].nr_sects > 0) { kdev_t devp = MKDEV(major, minor+p); invalidate_device(devp, 1); } drive->part[p].start_sect = 0; drive->part[p].nr_sects = 0; }; if (DRIVER(drive)->revalidate) DRIVER(drive)->revalidate(drive); drive->busy = 0; wake_up(&drive->wqueue); MOD_DEC_USE_COUNT; return 0; } static void revalidate_drives (void) { ide_hwif_t *hwif; ide_drive_t *drive; int index, unit; for (index = 0; index < MAX_HWIFS; ++index) { hwif = &ide_hwifs[index]; for (unit = 0; unit < MAX_DRIVES; ++unit) { drive = &ide_hwifs[index].drives[unit]; if (drive->revalidate) { drive->revalidate = 0; if (!initializing) (void) ide_revalidate_disk(MKDEV(hwif->major, unit<<PARTN_BITS)); } } } } static void ide_probe_module (void) { if (!ide_probe) { #if defined(CONFIG_KMOD) && defined(CONFIG_BLK_DEV_IDE_MODULE) (void) request_module("ide-probe-mod"); #endif /* (CONFIG_KMOD) && (CONFIG_BLK_DEV_IDE_MODULE) */ } else { (void) ide_probe->init(); } revalidate_drives(); } static void ide_driver_module (void) { int index; ide_module_t *module = ide_modules; for (index = 0; index < MAX_HWIFS; ++index) if (ide_hwifs[index].present) goto search; ide_probe_module(); search: while (module) { (void) module->init(); module = module->next; } revalidate_drives(); } static int ide_open (struct inode * inode, struct file * filp) { ide_drive_t *drive; if ((drive = get_info_ptr(inode->i_rdev)) == NULL) return -ENXIO; if (drive->driver == NULL) ide_driver_module(); #ifdef CONFIG_KMOD if (drive->driver == NULL) { if (drive->media == ide_disk) (void) request_module("ide-disk"); if (drive->media == ide_cdrom) (void) request_module("ide-cd"); if (drive->media == ide_tape) (void) request_module("ide-tape"); if (drive->media == ide_floppy) (void) request_module("ide-floppy"); } #endif /* CONFIG_KMOD */ while (drive->busy) sleep_on(&drive->wqueue); drive->usage++; if (drive->driver != NULL) return DRIVER(drive)->open(inode, filp, drive); printk ("%s: driver not present\n", drive->name); drive->usage--; return -ENXIO; } /* * Releasing a block device means we sync() it, so that it can safely * be forgotten about... */ static int ide_release (struct inode * inode, struct file * file) { ide_drive_t *drive; if ((drive = get_info_ptr(inode->i_rdev)) != NULL) { drive->usage--; if (drive->driver != NULL) DRIVER(drive)->release(inode, file, drive); } return 0; } int ide_replace_subdriver (ide_drive_t *drive, const char *driver) { if (!drive->present || drive->busy || drive->usage) goto abort; if (drive->driver != NULL && DRIVER(drive)->cleanup(drive)) goto abort; strncpy(drive->driver_req, driver, 9); ide_driver_module(); drive->driver_req[0] = 0; ide_driver_module(); if (DRIVER(drive) && !strcmp(DRIVER(drive)->name, driver)) return 0; abort: return 1; } #ifdef CONFIG_PROC_FS ide_proc_entry_t generic_subdriver_entries[] = { { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL }, { NULL, 0, NULL, NULL } }; #endif /* * Note that we only release the standard ports, * and do not even try to handle any extra ports * allocated for weird IDE interface chipsets. */ void hwif_unregister (ide_hwif_t *hwif) { if (hwif->straight8) { ide_release_region(hwif->io_ports[IDE_DATA_OFFSET], 8); goto jump_eight; } if (hwif->io_ports[IDE_DATA_OFFSET]) ide_release_region(hwif->io_ports[IDE_DATA_OFFSET], 1); if (hwif->io_ports[IDE_ERROR_OFFSET]) ide_release_region(hwif->io_ports[IDE_ERROR_OFFSET], 1); if (hwif->io_ports[IDE_NSECTOR_OFFSET]) ide_release_region(hwif->io_ports[IDE_NSECTOR_OFFSET], 1); if (hwif->io_ports[IDE_SECTOR_OFFSET]) ide_release_region(hwif->io_ports[IDE_SECTOR_OFFSET], 1); if (hwif->io_ports[IDE_LCYL_OFFSET]) ide_release_region(hwif->io_ports[IDE_LCYL_OFFSET], 1); if (hwif->io_ports[IDE_HCYL_OFFSET]) ide_release_region(hwif->io_ports[IDE_HCYL_OFFSET], 1); if (hwif->io_ports[IDE_SELECT_OFFSET]) ide_release_region(hwif->io_ports[IDE_SELECT_OFFSET], 1); if (hwif->io_ports[IDE_STATUS_OFFSET]) ide_release_region(hwif->io_ports[IDE_STATUS_OFFSET], 1); jump_eight: if (hwif->io_ports[IDE_CONTROL_OFFSET]) ide_release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1); #if defined(CONFIG_AMIGA) || defined(CONFIG_MAC) if (hwif->io_ports[IDE_IRQ_OFFSET]) ide_release_region(hwif->io_ports[IDE_IRQ_OFFSET], 1); #endif /* (CONFIG_AMIGA) || (CONFIG_MAC) */ } void ide_unregister (unsigned int index) { struct gendisk *gd; ide_drive_t *drive, *d; ide_hwif_t *hwif, *g; ide_hwgroup_t *hwgroup; int irq_count = 0, unit, i; unsigned long flags; unsigned int p, minor; ide_hwif_t old_hwif; if (index >= MAX_HWIFS) return; save_flags(flags); /* all CPUs */ cli(); /* all CPUs */ hwif = &ide_hwifs[index]; if (!hwif->present) goto abort; for (unit = 0; unit < MAX_DRIVES; ++unit) { drive = &hwif->drives[unit]; if (!drive->present) continue; if (drive->busy || drive->usage) goto abort; if (drive->driver != NULL && DRIVER(drive)->cleanup(drive)) goto abort; } hwif->present = 0; /* * All clear? Then blow away the buffer cache */ sti(); for (unit = 0; unit < MAX_DRIVES; ++unit) { drive = &hwif->drives[unit]; if (!drive->present) continue; minor = drive->select.b.unit << PARTN_BITS; for (p = 0; p < (1<<PARTN_BITS); ++p) { if (drive->part[p].nr_sects > 0) { kdev_t devp = MKDEV(hwif->major, minor+p); invalidate_device(devp, 0); } } #ifdef CONFIG_PROC_FS destroy_proc_ide_drives(hwif); #endif } cli(); hwgroup = hwif->hwgroup; /* * free the irq if we were the only hwif using it */ g = hwgroup->hwif; do { if (g->irq == hwif->irq) ++irq_count; g = g->next; } while (g != hwgroup->hwif); if (irq_count == 1) free_irq(hwif->irq, hwgroup); /* * Note that we only release the standard ports, * and do not even try to handle any extra ports * allocated for weird IDE interface chipsets. */ hwif_unregister(hwif); /* * Remove us from the hwgroup, and free * the hwgroup if we were the only member */ d = hwgroup->drive; for (i = 0; i < MAX_DRIVES; ++i) { drive = &hwif->drives[i]; if (drive->de) { devfs_unregister (drive->de); drive->de = NULL; } if (!drive->present) continue; while (hwgroup->drive->next != drive) hwgroup->drive = hwgroup->drive->next; hwgroup->drive->next = drive->next; if (hwgroup->drive == drive) hwgroup->drive = NULL; if (drive->id != NULL) { kfree(drive->id); drive->id = NULL; } drive->present = 0; blk_cleanup_queue(&drive->queue); } if (d->present) hwgroup->drive = d; while (hwgroup->hwif->next != hwif) hwgroup->hwif = hwgroup->hwif->next; hwgroup->hwif->next = hwif->next; if (hwgroup->hwif == hwif) kfree(hwgroup); else hwgroup->hwif = HWIF(hwgroup->drive); #if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI) if (hwif->dma_base) { (void) ide_release_dma(hwif); hwif->dma_base = 0; } #endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */ /* * Remove us from the kernel's knowledge */ unregister_blkdev(hwif->major, hwif->name); kfree(blksize_size[hwif->major]); kfree(max_sectors[hwif->major]); kfree(max_readahead[hwif->major]); blk_dev[hwif->major].data = NULL; blk_dev[hwif->major].queue = NULL; blksize_size[hwif->major] = NULL; gd = hwif->gd; if (gd) { del_gendisk(gd); kfree(gd->sizes); kfree(gd->part); if (gd->de_arr) kfree (gd->de_arr); if (gd->flags) kfree (gd->flags); kfree(gd); hwif->gd = NULL; } old_hwif = *hwif; init_hwif_data (index); /* restore hwif data to pristine status */ hwif->hwgroup = old_hwif.hwgroup; hwif->tuneproc = old_hwif.tuneproc; hwif->speedproc = old_hwif.speedproc; hwif->selectproc = old_hwif.selectproc; hwif->resetproc = old_hwif.resetproc; hwif->intrproc = old_hwif.intrproc; hwif->maskproc = old_hwif.maskproc; hwif->quirkproc = old_hwif.quirkproc; hwif->rwproc = old_hwif.rwproc; hwif->ideproc = old_hwif.ideproc; hwif->dmaproc = old_hwif.dmaproc; hwif->busproc = old_hwif.busproc; hwif->bus_state = old_hwif.bus_state; hwif->dma_base = old_hwif.dma_base; hwif->dma_extra = old_hwif.dma_extra; hwif->config_data = old_hwif.config_data; hwif->select_data = old_hwif.select_data; hwif->proc = old_hwif.proc; #ifndef CONFIG_BLK_DEV_IDECS hwif->irq = old_hwif.irq; #endif /* CONFIG_BLK_DEV_IDECS */ hwif->major = old_hwif.major; hwif->chipset = old_hwif.chipset; hwif->autodma = old_hwif.autodma; hwif->udma_four = old_hwif.udma_four; #ifdef CONFIG_BLK_DEV_IDEPCI hwif->pci_dev = old_hwif.pci_dev; hwif->pci_devid = old_hwif.pci_devid; #endif /* CONFIG_BLK_DEV_IDEPCI */ hwif->straight8 = old_hwif.straight8; hwif->hwif_data = old_hwif.hwif_data; abort: restore_flags(flags); /* all CPUs */ } /* * Setup hw_regs_t structure described by parameters. You * may set up the hw structure yourself OR use this routine to * do it for you. */ void ide_setup_ports ( hw_regs_t *hw, ide_ioreg_t base, int *offsets, ide_ioreg_t ctrl, ide_ioreg_t intr, ide_ack_intr_t *ack_intr, int irq) { int i; for (i = 0; i < IDE_NR_PORTS; i++) { if (offsets[i] == -1) { switch(i) { case IDE_CONTROL_OFFSET: hw->io_ports[i] = ctrl; break; #if defined(CONFIG_AMIGA) || defined(CONFIG_MAC) case IDE_IRQ_OFFSET: hw->io_ports[i] = intr; break; #endif /* (CONFIG_AMIGA) || (CONFIG_MAC) */ default: hw->io_ports[i] = 0; break; } } else { hw->io_ports[i] = base + offsets[i]; } } hw->irq = irq; hw->dma = NO_DMA; hw->ack_intr = ack_intr; } /* * Register an IDE interface, specifing exactly the registers etc * Set init=1 iff calling before probes have taken place. */ int ide_register_hw (hw_regs_t *hw, ide_hwif_t **hwifp) { int index, retry = 1; ide_hwif_t *hwif; do { for (index = 0; index < MAX_HWIFS; ++index) { hwif = &ide_hwifs[index]; if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) goto found; } for (index = 0; index < MAX_HWIFS; ++index) { hwif = &ide_hwifs[index]; if ((!hwif->present && !hwif->mate && !initializing) || (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) goto found; } for (index = 0; index < MAX_HWIFS; index++) ide_unregister(index); } while (retry--); return -1; found: if (hwif->present) ide_unregister(index); if (hwif->present) return -1; memcpy(&hwif->hw, hw, sizeof(*hw)); memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); hwif->irq = hw->irq; hwif->noprobe = 0; if (!initializing) { ide_probe_module(); #ifdef CONFIG_PROC_FS create_proc_ide_interfaces(); #endif ide_driver_module(); } if (hwifp) *hwifp = hwif; return (initializing || hwif->present) ? index : -1; } /* * Compatability function with existing drivers. If you want * something different, use the function above. */ int ide_register (int arg1, int arg2, int irq) { hw_regs_t hw; ide_init_hwif_ports(&hw, (ide_ioreg_t) arg1, (ide_ioreg_t) arg2, NULL); hw.irq = irq; return ide_register_hw(&hw, NULL); } void ide_add_setting (ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set) { ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting = NULL; while ((*p) && strcmp((*p)->name, name) < 0) p = &((*p)->next); if ((setting = kmalloc(sizeof(*setting), GFP_KERNEL)) == NULL) goto abort; memset(setting, 0, sizeof(*setting)); if ((setting->name = kmalloc(strlen(name) + 1, GFP_KERNEL)) == NULL) goto abort; strcpy(setting->name, name); setting->rw = rw; setting->read_ioctl = read_ioctl; setting->write_ioctl = write_ioctl; setting->data_type = data_type; setting->min = min; setting->max = max; setting->mul_factor = mul_factor; setting->div_factor = div_factor; setting->data = data; setting->set = set; setting->next = *p; if (drive->driver) setting->auto_remove = 1; *p = setting; return; abort: if (setting) kfree(setting); } void ide_remove_setting (ide_drive_t *drive, char *name) { ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting; while ((*p) && strcmp((*p)->name, name)) p = &((*p)->next); if ((setting = (*p)) == NULL) return; (*p) = setting->next; kfree(setting->name); kfree(setting); } static ide_settings_t *ide_find_setting_by_ioctl (ide_drive_t *drive, int cmd) { ide_settings_t *setting = drive->settings; while (setting) { if (setting->read_ioctl == cmd || setting->write_ioctl == cmd) break; setting = setting->next; } return setting; } ide_settings_t *ide_find_setting_by_name (ide_drive_t *drive, char *name) { ide_settings_t *setting = drive->settings; while (setting) { if (strcmp(setting->name, name) == 0) break; setting = setting->next; } return setting; } static void auto_remove_settings (ide_drive_t *drive) { ide_settings_t *setting; repeat: setting = drive->settings; while (setting) { if (setting->auto_remove) { ide_remove_setting(drive, setting->name); goto repeat; } setting = setting->next; } } int ide_read_setting (ide_drive_t *drive, ide_settings_t *setting) { int val = -EINVAL; unsigned long flags; if ((setting->rw & SETTING_READ)) { spin_lock_irqsave(&io_request_lock, flags); switch(setting->data_type) { case TYPE_BYTE: val = *((u8 *) setting->data); break; case TYPE_SHORT: val = *((u16 *) setting->data); break; case TYPE_INT: case TYPE_INTA: val = *((u32 *) setting->data); break; } spin_unlock_irqrestore(&io_request_lock, flags); } return val; } int ide_spin_wait_hwgroup (ide_drive_t *drive) { ide_hwgroup_t *hwgroup = HWGROUP(drive); unsigned long timeout = jiffies + (3 * HZ); spin_lock_irq(&io_request_lock); while (hwgroup->busy) { unsigned long lflags; spin_unlock_irq(&io_request_lock); __save_flags(lflags); /* local CPU only */ __sti(); /* local CPU only; needed for jiffies */ if (0 < (signed long)(jiffies - timeout)) { __restore_flags(lflags); /* local CPU only */ printk("%s: channel busy\n", drive->name); return -EBUSY; } __restore_flags(lflags); /* local CPU only */ spin_lock_irq(&io_request_lock); } return 0; } /* * FIXME: This should be changed to enqueue a special request * to the driver to change settings, and then wait on a sema for completion. * The current scheme of polling is kludgey, though safe enough. */ int ide_write_setting (ide_drive_t *drive, ide_settings_t *setting, int val) { int i; u32 *p; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!(setting->rw & SETTING_WRITE)) return -EPERM; if (val < setting->min || val > setting->max) return -EINVAL; if (setting->set) return setting->set(drive, val); if (ide_spin_wait_hwgroup(drive)) return -EBUSY; switch (setting->data_type) { case TYPE_BYTE: *((u8 *) setting->data) = val; break; case TYPE_SHORT: *((u16 *) setting->data) = val; break; case TYPE_INT: *((u32 *) setting->data) = val; break; case TYPE_INTA: p = (u32 *) setting->data; for (i = 0; i < 1 << PARTN_BITS; i++, p++) *p = val; break; } spin_unlock_irq(&io_request_lock); return 0; } static int set_io_32bit(ide_drive_t *drive, int arg) { drive->io_32bit = arg; #ifdef CONFIG_BLK_DEV_DTC2278 if (HWIF(drive)->chipset == ide_dtc2278) HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg; #endif /* CONFIG_BLK_DEV_DTC2278 */ return 0; } static int set_using_dma (ide_drive_t *drive, int arg) { if (!drive->driver || !DRIVER(drive)->supports_dma) return -EPERM; if (!drive->id || !(drive->id->capability & 1) || !HWIF(drive)->dmaproc) return -EPERM; if (HWIF(drive)->dmaproc(arg ? ide_dma_on : ide_dma_off, drive)) return -EIO; return 0; } static int set_pio_mode (ide_drive_t *drive, int arg) { struct request rq; if (!HWIF(drive)->tuneproc) return -ENOSYS; if (drive->special.b.set_tune) return -EBUSY; ide_init_drive_cmd(&rq); drive->tune_req = (byte) arg; drive->special.b.set_tune = 1; (void) ide_do_drive_cmd (drive, &rq, ide_wait); return 0; } void ide_add_generic_settings (ide_drive_t *drive) { /* * drive setting name read/write access read ioctl write ioctl data type min max mul_factor div_factor data pointer set function */ ide_add_setting(drive, "io_32bit", drive->no_io_32bit ? SETTING_READ : SETTING_RW, HDIO_GET_32BIT, HDIO_SET_32BIT, TYPE_BYTE, 0, 1 + (SUPPORT_VLB_SYNC << 1), 1, 1, &drive->io_32bit, set_io_32bit); ide_add_setting(drive, "keepsettings", SETTING_RW, HDIO_GET_KEEPSETTINGS, HDIO_SET_KEEPSETTINGS, TYPE_BYTE, 0, 1, 1, 1, &drive->keep_settings, NULL); ide_add_setting(drive, "nice1", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->nice1, NULL); ide_add_setting(drive, "pio_mode", SETTING_WRITE, -1, HDIO_SET_PIO_MODE, TYPE_BYTE, 0, 255, 1, 1, NULL, set_pio_mode); ide_add_setting(drive, "slow", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->slow, NULL); ide_add_setting(drive, "unmaskirq", drive->no_unmask ? SETTING_READ : SETTING_RW, HDIO_GET_UNMASKINTR, HDIO_SET_UNMASKINTR, TYPE_BYTE, 0, 1, 1, 1, &drive->unmask, NULL); ide_add_setting(drive, "using_dma", SETTING_RW, HDIO_GET_DMA, HDIO_SET_DMA, TYPE_BYTE, 0, 1, 1, 1, &drive->using_dma, set_using_dma); ide_add_setting(drive, "ide_scsi", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->scsi, NULL); ide_add_setting(drive, "init_speed", SETTING_RW, -1, -1, TYPE_BYTE, 0, 69, 1, 1, &drive->init_speed, NULL); ide_add_setting(drive, "current_speed", SETTING_RW, -1, -1, TYPE_BYTE, 0, 69, 1, 1, &drive->current_speed, NULL); ide_add_setting(drive, "number", SETTING_RW, -1, -1, TYPE_BYTE, 0, 3, 1, 1, &drive->dn, NULL); } int ide_wait_cmd (ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *buf) { struct request rq; byte buffer[4]; if (!buf) buf = buffer; memset(buf, 0, 4 + SECTOR_WORDS * 4 * sectors); ide_init_drive_cmd(&rq); rq.buffer = buf; *buf++ = cmd; *buf++ = nsect; *buf++ = feature; *buf++ = sectors; return ide_do_drive_cmd(drive, &rq, ide_wait); } int ide_wait_cmd_task (ide_drive_t *drive, byte *buf) { struct request rq; ide_init_drive_cmd(&rq); rq.cmd = IDE_DRIVE_TASK; rq.buffer = buf; return ide_do_drive_cmd(drive, &rq, ide_wait); } /* * Delay for *at least* 50ms. As we don't know how much time is left * until the next tick occurs, we wait an extra tick to be safe. * This is used only during the probing/polling for drives at boot time. * * However, its usefullness may be needed in other places, thus we export it now. * The future may change this to a millisecond setable delay. */ void ide_delay_50ms (void) { #ifndef CONFIG_BLK_DEV_IDECS mdelay(50); #else __set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ/20); #endif /* CONFIG_BLK_DEV_IDECS */ } int system_bus_clock (void) { return((int) ((!system_bus_speed) ? ide_system_bus_speed() : system_bus_speed )); } static int ide_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int err = 0, major, minor; ide_drive_t *drive; struct request rq; kdev_t dev; ide_settings_t *setting; if (!inode || !(dev = inode->i_rdev)) return -EINVAL; major = MAJOR(dev); minor = MINOR(dev); if ((drive = get_info_ptr(inode->i_rdev)) == NULL) return -ENODEV; if ((setting = ide_find_setting_by_ioctl(drive, cmd)) != NULL) { if (cmd == setting->read_ioctl) { err = ide_read_setting(drive, setting); return err >= 0 ? put_user(err, (long *) arg) : err; } else { if ((MINOR(inode->i_rdev) & PARTN_MASK)) return -EINVAL; return ide_write_setting(drive, setting, arg); } } ide_init_drive_cmd (&rq); switch (cmd) { case HDIO_GETGEO: { struct hd_geometry *loc = (struct hd_geometry *) arg; unsigned short bios_cyl = drive->bios_cyl; /* truncate */ if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL; if (put_user(drive->bios_head, (byte *) &loc->heads)) return -EFAULT; if (put_user(drive->bios_sect, (byte *) &loc->sectors)) return -EFAULT; if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT; if (put_user((unsigned)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect, (unsigned long *) &loc->start)) return -EFAULT; return 0; } case HDIO_GETGEO_BIG: { struct hd_big_geometry *loc = (struct hd_big_geometry *) arg; if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL; if (put_user(drive->bios_head, (byte *) &loc->heads)) return -EFAULT; if (put_user(drive->bios_sect, (byte *) &loc->sectors)) return -EFAULT; if (put_user(drive->bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT; if (put_user((unsigned)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect, (unsigned long *) &loc->start)) return -EFAULT; return 0; } case HDIO_GETGEO_BIG_RAW: { struct hd_big_geometry *loc = (struct hd_big_geometry *) arg; if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL; if (put_user(drive->head, (byte *) &loc->heads)) return -EFAULT; if (put_user(drive->sect, (byte *) &loc->sectors)) return -EFAULT; if (put_user(drive->cyl, (unsigned int *) &loc->cylinders)) return -EFAULT; if (put_user((unsigned)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect, (unsigned long *) &loc->start)) return -EFAULT; return 0; } case BLKGETSIZE: /* Return device size */ return put_user(drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects, (unsigned long *) arg); case BLKGETSIZE64: return put_user((u64)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects << 9, (u64 *) arg); case BLKRRPART: /* Re-read partition tables */ if (!capable(CAP_SYS_ADMIN)) return -EACCES; return ide_revalidate_disk(inode->i_rdev); case HDIO_OBSOLETE_IDENTITY: case HDIO_GET_IDENTITY: if (MINOR(inode->i_rdev) & PARTN_MASK) return -EINVAL; if (drive->id == NULL) return -ENOMSG; if (copy_to_user((char *)arg, (char *)drive->id, (cmd == HDIO_GET_IDENTITY) ? sizeof(*drive->id) : 142)) return -EFAULT; return 0; case HDIO_GET_NICE: return put_user(drive->dsc_overlap << IDE_NICE_DSC_OVERLAP | drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP | drive->nice0 << IDE_NICE_0 | drive->nice1 << IDE_NICE_1 | drive->nice2 << IDE_NICE_2, (long *) arg); case HDIO_DRIVE_CMD: { byte args[4], *argbuf = args; byte xfer_rate = 0; int argsize = 4; if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) return -EACCES; if (NULL == (void *) arg) return ide_do_drive_cmd(drive, &rq, ide_wait); if (copy_from_user(args, (void *)arg, 4)) return -EFAULT; if (args[3]) { argsize = 4 + (SECTOR_WORDS * 4 * args[3]); argbuf = kmalloc(argsize, GFP_KERNEL); if (argbuf == NULL) return -ENOMEM; memcpy(argbuf, args, 4); } if (set_transfer(drive, args[0], args[1], args[2])) { xfer_rate = args[1]; if (ide_ata66_check(drive, args[0], args[1], args[2])) goto abort; } err = ide_wait_cmd(drive, args[0], args[1], args[2], args[3], argbuf); if (!err && xfer_rate) { /* active-retuning-calls future */ if ((HWIF(drive)->speedproc) != NULL) HWIF(drive)->speedproc(drive, xfer_rate); ide_driveid_update(drive); } abort: if (copy_to_user((void *)arg, argbuf, argsize)) err = -EFAULT; if (argsize > 4) kfree(argbuf); return err; } case HDIO_DRIVE_TASK: { byte args[7], *argbuf = args; int argsize = 7; if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) return -EACCES; if (copy_from_user(args, (void *)arg, 7)) return -EFAULT; err = ide_wait_cmd_task(drive, argbuf); if (copy_to_user((void *)arg, argbuf, argsize)) err = -EFAULT; return err; } case HDIO_SCAN_HWIF: { int args[3]; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (copy_from_user(args, (void *)arg, 3 * sizeof(int))) return -EFAULT; if (ide_register(args[0], args[1], args[2]) == -1) return -EIO; return 0; } case HDIO_UNREGISTER_HWIF: if (!capable(CAP_SYS_ADMIN)) return -EACCES; /* (arg > MAX_HWIFS) checked in function */ ide_unregister(arg); return 0; case HDIO_SET_NICE: if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (drive->driver == NULL) return -EPERM; if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP) | (1 << IDE_NICE_1)))) return -EPERM; drive->dsc_overlap = (arg >> IDE_NICE_DSC_OVERLAP) & 1; if (drive->dsc_overlap && !DRIVER(drive)->supports_dsc_overlap) { drive->dsc_overlap = 0; return -EPERM; } drive->nice1 = (arg >> IDE_NICE_1) & 1; return 0; case HDIO_DRIVE_RESET: if (!capable(CAP_SYS_ADMIN)) return -EACCES; (void) ide_do_reset(drive); if (drive->suspend_reset) { /* * APM WAKE UP todo !! * int nogoodpower = 1; * while(nogoodpower) { * check_power1() or check_power2() * nogoodpower = 0; * } * HWIF(drive)->multiproc(drive); */ return ide_revalidate_disk(inode->i_rdev); } return 0; case BLKROSET: case BLKROGET: case BLKFLSBUF: case BLKSSZGET: case BLKPG: case BLKELVGET: case BLKELVSET: case BLKBSZGET: case BLKBSZSET: return blk_ioctl(inode->i_rdev, cmd, arg); case HDIO_GET_BUSSTATE: if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (put_user(HWIF(drive)->bus_state, (long *)arg)) return -EFAULT; return 0; case HDIO_SET_BUSSTATE: if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (HWIF(drive)->busproc) HWIF(drive)->busproc(HWIF(drive), arg); return 0; default: if (drive->driver != NULL) return DRIVER(drive)->ioctl(drive, inode, file, cmd, arg); return -EPERM; } } static int ide_check_media_change (kdev_t i_rdev) { ide_drive_t *drive; if ((drive = get_info_ptr(i_rdev)) == NULL) return -ENODEV; if (drive->driver != NULL) return DRIVER(drive)->media_change(drive); return 0; } void ide_fixstring (byte *s, const int bytecount, const int byteswap) { byte *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */ if (byteswap) { /* convert from big-endian to host byte order */ for (p = end ; p != s;) { unsigned short *pp = (unsigned short *) (p -= 2); *pp = ntohs(*pp); } } /* strip leading blanks */ while (s != end && *s == ' ') ++s; /* compress internal blanks and strip trailing blanks */ while (s != end && *s) { if (*s++ != ' ' || (s != end && *s && *s != ' ')) *p++ = *(s-1); } /* wipe out trailing garbage */ while (p != end) *p++ = '\0'; } /* * stridx() returns the offset of c within s, * or -1 if c is '\0' or not found within s. */ static int __init stridx (const char *s, char c) { char *i = strchr(s, c); return (i && c) ? i - s : -1; } /* * match_parm() does parsing for ide_setup(): * * 1. the first char of s must be '='. * 2. if the remainder matches one of the supplied keywords, * the index (1 based) of the keyword is negated and returned. * 3. if the remainder is a series of no more than max_vals numbers * separated by commas, the numbers are saved in vals[] and a * count of how many were saved is returned. Base10 is assumed, * and base16 is allowed when prefixed with "0x". * 4. otherwise, zero is returned. */ static int __init match_parm (char *s, const char *keywords[], int vals[], int max_vals) { static const char *decimal = "0123456789"; static const char *hex = "0123456789abcdef"; int i, n; if (*s++ == '=') { /* * Try matching against the supplied keywords, * and return -(index+1) if we match one */ if (keywords != NULL) { for (i = 0; *keywords != NULL; ++i) { if (!strcmp(s, *keywords++)) return -(i+1); } } /* * Look for a series of no more than "max_vals" * numeric values separated by commas, in base10, * or base16 when prefixed with "0x". * Return a count of how many were found. */ for (n = 0; (i = stridx(decimal, *s)) >= 0;) { vals[n] = i; while ((i = stridx(decimal, *++s)) >= 0) vals[n] = (vals[n] * 10) + i; if (*s == 'x' && !vals[n]) { while ((i = stridx(hex, *++s)) >= 0) vals[n] = (vals[n] * 0x10) + i; } if (++n == max_vals) break; if (*s == ',' || *s == ';') ++s; } if (!*s) return n; } return 0; /* zero = nothing matched */ } /* * ide_setup() gets called VERY EARLY during initialization, * to handle kernel "command line" strings beginning with "hdx=" * or "ide". Here is the complete set currently supported: * * "hdx=" is recognized for all "x" from "a" to "h", such as "hdc". * "idex=" is recognized for all "x" from "0" to "3", such as "ide1". * * "hdx=noprobe" : drive may be present, but do not probe for it * "hdx=none" : drive is NOT present, ignore cmos and do not probe * "hdx=nowerr" : ignore the WRERR_STAT bit on this drive * "hdx=cdrom" : drive is present, and is a cdrom drive * "hdx=cyl,head,sect" : disk drive is present, with specified geometry * "hdx=noremap" : do not remap 0->1 even though EZD was detected * "hdx=autotune" : driver will attempt to tune interface speed * to the fastest PIO mode supported, * if possible for this drive only. * Not fully supported by all chipset types, * and quite likely to cause trouble with * older/odd IDE drives. * * "hdx=slow" : insert a huge pause after each access to the data * port. Should be used only as a last resort. * * "hdx=swapdata" : when the drive is a disk, byte swap all data * "hdx=bswap" : same as above.......... * "hdxlun=xx" : set the drive last logical unit. * "hdx=flash" : allows for more than one ata_flash disk to be * registered. In most cases, only one device * will be present. * "hdx=scsi" : the return of the ide-scsi flag, this is useful for * allowwing ide-floppy, ide-tape, and ide-cdrom|writers * to use ide-scsi emulation on a device specific option. * "idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz, * where "xx" is between 20 and 66 inclusive, * used when tuning chipset PIO modes. * For PCI bus, 25 is correct for a P75 system, * 30 is correct for P90,P120,P180 systems, * and 33 is used for P100,P133,P166 systems. * If in doubt, use idebus=33 for PCI. * As for VLB, it is safest to not specify it. * * "idex=noprobe" : do not attempt to access/use this interface * "idex=base" : probe for an interface at the addr specified, * where "base" is usually 0x1f0 or 0x170 * and "ctl" is assumed to be "base"+0x206 * "idex=base,ctl" : specify both base and ctl * "idex=base,ctl,irq" : specify base, ctl, and irq number * "idex=autotune" : driver will attempt to tune interface speed * to the fastest PIO mode supported, * for all drives on this interface. * Not fully supported by all chipset types, * and quite likely to cause trouble with * older/odd IDE drives. * "idex=noautotune" : driver will NOT attempt to tune interface speed * This is the default for most chipsets, * except the cmd640. * "idex=serialize" : do not overlap operations on idex and ide(x^1) * "idex=four" : four drives on idex and ide(x^1) share same ports * "idex=reset" : reset interface before first use * "idex=dma" : enable DMA by default on both drives if possible * "idex=ata66" : informs the interface that it has an 80c cable * for chipsets that are ATA-66 capable, but * the ablity to bit test for detection is * currently unknown. * "ide=reverse" : Formerly called to pci sub-system, but now local. * * The following are valid ONLY on ide0, (except dc4030) * and the defaults for the base,ctl ports must not be altered. * * "ide0=dtc2278" : probe/support DTC2278 interface * "ide0=ht6560b" : probe/support HT6560B interface * "ide0=cmd640_vlb" : *REQUIRED* for VLB cards with the CMD640 chip * (not for PCI -- automatically detected) * "ide0=qd65xx" : probe/support qd65xx interface * "ide0=ali14xx" : probe/support ali14xx chipsets (ALI M1439, M1443, M1445) * "ide0=umc8672" : probe/support umc8672 chipsets * "idex=dc4030" : probe/support Promise DC4030VL interface * "ide=doubler" : probe/support IDE doublers on Amiga */ int __init ide_setup (char *s) { int i, vals[3]; ide_hwif_t *hwif; ide_drive_t *drive; unsigned int hw, unit; const char max_drive = 'a' + ((MAX_HWIFS * MAX_DRIVES) - 1); const char max_hwif = '0' + (MAX_HWIFS - 1); if (strncmp(s,"hd",2) == 0 && s[2] == '=') /* hd= is for hd.c */ return 0; /* driver and not us */ if (strncmp(s,"ide",3) && strncmp(s,"idebus",6) && strncmp(s,"hd",2)) /* hdx= & hdxlun= */ return 0; printk("ide_setup: %s", s); init_ide_data (); #ifdef CONFIG_BLK_DEV_IDEDOUBLER if (!strcmp(s, "ide=doubler")) { extern int ide_doubler; printk(" : Enabled support for IDE doublers\n"); ide_doubler = 1; return 1; } #endif /* CONFIG_BLK_DEV_IDEDOUBLER */ if (!strcmp(s, "ide=nodma")) { printk("IDE: Prevented DMA\n"); noautodma = 1; return 1; } #ifdef CONFIG_BLK_DEV_IDEPCI if (!strcmp(s, "ide=reverse")) { ide_scan_direction = 1; printk(" : Enabled support for IDE inverse scan order.\n"); return 1; } #endif /* CONFIG_BLK_DEV_IDEPCI */ /* * Look for drive options: "hdx=" */ if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) { const char *hd_words[] = {"none", "noprobe", "nowerr", "cdrom", "serialize", "autotune", "noautotune", "slow", "swapdata", "bswap", "flash", "remap", "noremap", "scsi", NULL}; unit = s[2] - 'a'; hw = unit / MAX_DRIVES; unit = unit % MAX_DRIVES; hwif = &ide_hwifs[hw]; drive = &hwif->drives[unit]; if (strncmp(s + 4, "ide-", 4) == 0) { strncpy(drive->driver_req, s + 4, 9); goto done; } /* * Look for last lun option: "hdxlun=" */ if (s[3] == 'l' && s[4] == 'u' && s[5] == 'n') { if (match_parm(&s[6], NULL, vals, 1) != 1) goto bad_option; if (vals[0] >= 0 && vals[0] <= 7) { drive->last_lun = vals[0]; drive->forced_lun = 1; } else printk(" -- BAD LAST LUN! Expected value from 0 to 7"); goto done; } switch (match_parm(&s[3], hd_words, vals, 3)) { case -1: /* "none" */ drive->nobios = 1; /* drop into "noprobe" */ case -2: /* "noprobe" */ drive->noprobe = 1; goto done; case -3: /* "nowerr" */ drive->bad_wstat = BAD_R_STAT; hwif->noprobe = 0; goto done; case -4: /* "cdrom" */ drive->present = 1; drive->media = ide_cdrom; hwif->noprobe = 0; goto done; case -5: /* "serialize" */ printk(" -- USE \"ide%d=serialize\" INSTEAD", hw); goto do_serialize; case -6: /* "autotune" */ drive->autotune = 1; goto done; case -7: /* "noautotune" */ drive->autotune = 2; goto done; case -8: /* "slow" */ drive->slow = 1; goto done; case -9: /* "swapdata" or "bswap" */ case -10: drive->bswap = 1; goto done; case -11: /* "flash" */ drive->ata_flash = 1; goto done; case -12: /* "remap" */ drive->remap_0_to_1 = 1; goto done; case -13: /* "noremap" */ drive->remap_0_to_1 = 2; goto done; case -14: /* "scsi" */ #if defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) drive->scsi = 1; goto done; #else drive->scsi = 0; goto bad_option; #endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */ case 3: /* cyl,head,sect */ drive->media = ide_disk; drive->cyl = drive->bios_cyl = vals[0]; drive->head = drive->bios_head = vals[1]; drive->sect = drive->bios_sect = vals[2]; drive->present = 1; drive->forced_geom = 1; hwif->noprobe = 0; goto done; default: goto bad_option; } } if (s[0] != 'i' || s[1] != 'd' || s[2] != 'e') goto bad_option; /* * Look for bus speed option: "idebus=" */ if (s[3] == 'b' && s[4] == 'u' && s[5] == 's') { if (match_parm(&s[6], NULL, vals, 1) != 1) goto bad_option; if (vals[0] >= 20 && vals[0] <= 66) { idebus_parameter = vals[0]; } else printk(" -- BAD BUS SPEED! Expected value from 20 to 66"); goto done; } /* * Look for interface options: "idex=" */ if (s[3] >= '0' && s[3] <= max_hwif) { /* * Be VERY CAREFUL changing this: note hardcoded indexes below * -8,-9,-10 : are reserved for future idex calls to ease the hardcoding. */ const char *ide_words[] = { "noprobe", "serialize", "autotune", "noautotune", "reset", "dma", "ata66", "minus8", "minus9", "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", "dtc2278", "umc8672", "ali14xx", "dc4030", NULL }; hw = s[3] - '0'; hwif = &ide_hwifs[hw]; i = match_parm(&s[4], ide_words, vals, 3); /* * Cryptic check to ensure chipset not already set for hwif: */ if (i > 0 || i <= -11) { /* is parameter a chipset name? */ if (hwif->chipset != ide_unknown) goto bad_option; /* chipset already specified */ if (i <= -11 && i != -18 && hw != 0) goto bad_hwif; /* chipset drivers are for "ide0=" only */ if (i <= -11 && i != -18 && ide_hwifs[hw+1].chipset != ide_unknown) goto bad_option; /* chipset for 2nd port already specified */ printk("\n"); } switch (i) { #ifdef CONFIG_BLK_DEV_PDC4030 case -18: /* "dc4030" */ { extern void init_pdc4030(void); init_pdc4030(); goto done; } #endif /* CONFIG_BLK_DEV_PDC4030 */ #ifdef CONFIG_BLK_DEV_ALI14XX case -17: /* "ali14xx" */ { extern void init_ali14xx (void); init_ali14xx(); goto done; } #endif /* CONFIG_BLK_DEV_ALI14XX */ #ifdef CONFIG_BLK_DEV_UMC8672 case -16: /* "umc8672" */ { extern void init_umc8672 (void); init_umc8672(); goto done; } #endif /* CONFIG_BLK_DEV_UMC8672 */ #ifdef CONFIG_BLK_DEV_DTC2278 case -15: /* "dtc2278" */ { extern void init_dtc2278 (void); init_dtc2278(); goto done; } #endif /* CONFIG_BLK_DEV_DTC2278 */ #ifdef CONFIG_BLK_DEV_CMD640 case -14: /* "cmd640_vlb" */ { extern int cmd640_vlb; /* flag for cmd640.c */ cmd640_vlb = 1; goto done; } #endif /* CONFIG_BLK_DEV_CMD640 */ #ifdef CONFIG_BLK_DEV_HT6560B case -13: /* "ht6560b" */ { extern void init_ht6560b (void); init_ht6560b(); goto done; } #endif /* CONFIG_BLK_DEV_HT6560B */ #if CONFIG_BLK_DEV_QD65XX case -12: /* "qd65xx" */ { extern void init_qd65xx (void); init_qd65xx(); goto done; } #endif /* CONFIG_BLK_DEV_QD65XX */ #ifdef CONFIG_BLK_DEV_4DRIVES case -11: /* "four" drives on one set of ports */ { ide_hwif_t *mate = &ide_hwifs[hw^1]; mate->drives[0].select.all ^= 0x20; mate->drives[1].select.all ^= 0x20; hwif->chipset = mate->chipset = ide_4drives; mate->irq = hwif->irq; memcpy(mate->io_ports, hwif->io_ports, sizeof(hwif->io_ports)); goto do_serialize; } #endif /* CONFIG_BLK_DEV_4DRIVES */ case -10: /* minus10 */ case -9: /* minus9 */ case -8: /* minus8 */ goto bad_option; case -7: /* ata66 */ #ifdef CONFIG_BLK_DEV_IDEPCI hwif->udma_four = 1; goto done; #else /* !CONFIG_BLK_DEV_IDEPCI */ hwif->udma_four = 0; goto bad_hwif; #endif /* CONFIG_BLK_DEV_IDEPCI */ case -6: /* dma */ hwif->autodma = 1; goto done; case -5: /* "reset" */ hwif->reset = 1; goto done; case -4: /* "noautotune" */ hwif->drives[0].autotune = 2; hwif->drives[1].autotune = 2; goto done; case -3: /* "autotune" */ hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; goto done; case -2: /* "serialize" */ do_serialize: hwif->mate = &ide_hwifs[hw^1]; hwif->mate->mate = hwif; hwif->serialized = hwif->mate->serialized = 1; goto done; case -1: /* "noprobe" */ hwif->noprobe = 1; goto done; case 1: /* base */ vals[1] = vals[0] + 0x206; /* default ctl */ case 2: /* base,ctl */ vals[2] = 0; /* default irq = probe for it */ case 3: /* base,ctl,irq */ hwif->hw.irq = vals[2]; ide_init_hwif_ports(&hwif->hw, (ide_ioreg_t) vals[0], (ide_ioreg_t) vals[1], &hwif->irq); memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->irq = vals[2]; hwif->noprobe = 0; hwif->chipset = ide_generic; goto done; case 0: goto bad_option; default: printk(" -- SUPPORT NOT CONFIGURED IN THIS KERNEL\n"); return 1; } } bad_option: printk(" -- BAD OPTION\n"); return 1; bad_hwif: printk("-- NOT SUPPORTED ON ide%d", hw); done: printk("\n"); return 1; } /* * probe_for_hwifs() finds/initializes "known" IDE interfaces */ static void __init probe_for_hwifs (void) { #ifdef CONFIG_PCI if (pci_present()) { #ifdef CONFIG_BLK_DEV_IDEPCI ide_scan_pcibus(ide_scan_direction); #else #ifdef CONFIG_BLK_DEV_RZ1000 { extern void ide_probe_for_rz100x(void); ide_probe_for_rz100x(); } #endif /* CONFIG_BLK_DEV_RZ1000 */ #endif /* CONFIG_BLK_DEV_IDEPCI */ } #endif /* CONFIG_PCI */ #ifdef CONFIG_ETRAX_IDE { extern void init_e100_ide(void); init_e100_ide(); } #endif /* CONFIG_ETRAX_IDE */ #ifdef CONFIG_BLK_DEV_CMD640 { extern void ide_probe_for_cmd640x(void); ide_probe_for_cmd640x(); } #endif /* CONFIG_BLK_DEV_CMD640 */ #ifdef CONFIG_BLK_DEV_PDC4030 { extern int ide_probe_for_pdc4030(void); (void) ide_probe_for_pdc4030(); } #endif /* CONFIG_BLK_DEV_PDC4030 */ #ifdef CONFIG_BLK_DEV_IDE_PMAC { extern void pmac_ide_probe(void); pmac_ide_probe(); } #endif /* CONFIG_BLK_DEV_IDE_PMAC */ #ifdef CONFIG_BLK_DEV_IDE_ICSIDE { extern void icside_init(void); icside_init(); } #endif /* CONFIG_BLK_DEV_IDE_ICSIDE */ #ifdef CONFIG_BLK_DEV_IDE_RAPIDE { extern void rapide_init(void); rapide_init(); } #endif /* CONFIG_BLK_DEV_IDE_RAPIDE */ #ifdef CONFIG_BLK_DEV_GAYLE { extern void gayle_init(void); gayle_init(); } #endif /* CONFIG_BLK_DEV_GAYLE */ #ifdef CONFIG_BLK_DEV_FALCON_IDE { extern void falconide_init(void); falconide_init(); } #endif /* CONFIG_BLK_DEV_FALCON_IDE */ #ifdef CONFIG_BLK_DEV_MAC_IDE { extern void macide_init(void); macide_init(); } #endif /* CONFIG_BLK_DEV_MAC_IDE */ #ifdef CONFIG_BLK_DEV_Q40IDE { extern void q40ide_init(void); q40ide_init(); } #endif /* CONFIG_BLK_DEV_Q40IDE */ #ifdef CONFIG_BLK_DEV_BUDDHA { extern void buddha_init(void); buddha_init(); } #endif /* CONFIG_BLK_DEV_BUDDHA */ #if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP) { extern void pnpide_init(int enable); pnpide_init(1); } #endif /* CONFIG_BLK_DEV_ISAPNP */ } void __init ide_init_builtin_drivers (void) { /* * Probe for special PCI and other "known" interface chipsets */ probe_for_hwifs (); #ifdef CONFIG_BLK_DEV_IDE #if defined(__mc68000__) || defined(CONFIG_APUS) if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) { ide_get_lock(&ide_lock, NULL, NULL); /* for atari only */ disable_irq(ide_hwifs[0].irq); /* disable_irq_nosync ?? */ // disable_irq_nosync(ide_hwifs[0].irq); } #endif /* __mc68000__ || CONFIG_APUS */ (void) ideprobe_init(); #if defined(__mc68000__) || defined(CONFIG_APUS) if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) { enable_irq(ide_hwifs[0].irq); ide_release_lock(&ide_lock); /* for atari only */ } #endif /* __mc68000__ || CONFIG_APUS */ #endif /* CONFIG_BLK_DEV_IDE */ #ifdef CONFIG_PROC_FS proc_ide_create(); #endif /* * Attempt to match drivers for the available drives */ #ifdef CONFIG_BLK_DEV_IDEDISK (void) idedisk_init(); #endif /* CONFIG_BLK_DEV_IDEDISK */ #ifdef CONFIG_BLK_DEV_IDECD (void) ide_cdrom_init(); #endif /* CONFIG_BLK_DEV_IDECD */ #ifdef CONFIG_BLK_DEV_IDETAPE (void) idetape_init(); #endif /* CONFIG_BLK_DEV_IDETAPE */ #ifdef CONFIG_BLK_DEV_IDEFLOPPY (void) idefloppy_init(); #endif /* CONFIG_BLK_DEV_IDEFLOPPY */ #ifdef CONFIG_BLK_DEV_IDESCSI #ifdef CONFIG_SCSI (void) idescsi_init(); #else #warning ide scsi-emulation selected but no SCSI-subsystem in kernel #endif #endif /* CONFIG_BLK_DEV_IDESCSI */ } static int default_cleanup (ide_drive_t *drive) { return ide_unregister_subdriver(drive); } static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, unsigned long block) { ide_end_request(0, HWGROUP(drive)); return ide_stopped; } static void default_end_request (byte uptodate, ide_hwgroup_t *hwgroup) { ide_end_request(uptodate, hwgroup); } static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { return -EIO; } static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive) { drive->usage--; return -EIO; } static void default_release (struct inode *inode, struct file *filp, ide_drive_t *drive) { } static int default_check_media_change (ide_drive_t *drive) { return 1; } static void default_pre_reset (ide_drive_t *drive) { } static unsigned long default_capacity (ide_drive_t *drive) { return 0x7fffffff; } static ide_startstop_t default_special (ide_drive_t *drive) { special_t *s = &drive->special; s->all = 0; drive->mult_req = 0; return ide_stopped; } static int default_driver_reinit (ide_drive_t *drive) { printk(KERN_ERR "%s: does not support hotswap of device class !\n", drive->name); return 0; } static void setup_driver_defaults (ide_drive_t *drive) { ide_driver_t *d = drive->driver; if (d->cleanup == NULL) d->cleanup = default_cleanup; if (d->do_request == NULL) d->do_request = default_do_request; if (d->end_request == NULL) d->end_request = default_end_request; if (d->ioctl == NULL) d->ioctl = default_ioctl; if (d->open == NULL) d->open = default_open; if (d->release == NULL) d->release = default_release; if (d->media_change == NULL) d->media_change = default_check_media_change; if (d->pre_reset == NULL) d->pre_reset = default_pre_reset; if (d->capacity == NULL) d->capacity = default_capacity; if (d->special == NULL) d->special = default_special; if (d->driver_reinit == NULL) d->driver_reinit = default_driver_reinit; } ide_drive_t *ide_scan_devices (byte media, const char *name, ide_driver_t *driver, int n) { unsigned int unit, index, i; for (index = 0, i = 0; index < MAX_HWIFS; ++index) { ide_hwif_t *hwif = &ide_hwifs[index]; if (!hwif->present) continue; for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; char *req = drive->driver_req; if (*req && !strstr(name, req)) continue; if (drive->present && drive->media == media && drive->driver == driver && ++i > n) return drive; } } return NULL; } int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version) { unsigned long flags; save_flags(flags); /* all CPUs */ cli(); /* all CPUs */ if (version != IDE_SUBDRIVER_VERSION || !drive->present || drive->driver != NULL || drive->busy || drive->usage) { restore_flags(flags); /* all CPUs */ return 1; } drive->driver = driver; setup_driver_defaults(drive); restore_flags(flags); /* all CPUs */ if (drive->autotune != 2) { if (driver->supports_dma && HWIF(drive)->dmaproc != NULL) { /* * Force DMAing for the beginning of the check. * Some chipsets appear to do interesting things, * if not checked and cleared. * PARANOIA!!! */ (void) (HWIF(drive)->dmaproc(ide_dma_off_quietly, drive)); (void) (HWIF(drive)->dmaproc(ide_dma_check, drive)); } drive->dsc_overlap = (drive->next != drive && driver->supports_dsc_overlap); drive->nice1 = 1; } drive->revalidate = 1; drive->suspend_reset = 0; #ifdef CONFIG_PROC_FS ide_add_proc_entries(drive->proc, generic_subdriver_entries, drive); ide_add_proc_entries(drive->proc, driver->proc, drive); #endif return 0; } int ide_unregister_subdriver (ide_drive_t *drive) { unsigned long flags; save_flags(flags); /* all CPUs */ cli(); /* all CPUs */ if (drive->usage || drive->busy || drive->driver == NULL || DRIVER(drive)->busy) { restore_flags(flags); /* all CPUs */ return 1; } #if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP) && defined(MODULE) pnpide_init(0); #endif /* CONFIG_BLK_DEV_ISAPNP */ #ifdef CONFIG_PROC_FS ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc); ide_remove_proc_entries(drive->proc, generic_subdriver_entries); #endif auto_remove_settings(drive); drive->driver = NULL; restore_flags(flags); /* all CPUs */ return 0; } int ide_register_module (ide_module_t *module) { ide_module_t *p = ide_modules; while (p) { if (p == module) return 1; p = p->next; } module->next = ide_modules; ide_modules = module; revalidate_drives(); return 0; } void ide_unregister_module (ide_module_t *module) { ide_module_t **p; for (p = &ide_modules; (*p) && (*p) != module; p = &((*p)->next)); if (*p) *p = (*p)->next; } struct block_device_operations ide_fops[] = {{ owner: THIS_MODULE, open: ide_open, release: ide_release, ioctl: ide_ioctl, check_media_change: ide_check_media_change, revalidate: ide_revalidate_disk }}; EXPORT_SYMBOL(ide_hwifs); EXPORT_SYMBOL(ide_register_module); EXPORT_SYMBOL(ide_unregister_module); EXPORT_SYMBOL(ide_spin_wait_hwgroup); /* * Probe module */ devfs_handle_t ide_devfs_handle; EXPORT_SYMBOL(ide_probe); EXPORT_SYMBOL(drive_is_flashcard); EXPORT_SYMBOL(ide_timer_expiry); EXPORT_SYMBOL(ide_intr); EXPORT_SYMBOL(ide_fops); EXPORT_SYMBOL(ide_get_queue); EXPORT_SYMBOL(ide_add_generic_settings); EXPORT_SYMBOL(ide_devfs_handle); EXPORT_SYMBOL(do_ide_request); /* * Driver module */ EXPORT_SYMBOL(ide_scan_devices); EXPORT_SYMBOL(ide_register_subdriver); EXPORT_SYMBOL(ide_unregister_subdriver); EXPORT_SYMBOL(ide_replace_subdriver); EXPORT_SYMBOL(ide_input_data); EXPORT_SYMBOL(ide_output_data); EXPORT_SYMBOL(atapi_input_bytes); EXPORT_SYMBOL(atapi_output_bytes); EXPORT_SYMBOL(ide_set_handler); EXPORT_SYMBOL(ide_dump_status); EXPORT_SYMBOL(ide_error); EXPORT_SYMBOL(ide_fixstring); EXPORT_SYMBOL(ide_wait_stat); EXPORT_SYMBOL(ide_do_reset); EXPORT_SYMBOL(restart_request); EXPORT_SYMBOL(ide_init_drive_cmd); EXPORT_SYMBOL(ide_do_drive_cmd); EXPORT_SYMBOL(ide_end_drive_cmd); EXPORT_SYMBOL(ide_end_request); EXPORT_SYMBOL(ide_revalidate_disk); EXPORT_SYMBOL(ide_cmd); EXPORT_SYMBOL(ide_wait_cmd); EXPORT_SYMBOL(ide_wait_cmd_task); EXPORT_SYMBOL(ide_delay_50ms); EXPORT_SYMBOL(ide_stall_queue); #ifdef CONFIG_PROC_FS EXPORT_SYMBOL(ide_add_proc_entries); EXPORT_SYMBOL(ide_remove_proc_entries); EXPORT_SYMBOL(proc_ide_read_geometry); EXPORT_SYMBOL(create_proc_ide_interfaces); #endif EXPORT_SYMBOL(ide_add_setting); EXPORT_SYMBOL(ide_remove_setting); EXPORT_SYMBOL(ide_register_hw); EXPORT_SYMBOL(ide_register); EXPORT_SYMBOL(ide_unregister); EXPORT_SYMBOL(ide_setup_ports); EXPORT_SYMBOL(hwif_unregister); EXPORT_SYMBOL(get_info_ptr); EXPORT_SYMBOL(current_capacity); EXPORT_SYMBOL(system_bus_clock); /* * This is gets invoked once during initialization, to set *everything* up */ int __init ide_init (void) { static char banner_printed; int i; if (!banner_printed) { printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); ide_devfs_handle = devfs_mk_dir (NULL, "ide", NULL); system_bus_speed = ide_system_bus_speed(); banner_printed = 1; } init_ide_data (); initializing = 1; ide_init_builtin_drivers(); initializing = 0; for (i = 0; i < MAX_HWIFS; ++i) { ide_hwif_t *hwif = &ide_hwifs[i]; if (hwif->present) ide_geninit(hwif); } return 0; } #ifdef MODULE char *options = NULL; MODULE_PARM(options,"s"); MODULE_LICENSE("GPL"); static void __init parse_options (char *line) { char *next = line; if (line == NULL || !*line) return; while ((line = next) != NULL) { if ((next = strchr(line,' ')) != NULL) *next++ = 0; if (!ide_setup(line)) printk ("Unknown option '%s'\n", line); } } int init_module (void) { parse_options(options); return ide_init(); } void cleanup_module (void) { int index; for (index = 0; index < MAX_HWIFS; ++index) { ide_unregister(index); #if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI) if (ide_hwifs[index].dma_base) (void) ide_release_dma(&ide_hwifs[index]); #endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */ } #ifdef CONFIG_PROC_FS proc_ide_destroy(); #endif devfs_unregister (ide_devfs_handle); } #else /* !MODULE */ __setup("", ide_setup); #endif /* MODULE */
hugh712/my_driver_study
Jollen/jk2410/kernel-jk2410/drivers/ide/ide.c
C
gpl-2.0
113,381
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ASPNetWebApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ASPNetWebApi")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ac7bacbb-db15-4804-9ca1-ec4ee07874b9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mesutozturk/ASP-Restfull-Api-Service
ASPNetWebApi/ASPNetWebApi/Properties/AssemblyInfo.cs
C#
gpl-2.0
1,360
<?php /** * Created by PhpStorm. * User: vlad * Date: 27.01.15 * Time: 19:09 */ namespace ModelFramework\FormService\FormField\Strategy; use ModelFramework\FieldTypesService\FieldType\FieldTypeAwareTrait; use ModelFramework\FieldTypesService\FieldType\FieldTypeInterface; use ModelFramework\FormService\FormField\FieldConfig\FieldConfig; use ModelFramework\FormService\FormField\FieldConfig\FieldConfigInterface; use ModelFramework\FormService\FormField\FieldConfig\FieldConfigAwareTrait; use ModelFramework\Utility\Arr; class EmailStrategy implements FormFieldStrategyInterface { use FieldConfigAwareTrait, FieldTypeAwareTrait; /** * @var string */ private $name = ''; /** * @param string $name * * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * @return string */ public function getName() { return $this->name; } /** * @return string */ public function getType() { return $this->getFieldConfigVerify()->type; } /** * @param array $aConfig * * @return $this * @throws \Exception */ public function parseFieldConfigArray(array $aConfig) { $fieldConfig = new FieldConfig(); $fieldConfig->exchangeArray($aConfig); return $fieldConfig; } /** * @return $this */ public function parse() { return $this->s($this->getFieldConfigVerify(), $this->getFieldTypeVerify()); } /** * @return $this */ public function init() { } public function s( FieldConfigInterface $conf, FieldTypeInterface $_fieldType ) { $_fieldSets = []; $_joins = []; $_fieldType->label = isset($conf->label) ? $conf->label : ucfirst($this->getName()); if (isset($conf->group)) { $_fieldSets[$conf->group]['elements'][$this->getName()] = $_fieldType->label; $_fieldType->group = $conf->group; } //FIXME this does not work for lookup fields, only for source fields. Need update. $_fieldType->default = isset($conf->default) ? $conf->default : ''; $_fieldType->source = $this->getName(); $_fields = [$this->getName() => $_fieldType->toArray()]; $_labels = [$this->getName() => $_fieldType->label]; $_fields = Arr::merge($_fields, [ $this->getName() . '_id' => [ 'type' => 'field', 'fieldtype' => 'source', 'datatype' => 'string', 'default' => 0, 'label' => '', // 'source' => $this->getName(), ] ]); $result = [ 'labels' => $_labels, 'fields' => $_fields, 'joins' => $_joins, 'fieldsets' => $_fieldSets, ]; return $result; } }
modelframework/modelframework
src/ModelFramework/FormService/FormField/Strategy/EmailStrategy.php
PHP
gpl-2.0
3,086
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.9.1"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>InspIRCd: Numerics::CannotSendTo Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">InspIRCd &#160;<span id="projectnumber">4.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.9.1 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search','.html'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><b>Numerics</b></li><li class="navelem"><a class="el" href="class_numerics_1_1_cannot_send_to.html">CannotSendTo</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> &#124; <a href="class_numerics_1_1_cannot_send_to-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">Numerics::CannotSendTo Class Reference</div> </div> </div><!--header--> <div class="contents"> <p><code>#include &lt;<a class="el" href="numericbuilder_8h_source.html">numericbuilder.h</a>&gt;</code></p> <div class="dynheader"> Inheritance diagram for Numerics::CannotSendTo:</div> <div class="dyncontent"> <div class="center"> <img src="class_numerics_1_1_cannot_send_to.png" usemap="#Numerics::CannotSendTo_map" alt=""/> <map id="Numerics::CannotSendTo_map" name="Numerics::CannotSendTo_map"> <area href="class_numeric_1_1_numeric.html" alt="Numeric::Numeric" shape="rect" coords="0,0,154,24"/> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a896a9f465f3aec7c150777064b62a3bb"><td class="memItemLeft" align="right" valign="top"><a id="a896a9f465f3aec7c150777064b62a3bb"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>CannotSendTo</b> (<a class="el" href="class_channel.html">Channel</a> *chan, const std::string &amp;message)</td></tr> <tr class="separator:a896a9f465f3aec7c150777064b62a3bb"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac3e1e2df08cd09156ab8c4d0e28ecb72"><td class="memItemLeft" align="right" valign="top"><a id="ac3e1e2df08cd09156ab8c4d0e28ecb72"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>CannotSendTo</b> (<a class="el" href="class_channel.html">Channel</a> *chan, const std::string &amp;what, <a class="el" href="class_mode_handler.html">ModeHandler</a> *mh)</td></tr> <tr class="separator:ac3e1e2df08cd09156ab8c4d0e28ecb72"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a601e09176b4f2b178f105e8020cca659"><td class="memItemLeft" align="right" valign="top"><a id="a601e09176b4f2b178f105e8020cca659"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>CannotSendTo</b> (<a class="el" href="class_channel.html">Channel</a> *chan, const std::string &amp;what, char extban, const std::string &amp;extbandesc)</td></tr> <tr class="separator:a601e09176b4f2b178f105e8020cca659"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a15111bf615f39316c18ff3ba3b78e5ed"><td class="memItemLeft" align="right" valign="top"><a id="a15111bf615f39316c18ff3ba3b78e5ed"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>CannotSendTo</b> (<a class="el" href="class_user.html">User</a> *user, const std::string &amp;message)</td></tr> <tr class="separator:a15111bf615f39316c18ff3ba3b78e5ed"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abb1518554a28bd87bcdd40df4910c473"><td class="memItemLeft" align="right" valign="top"><a id="abb1518554a28bd87bcdd40df4910c473"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>CannotSendTo</b> (<a class="el" href="class_user.html">User</a> *user, const std::string &amp;what, <a class="el" href="class_mode_handler.html">ModeHandler</a> *mh, bool self=false)</td></tr> <tr class="separator:abb1518554a28bd87bcdd40df4910c473"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pub_methods_class_numeric_1_1_numeric"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_numeric_1_1_numeric')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="class_numeric_1_1_numeric.html">Numeric::Numeric</a></td></tr> <tr class="memitem:ac4550b522e559744210ac5581b52d2aa inherit pub_methods_class_numeric_1_1_numeric"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#ac4550b522e559744210ac5581b52d2aa">Numeric</a> (unsigned int num)</td></tr> <tr class="separator:ac4550b522e559744210ac5581b52d2aa inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1ef5fdc1658b90196b44a4c1913a82d3 inherit pub_methods_class_numeric_1_1_numeric"><td class="memTemplParams" colspan="2">template&lt;typename... Args&gt; </td></tr> <tr class="memitem:a1ef5fdc1658b90196b44a4c1913a82d3 inherit pub_methods_class_numeric_1_1_numeric"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="class_numeric_1_1_numeric.html">Numeric</a> &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#a1ef5fdc1658b90196b44a4c1913a82d3">push</a> (const Args &amp;... args)</td></tr> <tr class="separator:a1ef5fdc1658b90196b44a4c1913a82d3 inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2bd7f0c1236dfb7b4433dc1a4c64ca50 inherit pub_methods_class_numeric_1_1_numeric"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#a2bd7f0c1236dfb7b4433dc1a4c64ca50">SetServer</a> (<a class="el" href="class_server.html">Server</a> *server)</td></tr> <tr class="separator:a2bd7f0c1236dfb7b4433dc1a4c64ca50 inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a091a94948852c943f85d5b92852e531d inherit pub_methods_class_numeric_1_1_numeric"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_server.html">Server</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#a091a94948852c943f85d5b92852e531d">GetServer</a> () const</td></tr> <tr class="separator:a091a94948852c943f85d5b92852e531d inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aed7fa51e7a7e7341d645019415530b3d inherit pub_methods_class_numeric_1_1_numeric"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#aed7fa51e7a7e7341d645019415530b3d">GetNumeric</a> () const</td></tr> <tr class="separator:aed7fa51e7a7e7341d645019415530b3d inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6560dc95f54b8fe3ee235dd82be08ab8 inherit pub_methods_class_numeric_1_1_numeric"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="class_command_base_1_1_params.html">CommandBase::Params</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#a6560dc95f54b8fe3ee235dd82be08ab8">GetParams</a> () const</td></tr> <tr class="separator:a6560dc95f54b8fe3ee235dd82be08ab8 inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aafdd782234fd5a96caa05183c0898735 inherit pub_methods_class_numeric_1_1_numeric"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_command_base_1_1_params.html">CommandBase::Params</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_numeric_1_1_numeric.html#aafdd782234fd5a96caa05183c0898735">GetParams</a> ()</td></tr> <tr class="separator:aafdd782234fd5a96caa05183c0898735 inherit pub_methods_class_numeric_1_1_numeric"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Builder for the ERR_CANNOTSENDTOCHAN and ERR_CANNOTSENDTOUSER numerics. </p> </div><hr/>The documentation for this class was generated from the following file:<ul> <li>include/<a class="el" href="numericbuilder_8h_source.html">numericbuilder.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </small></address> </body> </html>
inspircd/inspircd.github.com
api/4.0/class_numerics_1_1_cannot_send_to.html
HTML
gpl-2.0
10,968
<?php class Jaundies_Directory_Manager { /** * Singleton Instance */ private static $_instance = null; protected $_directories = array(); private function __construct() { self::$_instance = $this; } public static function getInstance() { if (self::$_instance === null) new Jaundies_Directory_Manager; return self::$_instance; } public function directoryExists($dir) { return isset($this->_directories[$dir]); } public function __get($dir) { return $this->getDirectory($dir); } public function __set($key, $dir) { $this->addDirectory($key,$dir); } public function addDirectory($key, Jaundies_Directory_Interface $dir) { $this->_directories[$key] = $dir; } public function get($dir, $user = null) { if ($user === null) return $this->getDirectory($dir); else return $this->getUser($dir,$user); } public function getUser($dir, $user) { if ($user instanceof Jaundies_User) $id = $user->getId(); else $id = $user; return $this->getDirectory($dir)->getUser($id); } public function getDirectory($dir) { if (!$this->directoryExists($dir)) throw new Jaundies_Exception('Directory ' .$dir . 'does not exist.'); return $this->_directories[$dir]; } }
Jaundies/Jaundies-Game-Framework
src/Directory/Manager.php
PHP
gpl-2.0
1,232
<?php /** * The plugin bootstrap file * * This file is read by WordPress to generate the plugin information in the plugin * admin area. This file also includes all of the dependencies used by the plugin, * registers the activation and deactivation functions, and defines a function * that starts the plugin. * * @link http://www.askmetisa.com/ * @since 1.0.0 * @package Metisa * * @wordpress-plugin * Plugin Name: Metisa * Plugin URI: http://example.com/metisa-uri/ * Description: Link your WP WooCommerce store data to Metisa for intelligent insights. * Version: 1.0.0 * Author: Altitude Labs * Author URI: http://www.askmetisa.com/ * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: metisa * Domain Path: /languages */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } /** * The code that runs during plugin activation. * This action is documented in includes/class-metisa-activator.php */ function activate_metisa() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-metisa-activator.php'; Metisa_Activator::activate(); } /** * The code that runs during plugin deactivation. * This action is documented in includes/class-metisa-deactivator.php */ function deactivate_metisa() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-metisa-deactivator.php'; Metisa_Deactivator::deactivate(); } register_activation_hook( __FILE__, 'activate_metisa' ); register_deactivation_hook( __FILE__, 'deactivate_metisa' ); /** * The core plugin class that is used to define internationalization, * admin-specific hooks, and public-facing site hooks. */ require plugin_dir_path( __FILE__ ) . 'includes/class-metisa.php'; // Include the global variables. require plugin_dir_path( __FILE__ ) . 'admin/settings.php'; /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run_metisa() { $plugin = new Metisa(); $plugin->run(); } run_metisa(); function log_me($message) { if (WP_DEBUG === true) { if (is_array($message) || is_object($message)) { error_log(print_r($message, true)); } else { error_log($message); } } }
altitudelabs/metisa-wordpress-plugin
metisa.php
PHP
gpl-2.0
2,446
package org.schlocknet.kbdb.model; import lombok.Getter; import lombok.Setter; /** * * @author Ryan * * A generic response message that can be used for multiple web service * responses. * @param <T> The type of the responseObject * */ public class ResponseMessage<T> extends JsonBase { private @Getter @Setter boolean success; private @Getter @Setter String msg; private @Getter @Setter T responseObject; public ResponseMessage() { this.success = false; this.msg = null; this.responseObject = null; } public ResponseMessage(boolean success) { this.success = success; this.msg = null; this.responseObject = null; } public ResponseMessage(boolean success, String msg) { this.success = success; this.msg = msg; this.responseObject = null; } public ResponseMessage(boolean success, String msg, T responseObject) { this.success = success; this.msg = msg; this.responseObject = responseObject; } }
lsendel/kbdb
src/main/java/org/schlocknet/kbdb/model/ResponseMessage.java
Java
gpl-2.0
1,087
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MediaBrowser.Controller.LiveTv { public class TunerChannelMapping { public string Name { get; set; } public string Number { get; set; } public string ProviderChannelNumber { get; set; } public string ProviderChannelName { get; set; } } }
neagix/Emby
MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs
C#
gpl-2.0
412
''' Copyright (C) 2015 Jacob Bieker, jacob@bieker.us, www.jacobbieker.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ''' __author__ = 'Jacob Bieker' print("Starting Google Plus Parsing")
jacobbieker/Insights
insights/google/GPlus2SQLite.py
Python
gpl-2.0
825
<?php /* @copyright:ChronoEngine.com @license:GPLv2 */defined('_JEXEC') or die('Restricted access'); defined("GCORE_SITE") or die; ?> <div class="ui segment tab functions-tab active" data-tab="functions-<?php echo $n; ?>"> <div class="ui top attached tabular menu small G2-tabs"> <a class="item active" data-tab="functions-<?php echo $n; ?>-general"><?php el('General'); ?></a> <a class="item" data-tab="functions-<?php echo $n; ?>-permissions"><?php el('Permissions'); ?></a> </div> <div class="ui bottom attached tab segment active" data-tab="functions-<?php echo $n; ?>-general"> <input type="hidden" value="php" name="Connection[functions][<?php echo $n; ?>][type]"> <div class="two fields"> <div class="field"> <label><?php el('Name'); ?></label> <input type="text" value="" name="Connection[functions][<?php echo $n; ?>][name]"> </div> </div> <div class="field forms_conf"> <label><?php el('Designer Label'); ?></label> <input type="text" value="" name="Connection[functions][<?php echo $n; ?>][label]"> </div> <div class="field"> <label><?php el('Code'); ?></label> <textarea name="Connection[functions][<?php echo $n; ?>][code]" rows="15"></textarea> <small><?php el('PHP code with OUT tags, returned value will be set as var'); ?></small> </div> </div> <div class="ui bottom attached tab segment" data-tab="functions-<?php echo $n; ?>-permissions"> <div class="two fields"> <div class="field"> <label><?php el('Owner id value'); ?></label> <input type="text" value="" name="Connection[functions][<?php echo $n; ?>][owner_id]"> </div> </div> <?php $this->view('views.permissions_manager', ['model' => 'Connection[functions]['.$n.']', 'perms' => ['access' => rl('Access')], 'groups' => $this->get('groups')]); ?> </div> </div>
azharu53/kuwithome
libraries/cegcore2/admin/extensions/chronofc/functions/php/php_config.php
PHP
gpl-2.0
1,828
<?php /** * --------------------------------------------------------------------- * GLPI - Gestionnaire Libre de Parc Informatique * Copyright (C) 2015-2022 Teclib' and contributors. * * http://glpi-project.org * * based on GLPI - Gestionnaire Libre de Parc Informatique * Copyright (C) 2003-2014 by the INDEPNET Development Team. * * --------------------------------------------------------------------- * * LICENSE * * This file is part of GLPI. * * GLPI is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GLPI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GLPI. If not, see <http://www.gnu.org/licenses/>. * --------------------------------------------------------------------- */ include("../inc/includes.php"); if (!isset($_GET["id"])) { $_GET["id"] = ""; } $client = new APIClient(); if (isset($_POST["add"])) { $client->check(-1, CREATE, $_POST); $client->add($_POST); Html::back(); } else if (isset($_POST["update"])) { $client->check($_POST["id"], UPDATE); $client->update($_POST); Html::back(); } else if (isset($_POST["purge"])) { $client->check($_POST["id"], PURGE); $client->delete($_POST); Html::redirect($CFG_GLPI["root_doc"] . "/front/config.form.php"); } else { Html::header(APIClient::getTypeName(1), $_SERVER['PHP_SELF'], "config", "config", "apiclient"); $client->display(['id' => $_GET["id"]]); Html::footer(); }
stweil/glpi
front/apiclient.form.php
PHP
gpl-2.0
1,869
# Makefile.in generated by automake 1.11.1 from Makefile.am. # Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. pkgdatadir = $(datadir)/xlsclients pkgincludedir = $(includedir)/xlsclients pkglibdir = $(libdir)/xlsclients pkglibexecdir = $(libexecdir)/xlsclients am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = i686-pc-linux-gnu host_triplet = arm-buildroot-linux-gnueabi bin_PROGRAMS = xlsclients$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure COPYING ChangeLog INSTALL config.guess \ config.sub depcomp install-sh missing strnlen.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" PROGRAMS = $(bin_PROGRAMS) am_xlsclients_OBJECTS = xlsclients.$(OBJEXT) xlsclients_OBJECTS = $(am_xlsclients_OBJECTS) am__DEPENDENCIES_1 = xlsclients_DEPENDENCIES = $(am__DEPENDENCIES_1) $(LIBOBJS) DEFAULT_INCLUDES = -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(xlsclients_SOURCES) DIST_SOURCES = $(xlsclients_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' DATA = $(appman_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/missing --run aclocal-1.11 ADMIN_MAN_DIR = $(mandir)/man$(ADMIN_MAN_SUFFIX) ADMIN_MAN_SUFFIX = 8 AMTAR = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/missing --run tar AM_DEFAULT_VERBOSITY = 0 APP_MAN_DIR = $(mandir)/man$(APP_MAN_SUFFIX) APP_MAN_SUFFIX = 1 AUTOCONF = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/missing --run autoconf AUTOHEADER = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/missing --run autoheader AUTOMAKE = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/missing --run automake-1.11 AWK = gawk CC = /home/simon/GIT/buildroot-k3-current/output/host/usr/bin/arm-none-linux-gnueabi-gcc -std=gnu99 CCDEPMODE = depmode=gcc3 CFLAGS = -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -U_FORTIFY_SOURCE -fno-stack-protector -fomit-frame-pointer -fPIC -O2 CHANGELOG_CMD = (GIT_DIR=$(top_srcdir)/.git git log > $(top_srcdir)/.changelog.tmp && mv $(top_srcdir)/.changelog.tmp $(top_srcdir)/ChangeLog) || (rm -f $(top_srcdir)/.changelog.tmp; touch $(top_srcdir)/ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) CPP = /home/simon/GIT/buildroot-k3-current/output/host/usr/bin/arm-none-linux-gnueabi-cpp CPPFLAGS = -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 CWARNFLAGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -Wbad-function-cast -Wformat=2 -Wold-style-definition -Wdeclaration-after-statement CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DRIVER_MAN_DIR = $(mandir)/man$(DRIVER_MAN_SUFFIX) DRIVER_MAN_SUFFIX = 4 ECHO_C = ECHO_N = -n ECHO_T = EGREP = /bin/grep -E EXEEXT = FILE_MAN_DIR = $(mandir)/man$(FILE_MAN_SUFFIX) FILE_MAN_SUFFIX = 5 GREP = /bin/grep INSTALL = /usr/bin/install -c INSTALL_CMD = (cp -f /usr/share/util-macros/INSTALL $(top_srcdir)/.INSTALL.tmp && mv $(top_srcdir)/.INSTALL.tmp $(top_srcdir)/INSTALL) || (rm -f $(top_srcdir)/.INSTALL.tmp; touch $(top_srcdir)/INSTALL; echo 'util-macros "pkgdatadir" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2) INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = $(install_sh) -c -s LDFLAGS = LIBOBJS = LIBS = LIB_MAN_DIR = $(mandir)/man$(LIB_MAN_SUFFIX) LIB_MAN_SUFFIX = 3 LTLIBOBJS = MAINT = # MAKEINFO = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/missing --run makeinfo MAN_SUBSTS = -e 's|__vendorversion__|"$(PACKAGE_STRING)" "$(XORG_MAN_PAGE)"|' -e 's|__xorgversion__|"$(PACKAGE_STRING)" "$(XORG_MAN_PAGE)"|' -e 's|__xservername__|Xorg|g' -e 's|__xconfigfile__|xorg.conf|g' -e 's|__projectroot__|$(prefix)|g' -e 's|__apploaddir__|$(appdefaultdir)|g' -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' -e 's|__libmansuffix__|$(LIB_MAN_SUFFIX)|g' -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' MISC_MAN_DIR = $(mandir)/man$(MISC_MAN_SUFFIX) MISC_MAN_SUFFIX = 7 MKDIR_P = /bin/mkdir -p OBJEXT = o PACKAGE = xlsclients PACKAGE_BUGREPORT = https://bugs.freedesktop.org/enter_bug.cgi?product=xorg PACKAGE_NAME = xlsclients PACKAGE_STRING = xlsclients 1.1.1 PACKAGE_TARNAME = xlsclients PACKAGE_URL = PACKAGE_VERSION = 1.1.1 PATH_SEPARATOR = : PKG_CONFIG = /home/simon/GIT/buildroot-k3-current/output/host/usr/bin/pkg-config SED = /bin/sed SET_MAKE = SHELL = /bin/sh STRIP = /home/simon/GIT/buildroot-k3-current/output/host/usr/bin/arm-none-linux-gnueabi-strip VERSION = 1.1.1 XLSCLIENTS_CFLAGS = -I/home/simon/GIT/buildroot-k3-current/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include XLSCLIENTS_LIBS = -lxcb-atom -L/home/simon/GIT/buildroot-k3-current/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib -lxcb XORG_MAN_PAGE = X Version 11 abs_builddir = /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1 abs_srcdir = /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1 abs_top_builddir = /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1 abs_top_srcdir = /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1 ac_ct_CC = am__include = include am__leading_dot = . am__quote = am__tar = ${AMTAR} chof - "$$tardir" am__untar = ${AMTAR} xf - bindir = ${exec_prefix}/bin build = i686-pc-linux-gnu build_alias = i686-pc-linux-gnu build_cpu = i686 build_os = linux-gnu build_vendor = pc builddir = . datadir = ${datarootdir} datarootdir = ${prefix}/share docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} dvidir = ${docdir} exec_prefix = /usr host = arm-buildroot-linux-gnueabi host_alias = arm-buildroot-linux-gnueabi host_cpu = arm host_os = linux-gnueabi host_vendor = buildroot htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info install_sh = ${SHELL} /home/simon/GIT/buildroot-k3-current/output/build/xapp_xlsclients-1.1.1/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale localstatedir = ${prefix}/var mandir = ${datarootdir}/man mkdir_p = /bin/mkdir -p oldincludedir = /usr/include pdfdir = ${docdir} prefix = /usr program_transform_name = s&^&& psdir = ${docdir} sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com srcdir = . sysconfdir = /etc target_alias = arm-buildroot-linux-gnueabi top_build_prefix = top_builddir = . top_srcdir = . AM_CFLAGS = $(CWARNFLAGS) $(XLSCLIENTS_CFLAGS) xlsclients_LDADD = $(XLSCLIENTS_LIBS) $(LIBOBJS) xlsclients_SOURCES = \ xlsclients.c appman_PRE = \ xlsclients.man appmandir = $(APP_MAN_DIR) appman_DATA = $(appman_PRE:man=1) EXTRA_DIST = $(appman_PRE) strnlen.h MAINTAINERCLEANFILES = ChangeLog INSTALL CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .man .c .o .obj am--refresh: @: $(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: # $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): # $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: # $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) xlsclients$(EXEEXT): $(xlsclients_OBJECTS) $(xlsclients_DEPENDENCIES) @rm -f xlsclients$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xlsclients_OBJECTS) $(xlsclients_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c include $(DEPDIR)/strnlen.Po include ./$(DEPDIR)/xlsclients.Po .c.o: $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po # $(AM_V_CC) \ # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(COMPILE) -c $< .c.obj: $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po # $(AM_V_CC) \ # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(COMPILE) -c `$(CYGPATH_W) '$<'` install-appmanDATA: $(appman_DATA) @$(NORMAL_INSTALL) test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)" @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \ done uninstall-appmanDATA: @$(NORMAL_UNINSTALL) @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(appmandir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(appmandir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(DATA) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-appmanDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-appmanDATA \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-appmanDATA \ uninstall-binPROGRAMS # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT:
twobob/buildroot-kindle
output/build/xapp_xlsclients-1.1.1/Makefile
Makefile
gpl-2.0
27,506
/* ***** BEGIN LICENSE BLOCK ***** * This file is part of Natron <http://www.natron.fr/>, * Copyright (C) 2013-2017 INRIA and Alexandre Gauthier-Foichat * * Natron is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Natron is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html> * ***** END LICENSE BLOCK ***** */ // ***** BEGIN PYTHON BLOCK ***** // from <https://docs.python.org/3/c-api/intro.html#include-files>: // "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included." #include <Python.h> // ***** END PYTHON BLOCK ***** #include "PickKnobDialog.h" #include <stdexcept> #include <map> #include "Global/Macros.h" #if !defined(Q_MOC_RUN) && !defined(SBK_RUN) #include <boost/shared_ptr.hpp> #endif #include <QGridLayout> #include <QCheckBox> #include <QtCore/QTimer> #include "Engine/Knob.h" // KnobI #include "Engine/KnobTypes.h" // KnobButton... #include "Engine/Node.h" #include "Engine/NodeGroup.h" // NodeCollection #include "Engine/Utils.h" // convertFromPlainText #include "Gui/ComboBox.h" #include "Gui/DialogButtonBox.h" #include "Gui/Label.h" #include "Gui/KnobGui.h" #include "Gui/NodeCreationDialog.h" // CompleterLineEdit #include "Gui/NodeGui.h" #include "Gui/NodeSettingsPanel.h" NATRON_NAMESPACE_ENTER; struct PickKnobDialogPrivate { DockablePanel* panel; QGridLayout* mainLayout; Label* selectNodeLabel; CompleterLineEdit* nodeSelectionCombo; ComboBox* knobSelectionCombo; Label* useAliasLabel; QCheckBox* useAliasCheckBox; Label* destPageLabel; ComboBox* destPageCombo; Label* groupLabel; ComboBox* groupCombo; std::vector<KnobPagePtr > pages; std::vector<KnobGroupPtr > groups; DialogButtonBox* buttons; NodesList allNodes; std::map<QString, boost::shared_ptr<KnobI > > allKnobs; KnobGuiPtr selectedKnob; PickKnobDialogPrivate(DockablePanel* panel) : panel(panel) , mainLayout(0) , selectNodeLabel(0) , nodeSelectionCombo(0) , knobSelectionCombo(0) , useAliasLabel(0) , useAliasCheckBox(0) , destPageLabel(0) , destPageCombo(0) , groupLabel(0) , groupCombo(0) , pages() , groups() , buttons(0) , allNodes() , allKnobs() , selectedKnob() { } KnobGroupPtr getSelectedGroup() const; void onSelectedKnobChanged() { if (!selectedKnob) { return; } KnobParametricPtr isParametric = toKnobParametric( selectedKnob->getKnob() ); if (isParametric) { useAliasCheckBox->setChecked(true); } useAliasLabel->setEnabled(!isParametric); useAliasCheckBox->setEnabled(!isParametric); } }; KnobGroupPtr PickKnobDialogPrivate::getSelectedGroup() const { if ( pages.empty() ) { return KnobGroupPtr(); } std::string selectedItem = groupCombo->getCurrentIndexText().toStdString(); if (selectedItem != "-") { for (std::vector<KnobGroupPtr >::const_iterator it = groups.begin(); it != groups.end(); ++it) { if ( (*it)->getName() == selectedItem ) { return *it; } } } return KnobGroupPtr(); } PickKnobDialog::PickKnobDialog(DockablePanel* panel, QWidget* parent) : QDialog(parent) , _imp( new PickKnobDialogPrivate(panel) ) { NodeSettingsPanel* nodePanel = dynamic_cast<NodeSettingsPanel*>(panel); assert(nodePanel); if (!nodePanel) { throw std::logic_error("PickKnobDialog::PickKnobDialog()"); } NodeGuiPtr nodeGui = nodePanel->getNodeGui(); NodePtr node = nodeGui->getNode(); NodeGroupPtr isGroup = node->isEffectNodeGroup(); NodeCollectionPtr collec = node->getGroup(); NodeGroupPtr isCollecGroup = toNodeGroup(collec); NodesList collectNodes = collec->getNodes(); for (NodesList::iterator it = collectNodes.begin(); it != collectNodes.end(); ++it) { if ((*it)->isActivated() && (*it)->getNodeGui() && ( (*it)->getKnobs().size() > 0 ) ) { _imp->allNodes.push_back(*it); } } if (isCollecGroup) { _imp->allNodes.push_back( isCollecGroup->getNode() ); } if (isGroup) { NodesList groupnodes = isGroup->getNodes(); for (NodesList::iterator it = groupnodes.begin(); it != groupnodes.end(); ++it) { if ( (*it)->getNodeGui() && (*it)->isActivated() && ( (*it)->getKnobs().size() > 0 ) ) { _imp->allNodes.push_back(*it); } } } QStringList nodeNames; for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) { QString name = QString::fromUtf8( (*it)->getLabel().c_str() ); nodeNames.push_back(name); } nodeNames.sort(); _imp->mainLayout = new QGridLayout(this); _imp->selectNodeLabel = new Label( tr("Node:") ); _imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this); _imp->nodeSelectionCombo->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Input the name of a node in the current project."), NATRON_NAMESPACE::WhiteSpaceNormal) ); _imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason); _imp->knobSelectionCombo = new ComboBox(this); QObject::connect( _imp->knobSelectionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onKnobComboIndexChanged(int)) ); QString useAliasTt = NATRON_NAMESPACE::convertFromPlainText(tr("If checked, an alias of the selected parameter will be created, coyping entirely its state. " "Only the script-name, label and tooltip will be editable.\n" "For choice parameters this will also " "dynamically refresh the menu entries when the original parameter's menu is changed.\n" "When unchecked, a simple expression will be set linking the two parameters, but things such as dynamic menus " "will be disabled."), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->useAliasLabel = new Label(tr("Make Alias:"), this); _imp->useAliasLabel->setToolTip(useAliasTt); _imp->useAliasCheckBox = new QCheckBox(this); _imp->useAliasCheckBox->setToolTip(useAliasTt); _imp->useAliasCheckBox->setChecked(true); QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) ); _imp->destPageLabel = new Label(tr("Page:"), this); QString pagett = NATRON_NAMESPACE::convertFromPlainText(tr("Select the page into which the parameter will be created."), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->destPageLabel->setToolTip(pagett); _imp->destPageCombo = new ComboBox(this); _imp->destPageCombo->setToolTip(pagett); QObject::connect( _imp->destPageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onPageComboIndexChanged(int)) ); const KnobsVec& knobs = node->getKnobs(); for (std::size_t i = 0; i < knobs.size(); ++i) { if ( knobs[i]->isUserKnob() ) { KnobPagePtr isPage = toKnobPage(knobs[i]); if (isPage) { _imp->pages.push_back(isPage); _imp->destPageCombo->addItem( QString::fromUtf8( isPage->getName().c_str() ) ); } else { KnobGroupPtr isGrp = toKnobGroup(knobs[i]); if (isGrp) { _imp->groups.push_back(isGrp); } } } } if (_imp->destPageCombo->count() == 0) { _imp->destPageLabel->hide(); _imp->destPageCombo->hide(); } _imp->groupLabel = new Label(tr("Group:"), this); QString grouptt = NATRON_NAMESPACE::convertFromPlainText(tr("Select the group into which the parameter will be created."), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->groupCombo = new ComboBox(this); _imp->groupLabel->setToolTip(grouptt); _imp->groupCombo->setToolTip(grouptt); onPageComboIndexChanged(0); _imp->buttons = new DialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel), Qt::Horizontal, this); QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) ); QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) ); _imp->mainLayout->addWidget(_imp->selectNodeLabel, 0, 0, 1, 1); _imp->mainLayout->addWidget(_imp->nodeSelectionCombo, 0, 1, 1, 1); _imp->mainLayout->addWidget(_imp->knobSelectionCombo, 0, 2, 1, 1); _imp->mainLayout->addWidget(_imp->useAliasLabel, 1, 0, 1, 1); _imp->mainLayout->addWidget(_imp->useAliasCheckBox, 1, 1, 1, 1); _imp->mainLayout->addWidget(_imp->destPageLabel, 2, 0, 1, 1); _imp->mainLayout->addWidget(_imp->destPageCombo, 2, 1, 1, 1); _imp->mainLayout->addWidget(_imp->groupLabel, 2, 2, 1, 1); _imp->mainLayout->addWidget(_imp->groupCombo, 2, 3, 1, 1); _imp->mainLayout->addWidget(_imp->buttons, 3, 0, 1, 3); QTimer::singleShot( 25, _imp->nodeSelectionCombo, SLOT(showCompleter()) ); } PickKnobDialog::~PickKnobDialog() { } static KnobGuiPtr getKnobGuiForKnob(const NodePtr& selectedNode, const KnobIPtr& knob) { NodeGuiIPtr selectedNodeGuiI = selectedNode->getNodeGui(); assert(selectedNodeGuiI); if (!selectedNodeGuiI) { return KnobGuiPtr(); } NodeGui* selectedNodeGui = dynamic_cast<NodeGui*>( selectedNodeGuiI.get() ); assert(selectedNodeGui); if (!selectedNodeGui) { return KnobGuiPtr(); } NodeSettingsPanel* selectedPanel = selectedNodeGui->getSettingPanel(); bool hadPanelVisible = selectedPanel && !selectedPanel->isClosed(); if (!selectedPanel) { selectedNodeGui->ensurePanelCreated(); selectedPanel = selectedNodeGui->getSettingPanel(); selectedNodeGui->setVisibleSettingsPanel(false); } if (!selectedPanel) { return KnobGuiPtr(); } if (!hadPanelVisible && selectedPanel) { selectedPanel->setClosed(true); } const std::list<std::pair<KnobIWPtr, KnobGuiPtr> >& knobsMap = selectedPanel->getKnobsMapping(); for (std::list<std::pair<KnobIWPtr, KnobGuiPtr> >::const_iterator it = knobsMap.begin(); it != knobsMap.end(); ++it) { if (it->first.lock() == knob) { return it->second; } } return KnobGuiPtr(); } void PickKnobDialog::onKnobComboIndexChanged(int /*idx*/) { QString selectedNodeName = _imp->nodeSelectionCombo->text(); NodePtr selectedNode; std::string currentNodeName = selectedNodeName.toStdString(); for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) { if ( (*it)->getLabel() == currentNodeName ) { selectedNode = *it; break; } } _imp->selectedKnob.reset(); if (selectedNode) { QString str = _imp->knobSelectionCombo->itemText( _imp->knobSelectionCombo->activeIndex() ); std::map<QString, KnobIPtr >::const_iterator it = _imp->allKnobs.find(str); KnobIPtr selectedKnob; if ( it != _imp->allKnobs.end() ) { selectedKnob = it->second; _imp->selectedKnob = getKnobGuiForKnob(selectedNode, selectedKnob); } } _imp->onSelectedKnobChanged(); } void PickKnobDialog::onNodeComboEditingFinished() { QString index = _imp->nodeSelectionCombo->text(); _imp->knobSelectionCombo->clear(); _imp->allKnobs.clear(); _imp->selectedKnob.reset(); NodePtr selectedNode; std::string currentNodeName = index.toStdString(); for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) { if ( (*it)->getLabel() == currentNodeName ) { selectedNode = *it; break; } } if (!selectedNode) { return; } const std::vector< KnobIPtr > & knobs = selectedNode->getKnobs(); for (U32 j = 0; j < knobs.size(); ++j) { if ( !knobs[j]->getIsSecret() ) { KnobPagePtr isPage = toKnobPage(knobs[j]); KnobGroupPtr isGroup = toKnobGroup(knobs[j]); if (!isPage && !isGroup) { QString name = QString::fromUtf8( knobs[j]->getName().c_str() ); bool canInsertKnob = true; for (int k = 0; k < knobs[j]->getNDimensions(); ++k) { if ( name.isEmpty() ) { canInsertKnob = false; } } if (canInsertKnob) { if (!_imp->selectedKnob) { _imp->selectedKnob = getKnobGuiForKnob(selectedNode, knobs[j]); } _imp->allKnobs.insert( std::make_pair( name, knobs[j]) ); _imp->knobSelectionCombo->addItem(name); } } } } _imp->onSelectedKnobChanged(); _imp->knobSelectionCombo->setCurrentIndex_no_emit(0); } void PickKnobDialog::onPageComboIndexChanged(int index) { if ( _imp->pages.empty() ) { _imp->groupLabel->hide(); _imp->groupCombo->hide(); } _imp->groupCombo->clear(); _imp->groupCombo->addItem( QString::fromUtf8("-") ); std::string selectedPage = _imp->destPageCombo->itemText(index).toStdString(); KnobPagePtr parentPage; for (std::vector<KnobPagePtr >::iterator it = _imp->pages.begin(); it != _imp->pages.end(); ++it) { if ( (*it)->getName() == selectedPage ) { parentPage = *it; break; } } for (std::vector<KnobGroupPtr >::iterator it = _imp->groups.begin(); it != _imp->groups.end(); ++it) { KnobPagePtr page = (*it)->getTopLevelPage(); assert(page); ///add only grps whose parent page is the selected page if (page == parentPage) { _imp->groupCombo->addItem( QString::fromUtf8( (*it)->getName().c_str() ) ); } } } KnobGuiPtr PickKnobDialog::getSelectedKnob(bool* makeAlias, KnobPagePtr* page, KnobGroupPtr* group) const { int page_i = _imp->destPageCombo->activeIndex(); if ( (page_i >= 0) && ( page_i < (int)_imp->pages.size() ) ) { *page = _imp->pages[page_i]; } *group = _imp->getSelectedGroup(); *makeAlias = _imp->useAliasCheckBox->isChecked(); return _imp->selectedKnob; } NATRON_NAMESPACE_EXIT; NATRON_NAMESPACE_USING; #include "moc_PickKnobDialog.cpp"
kcotugno/Natron
Gui/PickKnobDialog.cpp
C++
gpl-2.0
15,353
/* * IPv4ll supplicant * * Copyright (C) 2010-2012 Olaf Kirch <okir@suse.de> */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <sys/poll.h> #include <stdio.h> #include <stdarg.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <getopt.h> #include <errno.h> #include <net/if_arp.h> #include <wicked/netinfo.h> #include <wicked/addrconf.h> #include <wicked/logging.h> #include <wicked/wicked.h> #include <wicked/socket.h> #include <wicked/wireless.h> #include <wicked/objectmodel.h> #include "autoip4/autoip.h" enum { OPT_HELP, OPT_VERSION, OPT_CONFIGFILE, OPT_DEBUG, OPT_LOG_LEVEL, OPT_LOG_TARGET, OPT_SYSTEMD, OPT_FOREGROUND, OPT_RECOVER, }; static struct option options[] = { /* common */ { "help", no_argument, NULL, OPT_HELP }, { "version", no_argument, NULL, OPT_VERSION }, { "config", required_argument, NULL, OPT_CONFIGFILE }, { "debug", required_argument, NULL, OPT_DEBUG }, { "log-level", required_argument, NULL, OPT_LOG_LEVEL }, { "log-target", required_argument, NULL, OPT_LOG_TARGET }, { "systemd", no_argument, NULL, OPT_SYSTEMD }, /* daemon */ { "foreground", no_argument, NULL, OPT_FOREGROUND }, /* specific */ { "recover", no_argument, NULL, OPT_RECOVER }, { NULL } }; static const char * program_name; static const char * opt_log_target; static ni_bool_t opt_systemd; static ni_bool_t opt_foreground; static ni_bool_t opt_recover_state; static ni_dbus_server_t *autoip4_dbus_server; static void autoip4_supplicant(void); static void autoip4_discover_devices(ni_dbus_server_t *); static void autoip4_recover_state(ni_netdev_t *); static void autoip4_interface_event(ni_netdev_t *, ni_event_t); static void autoip4_protocol_event(enum ni_lease_event, const ni_autoip_device_t *, ni_addrconf_lease_t *); // Hack extern ni_dbus_object_t *ni_objectmodel_register_autoip4_device(ni_dbus_server_t *, ni_autoip_device_t *); int main(int argc, char **argv) { int c; ni_log_init(); program_name = ni_basename(argv[0]); while ((c = getopt_long(argc, argv, "+", options, NULL)) != EOF) { switch (c) { case OPT_HELP: default: usage: fprintf(stderr, "%s [options]\n" "This command understands the following options\n" " --help\n" " --version\n" " --config filename\n" " Read configuration file <filename> instead of system default.\n" " --debug facility\n" " Enable debugging for debug <facility>.\n" " Use '--debug help' for a list of facilities.\n" " --log-level level\n" " Set log level to <error|warning|notice|info|debug>.\n" " --log-target target\n" " Set log destination to <stderr|syslog>.\n" " --foreground\n" " Do not background the service.\n" " --recover\n" " Enable automatic recovery of daemon's state.\n" " --systemd\n" " Enables behavior required by systemd service\n" , program_name); return (c == OPT_HELP ? NI_LSB_RC_SUCCESS : NI_LSB_RC_USAGE); case OPT_VERSION: printf("%s %s\n", program_name, PACKAGE_VERSION); return NI_LSB_RC_SUCCESS; case OPT_CONFIGFILE: if (!ni_set_global_config_path(optarg)) { fprintf(stderr, "Unable to set config file '%s': %m\n", optarg); return NI_LSB_RC_ERROR; } break; case OPT_DEBUG: if (!strcmp(optarg, "help")) { printf("Supported debug facilities:\n"); ni_debug_help(); return NI_LSB_RC_SUCCESS; } if (ni_enable_debug(optarg) < 0) { fprintf(stderr, "Bad debug facility \"%s\"\n", optarg); goto usage; } break; case OPT_LOG_LEVEL: if (!ni_log_level_set(optarg)) { fprintf(stderr, "Bad log level \%s\"\n", optarg); goto usage; } break; case OPT_LOG_TARGET: opt_log_target = optarg; break; case OPT_FOREGROUND: opt_foreground = TRUE; break; case OPT_RECOVER: opt_recover_state = TRUE; break; case OPT_SYSTEMD: opt_systemd = TRUE; break; } } if (optind != argc) goto usage; if (opt_log_target) { if (!ni_log_destination(program_name, opt_log_target)) { fprintf(stderr, "Bad log destination \%s\"\n", opt_log_target); goto usage; } } else if (opt_systemd || getppid() == 1 || !opt_foreground) { /* syslog only */ ni_log_destination(program_name, "syslog"); } else { /* syslog + stderr */ ni_log_destination(program_name, "syslog::perror"); } if (ni_init("auto4") < 0) return NI_LSB_RC_ERROR; autoip4_supplicant(); return NI_LSB_RC_SUCCESS; } /* * At startup, discover current configuration. * If we have any live leases, restart address configuration for them. * This allows a daemon restart without losing lease state. */ void autoip4_recover_state(ni_netdev_t *ifp) { #if 0 ni_afinfo_t *afi = &ifp->ipv4; ni_addrconf_lease_t *lease; if (!ni_afinfo_addrconf_test(afi, NI_ADDRCONF_AUTOCONF)) return; /* Don't do anything if we already have a lease for this. */ if (afi->lease[NI_ADDRCONF_AUTOCONF] != NULL) return; lease = ni_addrconf_lease_file_read(ifp->name, NI_ADDRCONF_AUTOCONF, afi->family); if (lease == NULL) return; /* if lease expired, return and remove stale lease file */ if (!ni_addrconf_lease_is_valid(lease)) { ni_debug_wicked("%s: removing stale %s/%s lease file", ifp->name, ni_addrconf_type_to_name(lease->type), ni_addrfamily_type_to_name(lease->family)); ni_addrconf_lease_file_remove(ifp->name, NI_ADDRCONF_AUTOCONF, afi->family); ni_addrconf_lease_free(lease); return; } /* Do not install the lease; let the addrconf mechanism fill in all * the details. */ ni_addrconf_lease_free(lease); /* Recover the original addrconf request data here */ afi->request[NI_ADDRCONF_AUTOCONF] = ni_addrconf_request_file_read(ifp->name, NI_ADDRCONF_AUTOCONF, afi->family); if (afi->request[NI_ADDRCONF_AUTOCONF] == NULL) { ni_error("%s: seem to have valid lease, but lost original request", ifp->name); return; } afi->request[NI_ADDRCONF_AUTOCONF]->reuse_unexpired = 1; if (1) { ni_error("%s: unable to reacquire lease %s/%s", ifp->name, ni_addrconf_type_to_name(lease->type), ni_addrfamily_type_to_name(lease->family)); return; } ni_debug_wicked("%s: initiated recovery of %s/%s lease", ifp->name, ni_addrconf_type_to_name(lease->type), ni_addrfamily_type_to_name(lease->family)); #endif } /* * Functions to support the AUTO4 DBus binding */ static ni_dbus_service_t __wicked_dbus_autoip4_interface = { .name = NI_OBJECTMODEL_AUTO4_INTERFACE, }; void autoip4_register_services(ni_dbus_server_t *server) { ni_dbus_object_t *root_object = ni_dbus_server_get_root_object(server); ni_dbus_object_t *object; /* Register the root object /org/opensuse/Network/AUTO4 */ ni_dbus_object_register_service(root_object, &__wicked_dbus_autoip4_interface); /* Register /org/opensuse/Network/AUTO4/Interface */ object = ni_dbus_server_register_object(server, "Interface", &ni_dbus_anonymous_class, NULL); if (object == NULL) ni_fatal("Unable to create dbus object for interfaces"); autoip4_discover_devices(server); // ni_autoip_set_event_handler(autoip4_protocol_event); (void) (autoip4_protocol_event); } ni_bool_t ni_autoip4_supported(const ni_netdev_t *ifp) { /* * currently broadcast and arp capable ether type only, * we've simply did not tested it on other links ... */ switch (ifp->link.hwaddr.type) { case ARPHRD_ETHER: if (ifp->link.masterdev.index) { ni_debug_autoip("%s: DHCPv4 not supported on slaves", ifp->name); return FALSE; } if (!(ifp->link.ifflags & NI_IFF_ARP_ENABLED)) { ni_debug_autoip("%s: AutoIP not supported without " "ARP support", ifp->name); return FALSE; } /* Hmm... can this happen? */ if (!(ifp->link.ifflags & NI_IFF_BROADCAST_ENABLED)) { ni_debug_autoip("%s: AutoIP not supported without " " broadcast support", ifp->name); return FALSE; } if ((ifp->link.ifflags & NI_IFF_POINT_TO_POINT)) { ni_debug_autoip("%s: AutoIP not supported on point-" "to-point interfaces", ifp->name); return FALSE; } break; default: ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_AUTOIP, "%s: AutoIP not supported on %s interfaces", ifp->name, ni_linktype_type_to_name(ifp->link.hwaddr.type)); return FALSE; } return TRUE; } /* * Add a newly discovered device */ static ni_bool_t autoip4_device_create(ni_dbus_server_t *server, const ni_netdev_t *ifp) { ni_autoip_device_t *dev; ni_bool_t rv = FALSE; dev = ni_autoip_device_new(ifp->name, &ifp->link); if (!dev) { ni_error("Cannot allocate autoip4 device for '%s' and index %u", ifp->name, ifp->link.ifindex); return rv; } if (ni_objectmodel_register_autoip4_device(server, dev) != NULL) { ni_debug_autoip("Created autoip4 device for '%s' and index %u", ifp->name, ifp->link.ifindex); rv = TRUE; } /* either register autoip4 device was successful and obtained * an own reference or we can drop ours here anyway ... */ ni_autoip_device_put(dev); return rv; } /* * Remove a device that has disappeared */ static void autoip4_device_destroy(ni_dbus_server_t *server, const ni_netdev_t *ifp) { ni_autoip_device_t *dev; if ((dev = ni_autoip_device_by_index(ifp->link.ifindex)) != NULL) { ni_debug_autoip("%s: Destroying autoip4 device with index %u", ifp->name, ifp->link.ifindex); ni_dbus_server_unregister_object(server, dev); } } static void autoip4_device_destroy_all(ni_dbus_server_t *server) { ni_netconfig_t *nc; ni_netdev_t * ifp; if (!(nc = ni_global_state_handle(0))) return; for (ifp = ni_netconfig_devlist(nc); ifp; ifp = ifp->next) { autoip4_device_destroy(server, ifp); } } void autoip4_discover_devices(ni_dbus_server_t *server) { ni_netconfig_t *nc; ni_netdev_t *ifp; /* Disable wireless AP scanning */ ni_wireless_set_scanning(FALSE); if (!(nc = ni_global_state_handle(1))) ni_fatal("cannot refresh interface list!"); for (ifp = ni_netconfig_devlist(nc); ifp; ifp = ifp->next) { if(!ni_autoip4_supported(ifp)) continue; autoip4_device_create(server, ifp); if (opt_recover_state) autoip4_recover_state(ifp); } } /* * Implement AUTO4 supplicant dbus service */ void autoip4_supplicant(void) { autoip4_dbus_server = ni_server_listen_dbus(NI_OBJECTMODEL_DBUS_BUS_NAME_AUTO4); if (autoip4_dbus_server == NULL) ni_fatal("unable to initialize dbus service"); ni_objectmodel_autoip4_init(); autoip4_register_services(autoip4_dbus_server); /* open global RTNL socket to listen for kernel events */ if (ni_server_listen_interface_events(autoip4_interface_event) < 0) ni_fatal("unable to initialize netlink listener"); if (!opt_foreground) { ni_daemon_close_t close_flags = NI_DAEMON_CLOSE_STD; if (ni_string_startswith(opt_log_target, "stderr")) close_flags &= ~NI_DAEMON_CLOSE_ERR; if (ni_server_background(program_name, close_flags) < 0) ni_fatal("unable to background server"); } while (!ni_caught_terminal_signal()) { long timeout; do { timeout = ni_timer_next_timeout(); } while(ni_dbus_objects_garbage_collect()); if (ni_socket_wait(timeout) != 0) ni_fatal("ni_socket_wait failed"); } ni_server_deactivate_interface_events(); autoip4_device_destroy_all(autoip4_dbus_server); ni_dbus_objects_garbage_collect(); ni_socket_deactivate_all(); } /* * Handle network layer events. * FIXME: There should be some locking here, which prevents us from * calling event handlers on an interface that the admin is currently * mucking with manually. */ void autoip4_interface_event(ni_netdev_t *ifp, ni_event_t event) { ni_netconfig_t *nc = ni_global_state_handle(0); ni_netdev_t *ofp; switch (event) { case NI_EVENT_DEVICE_CREATE: /* check for duplicate ifindex */ ofp = ni_netdev_by_index(nc, ifp->link.ifindex); if (ofp && ofp != ifp) { ni_warn("duplicate ifindex in device-create event"); return; } /* Create dbus object */ if(ni_autoip4_supported(ifp)) autoip4_device_create(autoip4_dbus_server, ifp); break; case NI_EVENT_DEVICE_DELETE: /* Delete dbus object */ autoip4_device_destroy(autoip4_dbus_server, ifp); break; #if 0 case NI_EVENT_LINK_DOWN: case NI_EVENT_LINK_UP: ni_autoip_device_t *dev; dev = ni_autoip_device_by_index(ifp->link.ifindex); if (dev != NULL) ; #ifdef notyet /* FIXME: */ ni_autoip_device_event(dev, event); #endif #endif break; default: ; } } void autoip4_protocol_event(enum ni_lease_event ev, const ni_autoip_device_t *dev, ni_addrconf_lease_t *lease) { ni_dbus_variant_t argv[1]; ni_dbus_object_t *dev_object; int argc = 0; ni_debug_autoip("%s(ev=%u, dev=%d)", __func__, ev, dev->link.ifindex); dev_object = ni_dbus_server_find_object_by_handle(autoip4_dbus_server, dev); if (dev_object == NULL) { ni_warn("%s: no dbus object for device %s!", __func__, dev->ifname); return; } memset(argv, 0, sizeof(argv)); if (lease) { ni_dbus_variant_t *var = &argv[argc++]; ni_dbus_variant_init_dict(var); if (!ni_objectmodel_get_addrconf_lease(lease, var)) { ni_warn("%s: could not extract lease data", __func__); goto done; } } switch (ev) { case NI_EVENT_LEASE_ACQUIRED: if (lease == NULL) { ni_error("BUG: cannot send %s event without a lease handle", NI_OBJECTMODEL_LEASE_ACQUIRED_SIGNAL); goto done; } ni_dbus_server_send_signal(autoip4_dbus_server, dev_object, NI_OBJECTMODEL_ADDRCONF_INTERFACE, NI_OBJECTMODEL_LEASE_ACQUIRED_SIGNAL, argc, argv); break; case NI_EVENT_LEASE_RELEASED: ni_dbus_server_send_signal(autoip4_dbus_server, dev_object, NI_OBJECTMODEL_ADDRCONF_INTERFACE, NI_OBJECTMODEL_LEASE_RELEASED_SIGNAL, argc, argv); break; case NI_EVENT_LEASE_LOST: ni_dbus_server_send_signal(autoip4_dbus_server, dev_object, NI_OBJECTMODEL_ADDRCONF_INTERFACE, NI_OBJECTMODEL_LEASE_LOST_SIGNAL, argc, argv); break; default: ; } done: while (argc--) ni_dbus_variant_destroy(&argv[argc]); }
pwieczorkiewicz/wicked
autoip4/main.c
C
gpl-2.0
13,954
/* * $Id: db_row.c,v 1.13.6.1 2004/03/05 18:00:34 janakj Exp $ * * MySQL module row related functions * * Copyright (C) 2001-2003 Fhg Fokus * * This file is part of ser, a free SIP server. * * ser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version * * For a license to use the ser software under conditions * other than those described here, or to purchase support for this * software, please contact iptel.org by e-mail at the following addresses: * info@iptel.org * * ser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <mysql.h> #include "../../db/db_row.h" #include "../../dprint.h" #include "../../mem/mem.h" #include "defs.h" #include "db_val.h" #include "con_mysql.h" /* * Convert a row from result into db API representation */ int convert_row(db_con_t* _h, db_res_t* _res, db_row_t* _r) { unsigned long* lengths; int i; #ifndef PARANOID if ((!_h) || (!_r) || (!_n)) { log(L_ERR, "convert_row(): Invalid parameter value\n"); return -1; } #endif ROW_VALUES(_r) = (db_val_t*)pkg_malloc(sizeof(db_val_t) * RES_COL_N(_res)); ROW_N(_r) = RES_COL_N(_res); if (!ROW_VALUES(_r)) { LOG(L_ERR, "convert_row(): No memory left\n"); return -1; } lengths = mysql_fetch_lengths(CON_RESULT(_h)); for(i = 0; i < RES_COL_N(_res); i++) { if (str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]), ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i]) < 0) { LOG(L_ERR, "convert_row(): Error while converting value\n"); free_row(_r); return -3; } } return 0; } /* * Release memory used by row */ int free_row(db_row_t* _r) { #ifndef PARANOID if (!_r) { LOG(L_ERR, "free_row(): Invalid parameter value\n"); return -1; } #endif if (ROW_VALUES(_r)) pkg_free(ROW_VALUES(_r)); return 0; }
scs/uclinux
user/ser/modules/mysql/db_row.c
C
gpl-2.0
2,330
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>CRAN - Package eLNNpaired</title> <link rel="stylesheet" type="text/css" href="../../CRAN_web.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> table td { vertical-align: top; } </style> </head> <body> <h2>eLNNpaired: Model-Based Gene Clustering for Genomics Data from Paired/Matched Designs</h2> <p>Perform model based gene clustering for genomics data generated from paired/matched design based on mixture of extended lognormal normal Bayesian hierarchical models (See Li Y, Morrow J, Raby B, Tantisira K, Weiss ST, Huang W, Qiu W. (2017), &lt;<a href="http://dx.doi.org/10.1371/journal.pone.0174602">doi:10.1371/journal.pone.0174602</a>&gt;).</p> <table summary="Package eLNNpaired summary"> <tr> <td>Version:</td> <td>0.2.3</td> </tr> <tr> <td>Depends:</td> <td>R (&ge; 3.3.0), <a href="http://www.bioconductor.org/packages/release/bioc/html/Biobase.html"><span class="BioC">Biobase</span></a>, stats</td> </tr> <tr> <td>Imports:</td> <td>graphics, methods, utils, <a href="http://www.bioconductor.org/packages/release/bioc/html/iCheck.html"><span class="BioC">iCheck</span></a>, <a href="../samr/index.html">samr</a>, <a href="http://www.bioconductor.org/packages/release/bioc/html/GSEAlm.html"><span class="BioC">GSEAlm</span></a>, <a href="http://www.bioconductor.org/packages/release/bioc/html/globaltest.html"><span class="BioC">globaltest</span></a></td> </tr> <tr> <td>Published:</td> <td>2017-04-09</td> </tr> <tr> <td>Author:</td> <td>Yunfeng Li and Weiliang Qiu</td> </tr> <tr> <td>Maintainer:</td> <td>Yunfeng Li &#x3c;&#x63;&#x6f;&#x6c;&#x69;&#x6e;&#x6c;&#x65;&#x65;&#x31;&#x39;&#x39;&#x39;&#x20;&#x61;&#x74;&#x20;&#x67;&#x6d;&#x61;&#x69;&#x6c;&#x2e;&#x63;&#x6f;&#x6d;&#x3e;</td> </tr> <tr> <td>License:</td> <td><a href="../../licenses/GPL-2">GPL-2</a> | <a href="../../licenses/GPL-3">GPL-3</a> [expanded from: GPL (&ge; 2)]</td> </tr> <tr> <td>NeedsCompilation:</td> <td>no</td> </tr> <tr> <td>Materials:</td> <td><a href="NEWS">NEWS</a> </td> </tr> <tr> <td>CRAN&nbsp;checks:</td> <td><a href="../../checks/check_results_eLNNpaired.html">eLNNpaired results</a></td> </tr> </table> <h4>Downloads:</h4> <table summary="Package eLNNpaired downloads"> <tr> <td> Reference&nbsp;manual: </td> <td> <a href="eLNNpaired.pdf"> eLNNpaired.pdf </a> </td> </tr> <tr> <td> Package&nbsp;source: </td> <td> <a href="../../../src/contrib/eLNNpaired_0.2.3.tar.gz"> eLNNpaired_0.2.3.tar.gz </a> </td> </tr> <tr> <td> Windows&nbsp;binaries: </td> <td> r-devel: <a href="../../../bin/windows/contrib/3.5/eLNNpaired_0.2.3.zip">eLNNpaired_0.2.3.zip</a>, r-release: <a href="../../../bin/windows/contrib/3.4/eLNNpaired_0.2.3.zip">eLNNpaired_0.2.3.zip</a>, r-oldrel: <a href="../../../bin/windows/contrib/3.3/eLNNpaired_0.2.3.zip">eLNNpaired_0.2.3.zip</a> </td> </tr> <tr> <td> OS&nbsp;X&nbsp;El&nbsp;Capitan&nbsp;binaries: </td> <td> r-release: not available </td> </tr> <tr> <td> OS&nbsp;X&nbsp;Mavericks&nbsp;binaries: </td> <td> r-oldrel: <a href="../../../bin/macosx/mavericks/contrib/3.3/eLNNpaired_0.2.3.tgz">eLNNpaired_0.2.3.tgz</a> </td> </tr> </table> <h4>Linking:</h4> <p>Please use the canonical form <a href="https://CRAN.R-project.org/package=eLNNpaired"><samp>https://CRAN.R-project.org/package=eLNNpaired</samp></a> to link to this page.</p> </body> </html>
esander91/NamespacePollution
Code/GetMetaDataFromCRAN/raw_html/eLNNpaired.html
HTML
gpl-2.0
3,493
<?php // $Revision: 2.0 $ /************************************************************************/ /* phpAdsNew 2 */ /* =========== */ /* */ /* Copyright (c) 2000-2002 by the phpAdsNew developers */ /* For more information visit: http://www.phpadsnew.com */ /* */ /* */ /* */ /* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ $GLOBALS['strPluginAffiliate'] = "ÇØ´ç ±¤°í°Ô½ÃÀÚÀÇ ±â·Ï ¸ñ·ÏÀ» »ý¼ºÇÕ´Ï´Ù. º¸°í¼­´Â ½ºÇÁ·¹µå ½ÃÆ®¸¦ À§ÇØ CSV Çü½ÄÀ» »ç¿ëÇÕ´Ï´Ù."; $GLOBALS['strPluginCampaign'] = "ÇØ´ç Ä·ÆäÀÎÀÇ ±â·Ï ¸ñ·ÏÀ» »ý¼ºÇÕ´Ï´Ù. º¸°í¼­´Â ½ºÇÁ·¹µå ½ÃÆ®¸¦ À§ÇØ CSV Çü½ÄÀ» »ç¿ëÇÕ´Ï´Ù."; $GLOBALS['strPluginClient'] = "ÇØ´ç ±¤°íÁÖÀÇ ±â·Ï ¸ñ·ÏÀ» »ý¼ºÇÕ´Ï´Ù. º¸°í¼­´Â ½ºÇÁ·¹µå ½ÃÆ®¸¦ À§ÇØ CSV Çü½ÄÀ» »ç¿ëÇÕ´Ï´Ù."; $GLOBALS['strPluginGlobal'] = "Àüü ±â·Ï ¸ñ·ÏÀ» »ý¼ºÇÕ´Ï´Ù. º¸°í¼­´Â ½ºÇÁ·¹µå ½ÃÆ®¸¦ À§ÇØ CSV Çü½ÄÀ» »ç¿ëÇÕ´Ï´Ù."; $GLOBALS['strPluginZone'] = "¼±ÅÃÇÑ ¿µ¿ªÀÇ ±â·Ï ¸ñ·ÏÀ» »ý¼ºÇÕ´Ï´Ù. º¸°í¼­´Â ½ºÇÁ·¹µå ½ÃÆ®¸¦ À§ÇØ CSV Çü½ÄÀ» »ç¿ëÇÕ´Ï´Ù."; ?>
miller-tamil/openads-plus
language/korean/report.lang.php
PHP
gpl-2.0
1,635
/* * Copyright (c) 1998-2011 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Resin Open Source 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, or any warranty * of NON-INFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the * Free SoftwareFoundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * * @author Scott Ferguson */ package com.caucho.jsp.java; import com.caucho.jsp.JspParseException; import com.caucho.server.util.CauchoSystem; import com.caucho.util.L10N; import com.caucho.vfs.WriteStream; import com.caucho.xml.QName; import javax.servlet.jsp.HttpJspPage; import java.io.IOException; import java.util.ArrayList; import java.util.Locale; import java.util.logging.*; public class JspDirectivePage extends JspNode { private static final Logger log = Logger.getLogger(JspDirectivePage.class.getName()); static L10N L = new L10N(JspDirectivePage.class); private static final QName IS_EL_IGNORED = new QName("isELIgnored"); private static final QName IS_VELOCITY_ENABLED = new QName("isVelocityEnabled"); private static final QName INFO = new QName("info"); private static final QName CONTENT_TYPE = new QName("contentType"); private static final QName PAGE_ENCODING = new QName("pageEncoding"); private static final QName LANGUAGE = new QName("language"); private static final QName IMPORT = new QName("import"); private static final QName SESSION = new QName("session"); private static final QName BUFFER = new QName("buffer"); private static final QName ERROR_PAGE = new QName("errorPage"); private static final QName IS_ERROR_PAGE = new QName("isErrorPage"); private static final QName AUTO_FLUSH = new QName("autoFlush"); private static final QName IS_THREAD_SAFE = new QName("isThreadSafe"); private static final QName EXTENDS = new QName("extends"); private static final QName TRIM_WS = new QName("trimDirectiveWhitespaces"); private static final QName DEFER = new QName("deferredSyntaxAllowedAsLiteral"); /** * Adds an attribute. * * @param name the attribute name * @param value the attribute value */ public void addAttribute(QName name, String value) throws JspParseException { if (IS_EL_IGNORED.equals(name)) { boolean isIgnored = value.equals("true"); if (_parseState.isELIgnoredPageSpecified() && isIgnored != _parseState.isELIgnored()) throw error(L.l("isELIgnored values conflict")); _parseState.setELIgnored(isIgnored); _parseState.setELIgnoredPageSpecified(true); } /* else if (name.equals("isScriptingInvalid")) _parseState.setScriptingInvalid(value.equals("true")); */ else if (IS_VELOCITY_ENABLED.equals(name)) _parseState.setVelocityEnabled(value.equals("true")); else if (INFO.equals(name)) { String oldInfo = _parseState.getInfo(); if (oldInfo != null && ! value.equals(oldInfo)) throw error(L.l("info '{0}' conflicts with previous value of info '{1}'. Check the .jsp and any included .jsp files for conflicts.", value, oldInfo)); _parseState.setInfo(value); } else if (CONTENT_TYPE.equals(name)) { String oldContentType = _parseState.getContentType(); if (oldContentType != null && ! value.equals(oldContentType)) throw error(L.l("contentType '{0}' conflicts with previous value of contentType '{1}'. Check the .jsp and any included .jsp files for conflicts.", value, oldContentType)); _parseState.setContentType(value); String charEncoding = parseCharEncoding(value); if (charEncoding != null) _parseState.setCharEncoding(charEncoding); } else if (PAGE_ENCODING.equals(name)) { String oldEncoding = _parseState.getPageEncoding(); /* // jsp/01f1 if (oldEncoding != null) { String oldCanonical = Encoding.getMimeName(oldEncoding); String newCanonical = Encoding.getMimeName(value); if (! newCanonical.equals(oldCanonical)) throw error(L.l("pageEncoding '{0}' conflicts with previous value of pageEncoding '{1}'. Check the .jsp and any included .jsp files for conflicts.", value, oldEncoding)); } */ try { _parseState.setPageEncoding(value); // _parseState.setCharEncoding(value); } catch (JspParseException e) { log.log(Level.FINER, e.toString(), e); throw error(e.getMessage()); } } else if (LANGUAGE.equals(name)) { if (! value.equals("java")) throw error(L.l("'{0}' is not supported as a JSP scripting language.", value)); } else if (IMPORT.equals(name)) { _parseState.addImport(value); } else if (SESSION.equals(name)) { boolean isValid = false; if (value.equals("true")) isValid = _parseState.setSession(true); else if (value.equals("false")) isValid = _parseState.setSession(false); else throw error(L.l("session expects 'true' or 'false' at '{0}'", value)); _parseState.markSessionSet(); if (! isValid) throw error(L.l("session is assigned different values.")); } else if (BUFFER.equals(name)) { boolean isValid = _parseState.setBuffer(processBufferSize(value)); _parseState.markBufferSet(); if (! isValid) throw error(L.l("buffer is assigned different values.")); if (_parseState.getBuffer() == 0 && ! _parseState.isAutoFlush()) throw error(L.l("buffer must be non-zero when autoFlush is false.")); } else if (ERROR_PAGE.equals(name)) { String errorPage = _parseState.getErrorPage(); String newErrorPage = getRelativeUrl(value); _parseState.setErrorPage(newErrorPage); if (errorPage != null && ! errorPage.equals(newErrorPage)) { _parseState.setErrorPage(null); throw error(L.l("errorPage is assigned different value '{0}'.", newErrorPage)); } } else if (IS_ERROR_PAGE.equals(name)) { boolean isValid = false; if (value.equals("true")) isValid = _parseState.setErrorPage(true); else if (value.equals("false")) isValid = _parseState.setErrorPage(false); else throw error(L.l("isErrorPage expects 'true' or 'false' at '{0}'", value)); _parseState.markErrorPage(); if (! isValid) throw error(L.l("isErrorPage is assigned different values.")); } else if (AUTO_FLUSH.equals(name)) { boolean isValid = false; if (value.equals("true")) isValid = _parseState.setAutoFlush(true); else if (value.equals("false")) isValid = _parseState.setAutoFlush(false); else throw error(L.l("autoFlush expects 'true' or 'false' at '{0}'", value)); if (! isValid) throw error(L.l("autoFlush is assigned different values.")); if (_parseState.getBuffer() == 0 && ! _parseState.isAutoFlush()) throw error(L.l("buffer must be non-zero when autoFlush is false.")); _parseState.markAutoFlushSet(); } else if (IS_THREAD_SAFE.equals(name)) { boolean isValid = false; if (value.equals("true")) isValid = _parseState.setThreadSafe(true); else if (value.equals("false")) isValid = _parseState.setThreadSafe(false); else throw error(L.l("isThreadSafe expects 'true' or 'false' at '{0}'", value)); _parseState.markThreadSafeSet(); if (! isValid) throw error(L.l("isThreadSafe is assigned different values.")); } else if (EXTENDS.equals(name)) { Class cl = null; try { cl = CauchoSystem.loadClass(value); } catch (Exception e) { throw error(e); } if (! HttpJspPage.class.isAssignableFrom(cl)) throw error(L.l("'{0}' must implement HttpJspPage. The class named by jsp:directive.page extends='...' must implement HttpJspPage.", value)); Class oldExtends = _parseState.getExtends(); if (oldExtends != null && ! cl.equals(oldExtends)) throw error(L.l("extends '{0}' conflicts with previous value of extends '{1}'. Check the .jsp and any included .jsp files for conflicts.", value, oldExtends.getName())); _parseState.setExtends(cl); } else if (TRIM_WS.equals(name)) { if (value.equals("true")) _parseState.setTrimWhitespace(true); else if (value.equals("false")) _parseState.setTrimWhitespace(false); else throw error(L.l("trimDirectiveWhitespaces expects 'true' or 'false' at '{0}'", value)); } else if (DEFER.equals(name)) { if (value.equals("true")) _parseState.setDeferredSyntaxAllowedAsLiteral(true); else if (value.equals("false")) _parseState.setDeferredSyntaxAllowedAsLiteral(false); else throw error(L.l("deferredSyntaxAllowedAsLiteral expects 'true' or 'false' at '{0}'", value)); } else { throw error(L.l("'{0}' is an unknown JSP page directive attribute. See the JSP documentation for a complete list of page directive attributes.", name.getName())); } } /** * Parses the buffer size directive, grabbing the size out from the units. * * @param value buffer size string. * @return the size of the buffer in kb. */ private int processBufferSize(String value) throws JspParseException { if (value.equals("none")) return 0; int i = 0; int kb = 0; for (; i < value.length(); i++) { char ch = value.charAt(i); if (ch >= '0' && ch <= '9') kb = 10 * kb + ch - '0'; else break; } if (! value.substring(i).equals("kb")) throw error(L.l("Expected buffer size at '{0}'. Buffer sizes must end in 'kb'", value)); return 1024 * kb; } protected String getRelativeUrl(String value) { if (value.length() > 0 && value.charAt(0) == '/') return value; else return _parseState.getUriPwd() + value; } /** * Charset can be specific as follows: * test/html; z=9; charset=utf8; w=12 */ static String parseCharEncoding(String type) throws JspParseException { type = type.toLowerCase(Locale.ENGLISH); int i; char ch; while ((i = type.indexOf(';')) >= 0 && i < type.length()) { i++; while (i < type.length() && ((ch = type.charAt(i)) == ' ' || ch == '\t')) i++; if (i >= type.length()) return null; type = type.substring(i); i = type.indexOf('='); if (i >= 0) { if (! type.startsWith("charset")) continue; for (i++; i < type.length() && ((ch = type.charAt(i)) == ' ' || ch == '\t'); i++) { } type = type.substring(i); } for (i = 0; i < type.length() && (ch = type.charAt(i)) != ';' && ch != ' '; i++) { } return type.substring(0, i); } return null; } /** * Called when the tag ends. */ public void endAttributes() throws JspParseException { if (_gen.isTag()) throw error(L.l("page directives are forbidden in tags.")); } /** * Return true if the node only has static text. */ public boolean isStatic() { return true; } /** * Generates the XML text representation for the tag validation. * * @param os write stream to the generated XML. */ public void printXml(WriteStream os) throws IOException { os.print("<jsp:directive.page"); printJspId(os); if (! _parseState.isELIgnored()) os.print(" el-ignored='false'"); /* if (! _parseState.isScriptingEnabled()) os.print(" scripting-enabled='false'"); */ if (_parseState.getContentType() != null) os.print(" content-type='" + _parseState.getContentType() + "'"); ArrayList<String> imports = _parseState.getImportList(); if (imports != null && imports.size() != 0) { os.print(" import='"); for (int i = 0; i < imports.size(); i++) { if (i != 0) os.print(','); os.print(imports.get(i)); } os.print("'"); } os.print("/>"); } /** * Generates the code for the tag * * @param out the output writer for the generated java. */ public void generate(JspJavaWriter out) throws Exception { } }
dlitz/resin
modules/resin/src/com/caucho/jsp/java/JspDirectivePage.java
Java
gpl-2.0
13,277
<?php /** * SportsPress Meta Boxes * * Sets up the write panels used by custom post types * * @author ThemeBoy * @category Admin * @package SportsPress/Admin/Meta_Boxes * @version 1.3.1 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * SP_Admin_Meta_Boxes */ class SP_Admin_Meta_Boxes { /** * Constructor */ public function __construct() { add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 ); add_action( 'add_meta_boxes', array( $this, 'rename_meta_boxes' ), 20 ); add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 ); add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 ); // Save Result Meta Boxes add_action( 'sportspress_process_sp_result_meta', 'SP_Meta_Box_Result_Details::save', 10, 2 ); // Save Outcome Meta Boxes add_action( 'sportspress_process_sp_outcome_meta', 'SP_Meta_Box_Outcome_Details::save', 10, 2 ); // Save Metric Meta Boxes add_action( 'sportspress_process_sp_metric_meta', 'SP_Meta_Box_Metric_Details::save', 10, 2 ); // Save Performance Meta Boxes add_action( 'sportspress_process_sp_performance_meta', 'SP_Meta_Box_Performance_Details::save', 10, 2 ); // Save Statistic Meta Boxes add_action( 'sportspress_process_sp_statistic_meta', 'SP_Meta_Box_Statistic_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_statistic_meta', 'SP_Meta_Box_Statistic_Equation::save', 20, 2 ); // Save Column Meta Boxes add_action( 'sportspress_process_sp_column_meta', 'SP_Meta_Box_Column_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_column_meta', 'SP_Meta_Box_Column_Equation::save', 20, 2 ); // Save Event Meta Boxes add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Format::save', 10, 2 ); add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Details::save', 20, 2 ); add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Teams::save', 30, 2 ); add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Video::save', 40, 2 ); add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Results::save', 50, 2 ); add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Performance::save', 60, 2 ); // Save Calendar Meta Boxes add_action( 'sportspress_process_sp_calendar_meta', 'SP_Meta_Box_Calendar_Format::save', 10, 2 ); add_action( 'sportspress_process_sp_calendar_meta', 'SP_Meta_Box_Calendar_Details::save', 20, 2 ); add_action( 'sportspress_process_sp_calendar_meta', 'SP_Meta_Box_Calendar_Data::save', 30, 2 ); // Save Team Meta Boxes add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Columns::save', 20, 2 ); add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Lists::save', 30, 2 ); add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Tables::save', 40, 2 ); // Save Table Meta Boxes add_action( 'sportspress_process_sp_table_meta', 'SP_Meta_Box_Table_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_table_meta', 'SP_Meta_Box_Table_Data::save', 20, 2 ); // Save Player Meta Boxes add_action( 'sportspress_process_sp_player_meta', 'SP_Meta_Box_Player_Columns::save', 10, 2 ); add_action( 'sportspress_process_sp_player_meta', 'SP_Meta_Box_Player_Details::save', 20, 2 ); add_action( 'sportspress_process_sp_player_meta', 'SP_Meta_Box_Player_Metrics::save', 30, 2 ); add_action( 'sportspress_process_sp_player_meta', 'SP_Meta_Box_Player_Statistics::save', 40, 2 ); // Save List Meta Boxes add_action( 'sportspress_process_sp_list_meta', 'SP_Meta_Box_List_Format::save', 10, 2 ); add_action( 'sportspress_process_sp_list_meta', 'SP_Meta_Box_List_Columns::save', 20, 2 ); add_action( 'sportspress_process_sp_list_meta', 'SP_Meta_Box_List_Details::save', 30, 2 ); add_action( 'sportspress_process_sp_list_meta', 'SP_Meta_Box_List_Data::save', 40, 2 ); // Save Staff Meta Boxes add_action( 'sportspress_process_sp_staff_meta', 'SP_Meta_Box_Staff_Details::save', 10, 2 ); } /** * Add SP Meta boxes */ public function add_meta_boxes() { global $post; // Get post meta array if ( isset( $post ) && isset( $post->ID ) ) $post_meta = get_post_meta( $post->ID ); else $post_meta = array(); // Results add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Result_Details::output', 'sp_result', 'normal', 'high' ); // Outcomes add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Outcome_Details::output', 'sp_outcome', 'normal', 'high' ); // Columns add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Column_Details::output', 'sp_column', 'side', 'default' ); add_meta_box( 'sp_equationdiv', __( 'Equation', 'sportspress' ), 'SP_Meta_Box_Column_Equation::output', 'sp_column', 'normal', 'high' ); // Metrics add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Metric_Details::output', 'sp_metric', 'normal', 'high' ); // Performance add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Performance_Details::output', 'sp_performance', 'normal', 'high' ); // Statistics add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Statistic_Details::output', 'sp_statistic', 'side', 'default' ); add_meta_box( 'sp_equationdiv', __( 'Equation', 'sportspress' ), 'SP_Meta_Box_Statistic_Equation::output', 'sp_statistic', 'normal', 'high' ); // Events add_meta_box( 'sp_shortcodediv', __( 'Shortcodes', 'sportspress' ), 'SP_Meta_Box_Event_Shortcode::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' ); if ( sizeof( array_filter( sp_array_value( $post_meta, 'sp_team', array() ) ) ) ): add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' ); add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' ); endif; add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'low' ); // Calendars add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_Calendar_Shortcode::output', 'sp_calendar', 'side', 'default' ); add_meta_box( 'sp_formatdiv', __( 'Layout', 'sportspress' ), 'SP_Meta_Box_Calendar_Format::output', 'sp_calendar', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Calendar_Details::output', 'sp_calendar', 'side', 'default' ); add_meta_box( 'sp_datadiv', __( 'Events', 'sportspress' ), 'SP_Meta_Box_Calendar_Data::output', 'sp_calendar', 'normal', 'high' ); add_meta_box( 'sp_editordiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_Calendar_Editor::output', 'sp_calendar', 'normal', 'low' ); // Teams add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Team_Details::output', 'sp_team', 'side', 'default' ); if ( isset( $post ) && isset( $post->ID ) ): add_meta_box( 'sp_listsdiv', __( 'Player Lists', 'sportspress' ), 'SP_Meta_Box_Team_Lists::output', 'sp_team', 'normal', 'high' ); add_meta_box( 'sp_tablesdiv', __( 'League Tables', 'sportspress' ), 'SP_Meta_Box_Team_Tables::output', 'sp_team', 'normal', 'high' ); add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'SP_Meta_Box_Team_Columns::output', 'sp_team', 'normal', 'high' ); endif; add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Team_Editor::output', 'sp_team', 'normal', 'low' ); // Tables add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_Table_Shortcode::output', 'sp_table', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Table_Details::output', 'sp_table', 'side', 'default' ); add_meta_box( 'sp_datadiv', __( 'League Table', 'sportspress' ), 'SP_Meta_Box_Table_Data::output', 'sp_table', 'normal', 'high' ); add_meta_box( 'sp_editordiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_Table_Editor::output', 'sp_table', 'normal', 'low' ); // Players add_meta_box( 'sp_shortcodediv', __( 'Shortcodes', 'sportspress' ), 'SP_Meta_Box_Player_Shortcode::output', 'sp_player', 'side', 'default' ); add_meta_box( 'sp_columnsdiv', __( 'Columns', 'sportspress' ), 'SP_Meta_Box_Player_Columns::output', 'sp_player', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Player_Details::output', 'sp_player', 'side', 'default' ); add_meta_box( 'sp_metricsdiv', __( 'Metrics', 'sportspress' ), 'SP_Meta_Box_Player_Metrics::output', 'sp_player', 'side', 'default' ); if ( isset( $post ) && isset( $post->ID ) ): add_meta_box( 'sp_statisticsdiv', __( 'Statistics', 'sportspress' ), 'SP_Meta_Box_Player_Statistics::output', 'sp_player', 'normal', 'high' ); endif; add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Player_Editor::output', 'sp_player', 'normal', 'low' ); // Lists add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_List_Shortcode::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_formatdiv', __( 'Layout', 'sportspress' ), 'SP_Meta_Box_List_Format::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_columnsdiv', __( 'Columns', 'sportspress' ), 'SP_Meta_Box_List_Columns::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_List_Details::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_datadiv', __( 'Player List', 'sportspress' ), 'SP_Meta_Box_List_Data::output', 'sp_list', 'normal', 'high' ); add_meta_box( 'sp_editordiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_List_Editor::output', 'sp_list', 'normal', 'low' ); // Staff add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Staff_Details::output', 'sp_staff', 'side', 'default' ); add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Staff_Editor::output', 'sp_staff', 'normal', 'low' ); } /** * Remove bloat */ public function remove_meta_boxes() { // Events remove_meta_box( 'sp_venuediv', 'sp_event', 'side' ); remove_meta_box( 'sp_leaguediv', 'sp_event', 'side' ); remove_meta_box( 'sp_seasondiv', 'sp_event', 'side' ); // Calendars remove_meta_box( 'sp_seasondiv', 'sp_calendar', 'side' ); remove_meta_box( 'sp_leaguediv', 'sp_calendar', 'side' ); remove_meta_box( 'sp_venuediv', 'sp_calendar', 'side' ); // Teams remove_meta_box( 'sp_leaguediv', 'sp_team', 'side' ); remove_meta_box( 'sp_seasondiv', 'sp_team', 'side' ); remove_meta_box( 'sp_venuediv', 'sp_team', 'side' ); // Tables remove_meta_box( 'sp_seasondiv', 'sp_table', 'side' ); remove_meta_box( 'sp_leaguediv', 'sp_table', 'side' ); // Players remove_meta_box( 'sp_seasondiv', 'sp_player', 'side' ); remove_meta_box( 'sp_leaguediv', 'sp_player', 'side' ); remove_meta_box( 'sp_positiondiv', 'sp_player', 'side' ); // Lists remove_meta_box( 'sp_seasondiv', 'sp_list', 'side' ); remove_meta_box( 'sp_leaguediv', 'sp_list', 'side' ); // Staff remove_meta_box( 'sp_seasondiv', 'sp_staff', 'side' ); remove_meta_box( 'sp_leaguediv', 'sp_staff', 'side' ); } /** * Rename core meta boxes */ public function rename_meta_boxes() { global $post; // Publish/Event if ( isset( $post ) ) { remove_meta_box( 'submitdiv', 'sp_event', 'side' ); add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' ); } } /** * Check if we're saving, then trigger an action based on the post type * * @param int $post_id * @param object $post */ public function save_meta_boxes( $post_id, $post ) { if ( empty( $post_id ) || empty( $post ) ) return; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( is_int( wp_is_post_revision( $post ) ) ) return; if ( is_int( wp_is_post_autosave( $post ) ) ) return; if ( empty( $_POST['sportspress_meta_nonce'] ) || ! wp_verify_nonce( $_POST['sportspress_meta_nonce'], 'sportspress_save_data' ) ) return; if ( ! current_user_can( 'edit_post', $post_id ) ) return; if ( ! is_sp_post_type( $post->post_type ) && ! is_sp_config_type( $post->post_type ) ) return; do_action( 'sportspress_process_' . $post->post_type . '_meta', $post_id, $post ); } } new SP_Admin_Meta_Boxes();
phoebuzz/habsprospect
wp-content/plugins/sportspress/includes/admin/post-types/class-sp-admin-meta-boxes.php
PHP
gpl-2.0
13,147
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace CompanyDirectoryDF.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } }
Jricklefs/Employee-Directory
CompanyDirectoryDF/Controllers/HomeController.cs
C#
gpl-2.0
587
/* * @file glut_window.cpp * @Brief Glut-based window. * @author Fei Zhu * * This file is part of Physika, a versatile physics simulation library. * Copyright (C) 2013- Physika Group. * * This Source Code Form is subject to the terms of the GNU General Public License v2.0. * If a copy of the GPL was not distributed with this file, you can obtain one at: * http://www.gnu.org/licenses/gpl-2.0.html * */ #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <GL/glew.h> #include <GL/freeglut.h> #include "Physika_Core/Utilities/physika_assert.h" #include "Physika_Core/Utilities/physika_exception.h" #include "Physika_Core/Image/image.h" #include "Physika_IO/Image_IO/image_io.h" #include "Physika_GUI/Glut_Window/glut_window.h" #include "Physika_Render/OpenGL_Primitives/opengl_primitives.h" #include "Physika_Render/Lights/flash_light.h" namespace Physika{ GlutWindow::GlutWindow() :window_name_(std::string("Physika Glut Window")),window_id_(-1),initial_width_(640),initial_height_(480), display_fps_(true),screen_capture_file_index_(0),event_mode_(false) { background_color_ = Color<double>::Black(); text_color_ = Color<double>::White(); resetMouseState(); initCallbacks(); initOpenGLContext(); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); render_scene_config.setCameraAspect(static_cast<double>(initial_width_ / initial_height_)); //reset screen based render manager ScreenBasedRenderManager & render_manager = render_scene_config.screenBasedRenderManager(); render_manager.resetMsaaFBO(initial_width_, initial_height_); } GlutWindow::GlutWindow(const std::string &window_name) :window_name_(window_name),window_id_(-1),initial_width_(640),initial_height_(480), display_fps_(true),screen_capture_file_index_(0), event_mode_(false) { background_color_ = Color<double>::Black(); text_color_ = Color<double>::White(); resetMouseState(); initCallbacks(); initOpenGLContext(); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); render_scene_config.setCameraAspect(static_cast<double>(initial_width_ / initial_height_)); //reset screen based render manager ScreenBasedRenderManager & render_manager = render_scene_config.screenBasedRenderManager(); render_manager.resetMsaaFBO(initial_width_, initial_height_); } GlutWindow::GlutWindow(const std::string &window_name, unsigned int width, unsigned int height) :window_name_(window_name),window_id_(-1),initial_width_(width),initial_height_(height), display_fps_(true),screen_capture_file_index_(0), event_mode_(false) { background_color_ = Color<double>::Black(); text_color_ = Color<double>::White(); resetMouseState(); initCallbacks(); initOpenGLContext(); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); render_scene_config.setCameraAspect(static_cast<double>(initial_width_ / initial_height_)); //reset screen based render manager ScreenBasedRenderManager & render_manager = render_scene_config.screenBasedRenderManager(); render_manager.resetMsaaFBO(initial_width_, initial_height_); } GlutWindow::~GlutWindow() { } void GlutWindow::createWindow() { glutShowWindow(); glutSetWindowData(this); //bind 'this' pointer with the window glutDisplayFunc(display_function_); glutIdleFunc(idle_function_); glutReshapeFunc(reshape_function_); glutKeyboardFunc(keyboard_function_); glutSpecialFunc(special_function_); glutMotionFunc(motion_function_); glutMouseFunc(mouse_function_); glutMouseWheelFunc(mouse_wheel_function_); resetMouseState(); //reset the state of mouse every time the window is created (*init_function_)(); //call the init function before entering main loop if (event_mode_ == false) glutMainLoop(); } void GlutWindow::closeWindow() { glutLeaveMainLoop(); } const std::string& GlutWindow::name() const { return window_name_; } int GlutWindow::width() const { if(glutGet(GLUT_INIT_STATE)) //window is created return glutGet(GLUT_WINDOW_WIDTH); else return initial_width_; } int GlutWindow::height() const { if(glutGet(GLUT_INIT_STATE)) //window is created return glutGet(GLUT_WINDOW_HEIGHT); else return initial_height_; } void GlutWindow::enableEventMode() { this->event_mode_ = true; } void GlutWindow::disableEventMode() { this->event_mode_ = false; } ////////////////////////////////////////////////// screen shot and display frame-rate//////////////////////////////////////////////////////////////// bool GlutWindow::saveScreen(const std::string &file_name) const { int width = this->width(), height = this->height(); unsigned char *data = new unsigned char[width*height*3]; //RGB PHYSIKA_ASSERT(data); glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels(0,0,width,height,GL_RGB,GL_UNSIGNED_BYTE,(void*)data); Image image(width,height,Image::RGB,data); image.flipVertically(); bool status = ImageIO::save(file_name,&image); delete[] data; return status; } bool GlutWindow::saveScreen() { std::stringstream adaptor; adaptor<<screen_capture_file_index_++; std::string index_str; adaptor>>index_str; std::string file_name = std::string("screen_capture_") + index_str + std::string(".png"); return saveScreen(file_name); } void GlutWindow::displayFrameRate() const { if(!glutGet(GLUT_INIT_STATE)) //window is not created throw PhysikaException("Cannot display frame rate before a window is created."); if(display_fps_) { static unsigned int frame = 0, time = 0, time_base = 0; double fps = 60.0; ++frame; time = glutGet(GLUT_ELAPSED_TIME); //millisecond if(time - time_base > 10) // compute every 10 milliseconds { fps = frame*1000.0/(time-time_base); time_base = time; frame = 0; } std::stringstream adaptor; adaptor.precision(2); std::string str; if(fps>1.0) //show fps { adaptor<<fps; str = std::string("FPS: ") + adaptor.str(); } else //show spf { PHYSIKA_ASSERT(fps>0); adaptor<< 1.0/fps; str = std::string("SPF: ") + adaptor.str(); } //now draw the string int width = this->width(), height = this->height(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); gluOrtho2D(0,width,0,height); openGLColor3(text_color_); glRasterPos2i(5,height-19); glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_DEPTH_TEST); for (unsigned int i = 0; i < str.length(); i++) glutBitmapCharacter (GLUT_BITMAP_HELVETICA_18, str[i]); glPopAttrib(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glEnable(GL_LIGHTING); } } void GlutWindow::enableDisplayFrameRate() { display_fps_ = true; } void GlutWindow::disableDisplayFrameRate() { display_fps_ = false; } ////////////////////////////////////////////////// set custom callback functions //////////////////////////////////////////////////////////////////// void GlutWindow::setDisplayFunction(void (*func)(void)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; display_function_ = GlutWindow::displayFunction; } else display_function_ = func; } void GlutWindow::setIdleFunction(void (*func)(void)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; idle_function_ = GlutWindow::idleFunction; } else idle_function_ = func; } void GlutWindow::setReshapeFunction(void (*func)(int width, int height)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; reshape_function_ = GlutWindow::reshapeFunction; } else reshape_function_ = func; } void GlutWindow::setKeyboardFunction(void (*func)(unsigned char key, int x, int y)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; keyboard_function_ = GlutWindow::keyboardFunction; } else keyboard_function_ = func; } void GlutWindow::setSpecialFunction(void (*func)(int key, int x, int y)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; special_function_ = GlutWindow::specialFunction; } else special_function_ = func; } void GlutWindow::setMotionFunction(void (*func)(int x, int y)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; motion_function_ = GlutWindow::motionFunction; } else motion_function_ = func; } void GlutWindow::setMouseFunction(void (*func)(int button, int state, int x, int y)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; mouse_function_ = GlutWindow::mouseFunction; } else mouse_function_ = func; } void GlutWindow::setMouseWheelFunction(void(*func)(int wheel, int direction, int x, int y)) { if (func == NULL) { std::cerr << "NULL callback function provided, use default instead.\n"; mouse_wheel_function_ = GlutWindow::mouseWheelFunction; } else mouse_wheel_function_ = func; } void GlutWindow::setInitFunction(void (*func)(void)) { if(func==NULL) { std::cerr<<"NULL callback function provided, use default instead.\n"; init_function_ = GlutWindow::initFunction; } else init_function_ = func; } void GlutWindow::bindDefaultKeys(unsigned char key, int x, int y) { GlutWindow::keyboardFunction(key,x,y); } ////////////////////////////////////////////////// default callback functions //////////////////////////////////////////////////////////////////// void GlutWindow::displayFunction(void) { GlutWindow * cur_window = (GlutWindow*)glutGetWindowData(); Color<double> background_color = cur_window->background_color_; glClearColor(background_color.redChannel(), background_color.greenChannel(), background_color.blueChannel(), background_color.alphaChannel()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); ScreenBasedRenderManager & render_manager = render_scene_config.screenBasedRenderManager(); render_manager.render(); cur_window->displayFrameRate(); glutPostRedisplay(); glutSwapBuffers(); } void GlutWindow::idleFunction(void) { glutPostRedisplay(); } void GlutWindow::reshapeFunction(int width, int height) { GlutWindow *window = static_cast<GlutWindow*>(glutGetWindowData()); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); PHYSIKA_ASSERT(window); //update the view aspect of camera GLdouble aspect = static_cast<GLdouble>(width)/height; render_scene_config.setCameraAspect(aspect); //update view port glViewport(0, 0, width, height); //reset screen based render manager ScreenBasedRenderManager & render_manager = render_scene_config.screenBasedRenderManager(); render_manager.resetMsaaFBO(width, height); } void GlutWindow::keyboardFunction(unsigned char key, int x, int y) { GlutWindow *window = static_cast<GlutWindow*>(glutGetWindowData()); PHYSIKA_ASSERT(window); switch(key) { case 27: //ESC: close window glutLeaveMainLoop(); break; case 's': //s: save screen shot window->saveScreen(); break; case 'f': //f: enable/disable FPS display (window->display_fps_) = !(window->display_fps_); break; default: break; } } void GlutWindow::specialFunction(int key, int x, int y) { } void GlutWindow::motionFunction(int x, int y) { GlutWindow *window = static_cast<GlutWindow*>(glutGetWindowData()); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); PHYSIKA_ASSERT(window); int mouse_delta_x = x - window->mouse_position_[0]; int mouse_delta_y = y - window->mouse_position_[1]; window->mouse_position_[0] = x; window->mouse_position_[1] = y; double scale = 0.02; //sensitivity of the mouse double camera_radius = render_scene_config.cameraRadius(); if(window->left_button_down_) //left button handles camera rotation { render_scene_config.orbitCameraLeft(mouse_delta_x*scale); render_scene_config.orbitCameraUp(mouse_delta_y*scale); } if(window->middle_button_down_) //middle button handles camera zoom in/out { render_scene_config.zoomCameraIn(camera_radius*mouse_delta_y*scale); } if(window->right_button_down_) //right button handles camera translation { scale *= 0.1; render_scene_config.translateCameraLeft(camera_radius*mouse_delta_x*scale); render_scene_config.translateCameraUp(camera_radius*mouse_delta_y*scale); } } void GlutWindow::mouseFunction(int button, int state, int x, int y) { GlutWindow *window = static_cast<GlutWindow*>(glutGetWindowData()); PHYSIKA_ASSERT(window); switch(button) { case GLUT_LEFT_BUTTON: window->left_button_down_ = (state==GLUT_DOWN); break; case GLUT_MIDDLE_BUTTON: window->middle_button_down_ = (state==GLUT_DOWN); break; case GLUT_RIGHT_BUTTON: window->right_button_down_ = (state==GLUT_DOWN); break; default: //PHYSIKA_ERROR("Invalid mouse state."); break; } window->mouse_position_[0] = x; window->mouse_position_[1] = y; } void GlutWindow::mouseWheelFunction(int wheel, int direction, int x, int y) { GlutWindow *window = static_cast<GlutWindow*>(glutGetWindowData()); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); PHYSIKA_ASSERT(window); double scale = 0.02; //sensitivity of the mouse double camera_radius = render_scene_config.cameraRadius(); switch (direction) { case 1: //mouse wheel up: zoom out render_scene_config.zoomCameraOut(camera_radius*scale); break; case -1: //mouse wheel down: zoom in render_scene_config.zoomCameraIn(camera_radius*scale); break; default: break; } window->mouse_position_[0] = x; window->mouse_position_[1] = y; } void GlutWindow::initFunction(void) { int width = glutGet(GLUT_WINDOW_WIDTH); int height = glutGet(GLUT_WINDOW_HEIGHT); GlutWindow *window = static_cast<GlutWindow*>(glutGetWindowData()); PHYSIKA_ASSERT(window); glViewport(0, 0, width, height); // set the viewport window->initDefaultLight(); glShadeModel( GL_SMOOTH ); glClearDepth( 1.0 ); // specify the clear value for the depth buffer glEnable( GL_DEPTH_TEST ); glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); // specify implementation-specific hints Color<double> background_color = window->background_color_; glClearColor(background_color.redChannel(), background_color.greenChannel(), background_color.blueChannel(), background_color.alphaChannel()); } void GlutWindow::initOpenGLContext() { int argc = 1; const int max_length = 1024; //assume length of the window name does not exceed 1024 characters char *argv[1]; char name_str[max_length]; strcpy(name_str, window_name_.c_str()); argv[0] = name_str; glutInit(&argc, argv); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); //this option allows leaving the glut loop without exit program glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ALPHA); glutInitWindowSize(initial_width_, initial_height_); window_id_ = glutCreateWindow(window_name_.c_str()); glutHideWindow(); glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { std::cerr << "error: can't init glew!\n"; std::exit(EXIT_FAILURE); } std::cout << "openGL Version: " << glGetString(GL_VERSION) << std::endl; } void GlutWindow::initCallbacks() { //set callbacks to default callback functions display_function_ = GlutWindow::displayFunction; idle_function_ = GlutWindow::idleFunction; reshape_function_ = GlutWindow::reshapeFunction; keyboard_function_ = GlutWindow::keyboardFunction; special_function_ = GlutWindow::specialFunction; motion_function_ = GlutWindow::motionFunction; mouse_function_ = GlutWindow::mouseFunction; mouse_wheel_function_ = GlutWindow::mouseWheelFunction; init_function_ = GlutWindow::initFunction; } void GlutWindow::resetMouseState() { left_button_down_ = false; middle_button_down_ = false; right_button_down_ = false; mouse_position_[0] = mouse_position_[1] = 0; } void GlutWindow::initDefaultLight() { std::cout << "info: add default flash light!" << std::endl; std::shared_ptr<FlashLight> flash_light = std::make_shared<FlashLight>(); flash_light->setAmbient(Color4f::Gray()); RenderSceneConfig & render_scene_config = RenderSceneConfig::getSingleton(); render_scene_config.pushBackLight(std::move(flash_light)); } } //end of namespace Physika
suitmyself/Physika
Physika_Src/Physika_GUI/Glut_Window/glut_window.cpp
C++
gpl-2.0
17,741
# # # all: regexrock @echo DONE CFLAGS += -Wall regexrock: main.o $(CC) $(CFLAGS) -o $@ $^ -lpcre clean: rm -f *.o *.d *.dep rm -rf *.dSYM rm -f regexrock .PHONY: all clean
davll/airspf
regexrock/Makefile
Makefile
gpl-2.0
184
<?php /** * File containing the ezie module definition * * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 * @version 5.0.0 * @package ezie */ $Module = array( 'name' => 'ezie' ); $ViewList = array(); $ViewList['prepare'] = array('script' => 'prepare.php', 'params' => array( 'object_id', 'edit_language', 'attribute_id', 'version' ), ); // FILTERS $ViewList['filter_bw'] = array( 'script' => 'filter_bw.php' ); $ViewList['filter_sepia'] = array( 'script' => 'filter_sepia.php' ); $ViewList['filter_blur'] = array( 'script' => 'filter_blur.php' ); $ViewList['filter_contrast'] = array( 'script' => 'filter_contrast.php' ); $ViewList['filter_brightness'] = array( 'script' => 'filter_brightness.php' ); // TOOLS $ViewList['tool_flip_hor'] = array( 'script' => 'tool_flip_hor.php' ); $ViewList['tool_flip_ver'] = array( 'script' => 'tool_flip_ver.php' ); $ViewList['tool_rotation'] = array( 'script' => 'tool_rotation.php' ); $ViewList['tool_levels'] = array( 'script' => 'tool_levels.php' ); $ViewList['tool_saturation'] = array( 'script' => 'tool_saturation.php' ); $ViewList['tool_pixelate'] = array( 'script' => 'tool_pixelate.php' ); $ViewList['tool_crop'] = array( 'script' => 'tool_crop.php' ); $ViewList['tool_watermark'] = array( 'script' => 'tool_watermark.php' ); // MENU ACTIONS $ViewList['no_save_and_quit'] = array('script' => 'no_save_and_quit.php'); $ViewList['save_and_quit'] = array('script' => 'save_and_quit.php'); $FunctionList = array(); ?>
medbenhenda/migration-ez5
ezpublish_legacy/extension/ezie/modules/ezie/module.php
PHP
gpl-2.0
1,651
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # MYSQL_ADD_PLUGIN(plugin_name source1...sourceN # [STORAGE_ENGINE] # [MANDATORY|DEFAULT] # [STATIC_ONLY|DYNAMIC_ONLY] # [MODULE_OUTPUT_NAME module_name] # [STATIC_OUTPUT_NAME static_name] # [RECOMPILE_FOR_EMBEDDED] # [LINK_LIBRARIES lib1...libN] # [DEPENDENCIES target1...targetN] # Append collections files for the plugin to the common files # Make sure we don't copy twice if running cmake again MACRO(PLUGIN_APPEND_COLLECTIONS plugin) SET(fcopied "${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/FilesCopied") IF(NOT EXISTS ${fcopied}) FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*) FOREACH(cfile ${collections}) FILE(READ ${cfile} contents) GET_FILENAME_COMPONENT(fname ${cfile} NAME) FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}") FILE(APPEND ${fcopied} "${fname}\n") MESSAGE(STATUS "Appended ${cfile}") ENDFOREACH() ENDIF() ENDMACRO() MACRO(MYSQL_ADD_PLUGIN) MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT" "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED" ${ARGN} ) # Add common include directories INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex ${SSL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) LIST(GET ARG_DEFAULT_ARGS 0 plugin) SET(SOURCES ${ARG_DEFAULT_ARGS}) LIST(REMOVE_AT SOURCES 0) STRING(TOUPPER ${plugin} plugin) STRING(TOLOWER ${plugin} target) # Figure out whether to build plugin IF(WITH_PLUGIN_${plugin}) SET(WITH_${plugin} 1) ENDIF() IF(WITH_MAX_NO_NDB) SET(WITH_MAX 1) SET(WITHOUT_NDBCLUSTER 1) ENDIF() IF(ARG_DEFAULT) IF(NOT DEFINED WITH_${plugin} AND NOT DEFINED WITH_${plugin}_STORAGE_ENGINE) SET(WITH_${plugin} 1) ENDIF() ENDIF() IF(WITH_${plugin}_STORAGE_ENGINE OR WITH_{$plugin} OR WITH_ALL OR WITH_MAX AND NOT WITHOUT_${plugin}_STORAGE_ENGINE AND NOT WITHOUT_${plugin} AND NOT ARG_MODULE_ONLY) SET(WITH_${plugin} 1) ELSEIF(WITHOUT_${plugin}_STORAGE_ENGINE OR WITH_NONE OR ${plugin}_DISABLED) SET(WITHOUT_${plugin} 1) SET(WITH_${plugin}_STORAGE_ENGINE 0) SET(WITH_${plugin} 0) ENDIF() IF(ARG_MANDATORY) SET(WITH_${plugin} 1) ENDIF() IF(ARG_STORAGE_ENGINE) SET(with_var "WITH_${plugin}_STORAGE_ENGINE" ) ELSE() SET(with_var "WITH_${plugin}") ENDIF() IF(NOT ARG_DEPENDENCIES) SET(ARG_DEPENDENCIES) ENDIF() SET(BUILD_PLUGIN 1) IF(NOT ARG_MODULE_OUTPUT_NAME) IF(ARG_STORAGE_ENGINE) SET(ARG_MODULE_OUTPUT_NAME "ha_${target}") ELSE() SET(ARG_MODULE_OUTPUT_NAME "${target}") ENDIF() ENDIF() # Build either static library or module IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY) IF(CMAKE_GENERATOR MATCHES "Makefiles") # If there is a shared library from previous shared build, # remove it. This is done just for mysql-test-run.pl # so it does not try to use stale shared lib as plugin # in test. FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${ARG_MODULE_OUTPUT_NAME}${CMAKE_SHARED_MODULE_SUFFIX}) ENDIF() ADD_LIBRARY(${target} STATIC ${SOURCES}) DTRACE_INSTRUMENT(${target}) ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) RESTRICT_SYMBOL_EXPORTS(${target}) IF(WITH_EMBEDDED_SERVER) # Embedded library should contain PIC code and be linkable # to shared libraries (on systems that need PIC) IF(ARG_RECOMPILE_FOR_EMBEDDED OR NOT _SKIP_PIC) # Recompile some plugins for embedded ADD_CONVENIENCE_LIBRARY(${target}_embedded ${SOURCES}) DTRACE_INSTRUMENT(${target}_embedded) IF(ARG_RECOMPILE_FOR_EMBEDDED) SET_TARGET_PROPERTIES(${target}_embedded PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY") ENDIF() ADD_DEPENDENCIES(${target}_embedded GenError) ENDIF() ENDIF() IF(ARG_STATIC_OUTPUT_NAME) SET_TARGET_PROPERTIES(${target} PROPERTIES OUTPUT_NAME ${ARG_STATIC_OUTPUT_NAME}) ENDIF() # Update mysqld dependencies SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS} ${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE) IF(ARG_MANDATORY) SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server" FORCE) ELSE() SET(${with_var} ON CACHE BOOL "Link ${plugin} statically to the server" FORCE) ENDIF() IF(ARG_MANDATORY) SET (mysql_mandatory_plugins "${mysql_mandatory_plugins} builtin_maria_${target}_plugin," PARENT_SCOPE) ELSE() SET (mysql_optional_plugins "${mysql_optional_plugins} builtin_maria_${target}_plugin," PARENT_SCOPE) ENDIF() ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS) ADD_VERSION_INFO(${target} MODULE SOURCES) ADD_LIBRARY(${target} MODULE ${SOURCES}) DTRACE_INSTRUMENT(${target}) SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "" COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN") TARGET_LINK_LIBRARIES (${target} mysqlservices) # Plugin uses symbols defined in mysqld executable. # Some operating systems like Windows and OSX and are pretty strict about # unresolved symbols. Others are less strict and allow unresolved symbols # in shared libraries. On Linux for example, CMake does not even add # executable to the linker command line (it would result into link error). # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate # an additional dependency. IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES}) ENDIF() ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) IF(NOT ARG_MODULE_ONLY) # set cached variable, e.g with checkbox in GUI SET(${with_var} OFF CACHE BOOL "Link ${plugin} statically to the server" FORCE) ENDIF() SET_TARGET_PROPERTIES(${target} PROPERTIES OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}") # Install dynamic library IF(NOT ARG_COMPONENT) SET(ARG_COMPONENT Server) ENDIF() MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT}) #INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug COMPONENT ${ARG_COMPONENT}) ELSE() IF(WITHOUT_${plugin}) # Update cache variable STRING(REPLACE "WITH_" "WITHOUT_" without_var ${with_var}) SET(${without_var} ON CACHE BOOL "Don't build ${plugin}" FORCE) ENDIF() SET(BUILD_PLUGIN 0) ENDIF() IF(BUILD_PLUGIN AND ARG_LINK_LIBRARIES) TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) ENDIF() ENDMACRO() # Add all CMake projects under storage and plugin # subdirectories, configure sql_builtins.cc MACRO(CONFIGURE_PLUGINS) FILE(GLOB dirs_storage ${CMAKE_SOURCE_DIR}/storage/*) FILE(GLOB dirs_plugin ${CMAKE_SOURCE_DIR}/plugin/*) FOREACH(dir ${dirs_storage} ${dirs_plugin}) IF (EXISTS ${dir}/CMakeLists.txt) ADD_SUBDIRECTORY(${dir}) ENDIF() ENDFOREACH() FOREACH(dir ${dirs_plugin}) IF (EXISTS ${dir}/.bzr) MESSAGE(STATUS "Found repo ${dir}/.bzr") LIST(APPEND PLUGIN_BZR_REPOS "${dir}") ENDIF() ENDFOREACH() SET(PLUGIN_REPOS "${PLUGIN_BZR_REPOS}" CACHE INTERNAL "") ENDMACRO()
jb-boin/mariadb
cmake/plugin.cmake
CMake
gpl-2.0
8,467
package zeropoint.minecraft.commands.com; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import zeropoint.minecraft.core.GTBaseCommand; import zeropoint.minecraft.core.util.ChatMsg; /** * [/vanish [on|off|toggle]] Control invisibility * * @author Zero Point */ public class Vanish extends GTBaseCommand { @Override public String getCommandName() { return "vanish"; } @Override public String getCommandHelp(ICommandSender src) { return "Controls invisibility"; } @Override public String getCommandArgs(ICommandSender src) { return "[on|off|toggle]"; } @Override public boolean isFinished() { return true; } @Override public void execute(ICommandSender src, EntityPlayer player, String[] args) { if (args.length > 0) { String arg = args[0].toLowerCase(); if (arg.equals("on")) { player.setInvisible(true); } else if (arg.equals("off")) { player.setInvisible(false); } else if (arg.equals("toggle")) { player.setInvisible( !player.isInvisible()); } else { new ChatMsg(this.getCommandUsage(src)).send(src); } } else { player.setInvisible( !player.isInvisible()); } } }
ZeroPointMC/GlobalTweaks
zeropoint/minecraft/commands/com/Vanish.java
Java
gpl-2.0
1,198
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- const Clutter = imports.gi.Clutter; const Lang = imports.lang; const Signals = imports.signals; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const Gtk = imports.gi.Gtk; const Pango = imports.gi.Pango; const St = imports.gi.St; const Shell = imports.gi.Shell; const CheckBox = imports.ui.checkBox; const Dialog = imports.ui.dialog; const Main = imports.ui.main; const MessageTray = imports.ui.messageTray; const ModalDialog = imports.ui.modalDialog; const Params = imports.misc.params; const ShellEntry = imports.ui.shellEntry; var LIST_ITEM_ICON_SIZE = 48; const REMEMBER_MOUNT_PASSWORD_KEY = 'remember-mount-password'; /* ------ Common Utils ------- */ function _setLabelText(label, text) { if (text) { label.set_text(text); label.show(); } else { label.set_text(''); label.hide(); } } function _setButtonsForChoices(dialog, choices) { let buttons = []; for (let idx = 0; idx < choices.length; idx++) { let button = idx; buttons.unshift({ label: choices[idx], action: () => { dialog.emit('response', button); } }); } dialog.setButtons(buttons); } function _setLabelsForMessage(content, message) { let labels = message.split('\n'); content.title = labels.shift(); content.body = labels.join('\n'); } function _createIcon(gicon) { return new St.Icon({ gicon: gicon, style_class: 'shell-mount-operation-icon' }) } /* -------------------------------------------------------- */ var ListItem = new Lang.Class({ Name: 'ListItem', _init(app) { this._app = app; let layout = new St.BoxLayout({ vertical: false}); this.actor = new St.Button({ style_class: 'mount-dialog-app-list-item', can_focus: true, child: layout, reactive: true, x_align: St.Align.START, x_fill: true }); this._icon = this._app.create_icon_texture(LIST_ITEM_ICON_SIZE); let iconBin = new St.Bin({ style_class: 'mount-dialog-app-list-item-icon', child: this._icon }); layout.add(iconBin); this._nameLabel = new St.Label({ text: this._app.get_name(), style_class: 'mount-dialog-app-list-item-name' }); let labelBin = new St.Bin({ y_align: St.Align.MIDDLE, child: this._nameLabel }); layout.add(labelBin); this.actor.connect('clicked', this._onClicked.bind(this)); }, _onClicked() { this.emit('activate'); this._app.activate(); } }); Signals.addSignalMethods(ListItem.prototype); var ShellMountOperation = new Lang.Class({ Name: 'ShellMountOperation', _init(source, params) { params = Params.parse(params, { existingDialog: null }); this._dialog = null; this._dialogId = 0; this._existingDialog = params.existingDialog; this._processesDialog = null; this.mountOp = new Shell.MountOperation(); this.mountOp.connect('ask-question', this._onAskQuestion.bind(this)); this.mountOp.connect('ask-password', this._onAskPassword.bind(this)); this.mountOp.connect('show-processes-2', this._onShowProcesses2.bind(this)); this.mountOp.connect('aborted', this.close.bind(this)); this.mountOp.connect('show-unmount-progress', this._onShowUnmountProgress.bind(this)); this._gicon = source.get_icon(); }, _closeExistingDialog() { if (!this._existingDialog) return; this._existingDialog.close(); this._existingDialog = null; }, _onAskQuestion(op, message, choices) { this._closeExistingDialog(); this._dialog = new ShellMountQuestionDialog(this._gicon); this._dialogId = this._dialog.connect('response', (object, choice) => { this.mountOp.set_choice(choice); this.mountOp.reply(Gio.MountOperationResult.HANDLED); this.close(); }); this._dialog.update(message, choices); this._dialog.open(); }, _onAskPassword(op, message, defaultUser, defaultDomain, flags) { if (this._existingDialog) { this._dialog = this._existingDialog; this._dialog.reaskPassword(); } else { this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags); } this._dialogId = this._dialog.connect('response', (object, choice, password, remember) => { if (choice == -1) { this.mountOp.reply(Gio.MountOperationResult.ABORTED); } else { if (remember) this.mountOp.set_password_save(Gio.PasswordSave.PERMANENTLY); else this.mountOp.set_password_save(Gio.PasswordSave.NEVER); this.mountOp.set_password(password); this.mountOp.reply(Gio.MountOperationResult.HANDLED); } }); this._dialog.open(); }, close(op) { this._closeExistingDialog(); this._processesDialog = null; if (this._dialog) { this._dialog.close(); this._dialog = null; } if (this._notifier) { this._notifier.done(); this._notifier = null; } }, _onShowProcesses2(op) { this._closeExistingDialog(); let processes = op.get_show_processes_pids(); let choices = op.get_show_processes_choices(); let message = op.get_show_processes_message(); if (!this._processesDialog) { this._processesDialog = new ShellProcessesDialog(this._gicon); this._dialog = this._processesDialog; this._dialogId = this._processesDialog.connect('response', (object, choice) => { if (choice == -1) { this.mountOp.reply(Gio.MountOperationResult.ABORTED); } else { this.mountOp.set_choice(choice); this.mountOp.reply(Gio.MountOperationResult.HANDLED); } this.close(); }); this._processesDialog.open(); } this._processesDialog.update(message, processes, choices); }, _onShowUnmountProgress(op, message, timeLeft, bytesLeft) { if (!this._notifier) this._notifier = new ShellUnmountNotifier(); if (bytesLeft == 0) this._notifier.done(message); else this._notifier.show(message); }, borrowDialog() { if (this._dialogId != 0) { this._dialog.disconnect(this._dialogId); this._dialogId = 0; } return this._dialog; } }); var ShellUnmountNotifier = new Lang.Class({ Name: 'ShellUnmountNotifier', Extends: MessageTray.Source, _init() { this.parent('', 'media-removable'); this._notification = null; Main.messageTray.add(this); }, show(message) { let [header, text] = message.split('\n', 2); if (!this._notification) { this._notification = new MessageTray.Notification(this, header, text); this._notification.setTransient(true); this._notification.setUrgency(MessageTray.Urgency.CRITICAL); } else { this._notification.update(header, text); } this.notify(this._notification); }, done(message) { if (this._notification) { this._notification.destroy(); this._notification = null; } if (message) { let notification = new MessageTray.Notification(this, message, null); notification.setTransient(true); this.notify(notification); } } }); var ShellMountQuestionDialog = new Lang.Class({ Name: 'ShellMountQuestionDialog', Extends: ModalDialog.ModalDialog, _init(icon) { this.parent({ styleClass: 'mount-dialog' }); this._content = new Dialog.MessageDialogContent({ icon }); this.contentLayout.add(this._content, { x_fill: true, y_fill: false }); }, update(message, choices) { _setLabelsForMessage(this._content, message); _setButtonsForChoices(this, choices); } }); Signals.addSignalMethods(ShellMountQuestionDialog.prototype); var ShellMountPasswordDialog = new Lang.Class({ Name: 'ShellMountPasswordDialog', Extends: ModalDialog.ModalDialog, _init(message, icon, flags) { let strings = message.split('\n'); let title = strings.shift() || null; let body = strings.shift() || null; this.parent({ styleClass: 'prompt-dialog' }); let content = new Dialog.MessageDialogContent({ icon, title, body }); this.contentLayout.add_actor(content); this._passwordBox = new St.BoxLayout({ vertical: false, style_class: 'prompt-dialog-password-box' }); content.messageBox.add(this._passwordBox); this._passwordLabel = new St.Label(({ style_class: 'prompt-dialog-password-label', text: _("Password") })); this._passwordBox.add(this._passwordLabel, { y_fill: false, y_align: St.Align.MIDDLE }); this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry', text: "", can_focus: true}); ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true }); this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this)); this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE this._passwordBox.add(this._passwordEntry, {expand: true }); this.setInitialKeyFocus(this._passwordEntry); this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label', text: _("Sorry, that didn’t work. Please try again.") }); this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this._errorMessageLabel.clutter_text.line_wrap = true; this._errorMessageLabel.hide(); content.messageBox.add(this._errorMessageLabel); if (flags & Gio.AskPasswordFlags.SAVING_SUPPORTED) { this._rememberChoice = new CheckBox.CheckBox(); this._rememberChoice.getLabelActor().text = _("Remember Password"); this._rememberChoice.actor.checked = global.settings.get_boolean(REMEMBER_MOUNT_PASSWORD_KEY); content.messageBox.add(this._rememberChoice.actor); } else { this._rememberChoice = null; } let buttons = [{ label: _("Cancel"), action: this._onCancelButton.bind(this), key: Clutter.Escape }, { label: _("Unlock"), action: this._onUnlockButton.bind(this), default: true }]; this.setButtons(buttons); }, reaskPassword() { this._passwordEntry.set_text(''); this._errorMessageLabel.show(); }, _onCancelButton() { this.emit('response', -1, '', false); }, _onUnlockButton() { this._onEntryActivate(); }, _onEntryActivate() { global.settings.set_boolean(REMEMBER_MOUNT_PASSWORD_KEY, this._rememberChoice && this._rememberChoice.actor.checked); this.emit('response', 1, this._passwordEntry.get_text(), this._rememberChoice && this._rememberChoice.actor.checked); } }); var ShellProcessesDialog = new Lang.Class({ Name: 'ShellProcessesDialog', Extends: ModalDialog.ModalDialog, _init(icon) { this.parent({ styleClass: 'mount-dialog' }); this._content = new Dialog.MessageDialogContent({ icon }); this.contentLayout.add(this._content, { x_fill: true, y_fill: false }); let scrollView = new St.ScrollView({ style_class: 'mount-dialog-app-list'}); scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this.contentLayout.add(scrollView, { x_fill: true, y_fill: true }); scrollView.hide(); this._applicationList = new St.BoxLayout({ vertical: true }); scrollView.add_actor(this._applicationList); this._applicationList.connect('actor-added', () => { if (this._applicationList.get_n_children() == 1) scrollView.show(); }); this._applicationList.connect('actor-removed', () => { if (this._applicationList.get_n_children() == 0) scrollView.hide(); }); }, _setAppsForPids(pids) { // remove all the items this._applicationList.destroy_all_children(); pids.forEach(pid => { let tracker = Shell.WindowTracker.get_default(); let app = tracker.get_app_from_pid(pid); if (!app) return; let item = new ListItem(app); this._applicationList.add(item.actor, { x_fill: true }); item.connect('activate', () => { // use -1 to indicate Cancel this.emit('response', -1); }); }); }, update(message, processes, choices) { this._setAppsForPids(processes); _setLabelsForMessage(this._content, message); _setButtonsForChoices(this, choices); } }); Signals.addSignalMethods(ShellProcessesDialog.prototype); const GnomeShellMountOpIface = ` <node> <interface name="org.Gtk.MountOperationHandler"> <method name="AskPassword"> <arg type="s" direction="in" name="object_id"/> <arg type="s" direction="in" name="message"/> <arg type="s" direction="in" name="icon_name"/> <arg type="s" direction="in" name="default_user"/> <arg type="s" direction="in" name="default_domain"/> <arg type="u" direction="in" name="flags"/> <arg type="u" direction="out" name="response"/> <arg type="a{sv}" direction="out" name="response_details"/> </method> <method name="AskQuestion"> <arg type="s" direction="in" name="object_id"/> <arg type="s" direction="in" name="message"/> <arg type="s" direction="in" name="icon_name"/> <arg type="as" direction="in" name="choices"/> <arg type="u" direction="out" name="response"/> <arg type="a{sv}" direction="out" name="response_details"/> </method> <method name="ShowProcesses"> <arg type="s" direction="in" name="object_id"/> <arg type="s" direction="in" name="message"/> <arg type="s" direction="in" name="icon_name"/> <arg type="ai" direction="in" name="application_pids"/> <arg type="as" direction="in" name="choices"/> <arg type="u" direction="out" name="response"/> <arg type="a{sv}" direction="out" name="response_details"/> </method> <method name="Close"/> </interface> </node>`; var ShellMountOperationType = { NONE: 0, ASK_PASSWORD: 1, ASK_QUESTION: 2, SHOW_PROCESSES: 3 }; var GnomeShellMountOpHandler = new Lang.Class({ Name: 'GnomeShellMountOpHandler', _init() { this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellMountOpIface, this); this._dbusImpl.export(Gio.DBus.session, '/org/gtk/MountOperationHandler'); Gio.bus_own_name_on_connection(Gio.DBus.session, 'org.gtk.MountOperationHandler', Gio.BusNameOwnerFlags.REPLACE, null, null); this._dialog = null; this._volumeMonitor = Gio.VolumeMonitor.get(); this._ensureEmptyRequest(); }, _ensureEmptyRequest() { this._currentId = null; this._currentInvocation = null; this._currentType = ShellMountOperationType.NONE; }, _clearCurrentRequest(response, details) { if (this._currentInvocation) { this._currentInvocation.return_value( GLib.Variant.new('(ua{sv})', [response, details])); } this._ensureEmptyRequest(); }, _setCurrentRequest(invocation, id, type) { let oldId = this._currentId; let oldType = this._currentType; let requestId = id + '@' + invocation.get_sender(); this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {}); this._currentInvocation = invocation; this._currentId = requestId; this._currentType = type; if (this._dialog && (oldId == requestId) && (oldType == type)) return true; return false; }, _closeDialog() { if (this._dialog) { this._dialog.close(); this._dialog = null; } }, _createGIcon(iconName) { let realIconName = iconName ? iconName : 'drive-harddisk'; return new Gio.ThemedIcon({ name: realIconName, use_default_fallbacks: true }); }, /** * AskPassword: * @id: an opaque ID identifying the object for which the operation is requested * The ID must be unique in the context of the calling process. * @message: the message to display * @icon_name: the name of an icon to display * @default_user: the default username for display * @default_domain: the default domain for display * @flags: a set of GAskPasswordFlags * @response: a GMountOperationResult * @response_details: a dictionary containing the response details as * entered by the user. The dictionary MAY contain the following properties: * - "password" -> (s): a password to be used to complete the mount operation * - "password_save" -> (u): a GPasswordSave * * The dialog will stay visible until clients call the Close() method, or * another dialog becomes visible. * Calling AskPassword again for the same id will have the effect to clear * the existing dialog and update it with a message indicating the previous * attempt went wrong. */ AskPasswordAsync(params, invocation) { let [id, message, iconName, defaultUser, defaultDomain, flags] = params; if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_PASSWORD)) { this._dialog.reaskPassword(); return; } this._closeDialog(); this._dialog = new ShellMountPasswordDialog(message, this._createGIcon(iconName), flags); this._dialog.connect('response', (object, choice, password, remember) => { let details = {}; let response; if (choice == -1) { response = Gio.MountOperationResult.ABORTED; } else { response = Gio.MountOperationResult.HANDLED; let passSave = remember ? Gio.PasswordSave.PERMANENTLY : Gio.PasswordSave.NEVER; details['password_save'] = GLib.Variant.new('u', passSave); details['password'] = GLib.Variant.new('s', password); } this._clearCurrentRequest(response, details); }); this._dialog.open(); }, /** * AskQuestion: * @id: an opaque ID identifying the object for which the operation is requested * The ID must be unique in the context of the calling process. * @message: the message to display * @icon_name: the name of an icon to display * @choices: an array of choice strings * GetResponse: * @response: a GMountOperationResult * @response_details: a dictionary containing the response details as * entered by the user. The dictionary MAY contain the following properties: * - "choice" -> (i): the chosen answer among the array of strings passed in * * The dialog will stay visible until clients call the Close() method, or * another dialog becomes visible. * Calling AskQuestion again for the same id will have the effect to clear * update the dialog with the new question. */ AskQuestionAsync(params, invocation) { let [id, message, iconName, choices] = params; if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_QUESTION)) { this._dialog.update(message, choices); return; } this._closeDialog(); this._dialog = new ShellMountQuestionDialog(this._createGIcon(iconName), message); this._dialog.connect('response', (object, choice) => { this._clearCurrentRequest(Gio.MountOperationResult.HANDLED, { choice: GLib.Variant.new('i', choice) }); }); this._dialog.update(message, choices); this._dialog.open(); }, /** * ShowProcesses: * @id: an opaque ID identifying the object for which the operation is requested * The ID must be unique in the context of the calling process. * @message: the message to display * @icon_name: the name of an icon to display * @application_pids: the PIDs of the applications to display * @choices: an array of choice strings * @response: a GMountOperationResult * @response_details: a dictionary containing the response details as * entered by the user. The dictionary MAY contain the following properties: * - "choice" -> (i): the chosen answer among the array of strings passed in * * The dialog will stay visible until clients call the Close() method, or * another dialog becomes visible. * Calling ShowProcesses again for the same id will have the effect to clear * the existing dialog and update it with the new message and the new list * of processes. */ ShowProcessesAsync(params, invocation) { let [id, message, iconName, applicationPids, choices] = params; if (this._setCurrentRequest(invocation, id, ShellMountOperationType.SHOW_PROCESSES)) { this._dialog.update(message, applicationPids, choices); return; } this._closeDialog(); this._dialog = new ShellProcessesDialog(this._createGIcon(iconName)); this._dialog.connect('response', (object, choice) => { let response; let details = {}; if (choice == -1) { response = Gio.MountOperationResult.ABORTED; } else { response = Gio.MountOperationResult.HANDLED; details['choice'] = GLib.Variant.new('i', choice); } this._clearCurrentRequest(response, details); }); this._dialog.update(message, applicationPids, choices); this._dialog.open(); }, /** * Close: * * Closes a dialog previously opened by AskPassword, AskQuestion or ShowProcesses. * If no dialog is open, does nothing. */ Close(params, invocation) { this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {}); this._closeDialog(); } });
halfline/gnome-shell
js/ui/shellMountOperation.js
JavaScript
gpl-2.0
23,798
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use cpython::*; use minibytes::Bytes as MiniBytes; #[cfg(feature = "python3")] use python3_sys as ffi; #[cfg(feature = "python2")] use python27_sys as ffi; pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> { let name = [package, "bytes"].join("."); let m = PyModule::new(py, &name)?; m.add_class::<Bytes>(py)?; Ok(m) } py_class!(pub class Bytes |py| { data inner: MiniBytes; /// Convert to `memoryview` (Python 3) or `buffer` (Python 2). def asref(&self) -> PyResult<PyObject> { let slice: &[u8] = self.inner(py).as_ref(); #[cfg(feature = "python2")] unsafe { let raw_obj = ffi::PyBuffer_FromMemory( slice.as_ptr() as *const _ as *mut _, slice.len() as _, ); return Ok(PyObject::from_owned_ptr(py, raw_obj)) } #[cfg(feature = "python3")] unsafe { let raw_obj = ffi::PyMemoryView_FromMemory( slice.as_ptr() as *const _ as *mut _, slice.len() as _, ffi::PyBUF_READ, ); return Ok(PyObject::from_owned_ptr(py, raw_obj)) } } }); impl Bytes { /// Convert `minibytes::Bytes` to a Python `Bytes` that implements the /// `Py_buffer` interface. pub fn from_bytes(py: Python, bytes: MiniBytes) -> PyResult<Self> { Self::create_instance(py, bytes) } }
facebookexperimental/eden
eden/hg-server/edenscmnative/bindings/modules/pybytes/src/lib.rs
Rust
gpl-2.0
1,607
local combat = {} for i = 35, 55 do combat[i] = Combat() combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS) combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_TICKS, 15000) condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, i) combat[i]:addCondition(condition) end local spell = Spell("instant") function spell.onCastSpell(creature, var) return combat[math.random(35, 55)]:execute(creature, var) end spell:name("raging mage skill reducer 1") spell:words("###110") spell:isAggressive(true) spell:blockWalls(true) spell:needTarget(true) spell:needLearn(true) spell:register()
mattyx14/otxserver
data/scripts/spells/monster/raging_mage_skill_reducer_1.lua
Lua
gpl-2.0
725
<?php class Qixol_Promo_Block_Banner extends Mage_Core_Block_Template { public function _prepareLayout() { return parent::_prepareLayout(); } public function getBanner() { if (!$this->hasData('banner')) { $this->setData('banner', Mage::registry('banner')); } return $this->getData('banner'); } public function getResizeImage($bannerPath, $groupName, $w = 0, $h = 0) { $name = ''; $_helper = Mage::helper('qixol'); $bannerDirPath = $_helper->updateDirSepereator($bannerPath); $baseDir = Mage::getBaseDir(); $mediaDir = Mage::getBaseDir('media'); $mediaUrl = Mage::getBaseUrl('media'); $resizeDir = $mediaDir . DS . 'custom' . DS . 'banners' . DS . 'resize' . DS; $resizeUrl = $mediaUrl.'Qixol/Promo/banners/resize/'; $imageName = basename($bannerDirPath); if (@file_exists($mediaDir . DS . $bannerDirPath)) { $name = $mediaDir . DS . $bannerPath; $this->checkDir($resizeDir . $groupName); $smallImgPath = $resizeDir . $groupName . DS . $imageName; $smallImg = $resizeUrl . $groupName .'/'. $imageName; } if ($name != '') { $resizeObject = Mage::getModel('qixol/bannerresize'); $resizeObject->setImage($name); if ($resizeObject->resizeLimitwh($w, $h, $smallImgPath) === false) { return $resizeObject->error(); } else { return $smallImg; } } else { return ''; } } protected function checkDir($directory) { if (!is_dir($directory)) { umask(0); mkdir($directory, 0777,true); return true; } } }
Qixol/Qixol.Promo.Magento.Extension
Magento_1.9.x/app/code/community/Qixol/Promo/Block/Banner.php
PHP
gpl-2.0
1,819
<html> <head> <title>SE IT-B</title> <link rel=stylesheet href="quiz_style.css" type="text/css"> <script type="text/javascript"> window.onload=function() {alert('Mambos Quiz!! Hurry up..! to get selected.');}; function validatefield(fieldname,regex,helptext,helpid) { if(fieldname.value.length==0) { helpid.innerHTML="Please enter a value"; return false; } else { if(!(regex.test(fieldname.value))) { helpid.innerHTML=helptext; return false; } else { helpid.innerHTML=""; return true; } } } function formCheck(form) { if(validatefield(document.getElementById("first"),/^\w+$/,'invalid information',document.getElementById('first_help')) && validatefield(document.getElementById("last"),/^\w+$/,'invalid information',document.getElementById('last_help')) && validatefield(document.getElementById("user"),/^[\w-_@]+$/,'invalid username information',document.getElementById('user_help')) && validatefield(document.getElementById("pass"),/^[\w!_\?\$]{6,12}$/,'invalid password',document.getElementById('pass_help')) && validatefield(document.getElementById("email"),/^[\w-_\.]+@(yahoo|gmail|rediff|ovi|msn)\.[\.(\w{2,3})]+$/,'email not recognized',document.getElementById('email_help')) && validatefield(document.getElementById("date"),/^\d{2}$/,'date not valid',document.getElementById('date_help')) && validatefield(document.getElementById("year"),/^\d{4}$/,'year not entered correctly',document.getElementById('year_help')) && validatefield(document.getElementById("mobile"),/^\+91\d{10}$/,'incorrect mobile number',document.getElementById('mobile_help'))) { alert("hey man"); form.submit(); } else { alert("please fill in the required information"); } } </script> </head> <body> <div id="allcontent"> <div id="titlepage"> <h1>Mambos Quiz</h1> </div> <div id="formelem"> <form> <table> <tr> <th>First Name: </th> <td><input id="first" name="first" type="text" size="50" onblur="validatefield(this,/^\w+$/,'invalid information',document.getElementById('first_help'));" /></td><td><span name="first_help" id="first_help"></span></td> </tr> <tr> <th>Last Name:</th> <td><input id="last" name="last" size="50" type="text" onblur="validatefield(this,/^\w+$/,'invalid information',document.getElementById('last_help'));" /></td><td><span name="last_help" id="last_help"></span></td> </tr> <tr> <th>Choose Your Username:</th> <td><input id="user" name="user" type="text" size="50" onblur="validatefield(this,/^[\w-_@]+$/,'invalid username information',document.getElementById('user_help'));" /></td><td><span name="user_help" id="user_help"></span></td> </tr> <tr> <th>Create Your Password:</th> <td><input id="pass" name="pass" type="password" size="50" onblur="validatefield(this,/^[\w!_\?\$]{6,12}$/,'invalid password',document.getElementById('pass_help'));" /></td><td><span name="pass_help" id="pass_help"></span></td> </tr> <tr> <td></td><td>minimum 6 characters maximum 16 characters long</td> </tr> <tr> <th>Email_id:</th> <td><input id="email" type="text" name="email" size="50" maxlength="30" onblur="validatefield(this,/^[\w-_\.]+@(yahoo|gmail|rediff|ovi|msn)\.[\.(\w{2,3})]+$/,'email not recognized',document.getElementById('email_help'));" /></td><td><span name="email_help" id="email_help"></span></td> </tr> <tr> <th></th> <td> eg: username@gmail.com</td> </tr> <tr> <th>Birthday:</th> <td>Month:<select name="months" > <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> Date:<input id="date" type="text" size="2" name="day" onblur="validatefield(this,/^\d{2}$/,'date not valid',document.getElementById('date_help'));" /> Year:<input id="year" type="text" size="5" name="year" onblur="validatefield(this,/^\d{4}$/,'year not entered correctly',document.getElementById('year_help'));" /> </td> <td><span name="date_help" id="date_help"></span></td> <td><span name="year_help" id="year_help"></span></td> </tr> <tr> <th>Quiz difficulty:</th> <td><input type="radio" id="level" name="level" value="simple" checked="checked" />Simple<input value="professional" type="radio" id="level" name="level" />Professional</td> </tr> <tr> <th>Mobile Number:</th> <td><input type="text" id="mobile" name="mobile" size="50" value="+91" size="20" onblur="validatefield(this,/^\+91\d{10}$/,'incorrect mobile number',document.getElementById('mobile_help'));" /></td><td><span name="mobile_help" id="mobile_help"></span></td> </tr> <tr> <th>Country:</th> <td> <select name="country"> <option value="India">India</option> <option value="U.S.A">U.S.A</option> <option value="Australia">Australia</option> <option value="New Zealand">New Zealand</option> <option value="Pakistan">Pakistan</option> <option value="Sri Lanka">Sri Lanka</option> <option value="South Africa">South Africa</option> <option value="Englend">Englend</option> <option value="West Indies">West Indies</option> <option value="Russia">Zimbawe</option> <option value="Ireland">Ireland</option> <option value="Dubai">Dubai</option> <option value="Abu Dhabi">Abu Dhabi</option> <option value="Tokyo">Tokyo</option> </select> </td> </tr> <tr> <th></th> <td><input id="agreement" type="checkbox" name="agreement">I agree the Terms of Services and Privacy Policy</td></td> </tr> <tr> <th></th> <td><span class="buttonout1" id="buttonout" onclick="formCheck(this.form);" >submit</span></td> </tr> </table> </div> </div> </form> </body> </html>
rihbyne/regex
regex.html
HTML
gpl-2.0
6,066
/* src/threads/native/critical.h - restartable critical sections Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger, Institut f. Computersprachen - TU Wien This file is part of CACAO. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Contact: cacao@cacaojvm.org Authors: Stefan Ring Edwin Steiner Changes: Christian Thalinger $Id: threads.h 4866 2006-05-01 21:40:38Z edwin $ */ #ifndef _CRITICAL_H #define _CRITICAL_H #include "config.h" #include <signal.h> /* required on some older Darwin systems for ucontext.h */ #include <ucontext.h> /* forward typedefs ***********************************************************/ typedef struct critical_section_node_t critical_section_node_t; /* critical_section_node_t ***************************************************** A node representing a restartable critical section. CAUTION: This order must not be changed, it is used in asm_criticalsections! *******************************************************************************/ struct critical_section_node_t { u1 *start; u1 *end; u1 *restart; }; /* functions ******************************************************************/ void critical_init(void); void critical_section_register(critical_section_node_t *); u1 *critical_find_restart_point(u1*); /* this is a machine dependent function (see src/vm/jit/$(ARCH_DIR)/md.c) */ void md_critical_section_restart(ucontext_t *_uc); #endif /* _CRITICAL_H */ /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where * Emacs will automagically detect them. * --------------------------------------------------------------------- * Local variables: * mode: c * indent-tabs-mode: t * c-basic-offset: 4 * tab-width: 4 * End: * vim:noexpandtab:sw=4:ts=4: */
tommythorn/yari
shared/cacao-related/cacao/src/threads/critical.h
C
gpl-2.0
2,684
package fr.lipn.sts.ir.indexing; import java.io.File; import java.io.IOException; import java.util.Stack; import java.util.Vector; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class AquaintXMLHandler extends DefaultHandler { /* A buffer for each XML element */ protected StringBuffer textBuffer = new StringBuffer(); protected StringBuffer titleBuffer = new StringBuffer(); protected String docID = new String(); protected Stack<String> elemStack; protected Document currentDocument; protected Vector<Document> parsedDocuments; public AquaintXMLHandler(File xmlFile) throws ParserConfigurationException, SAXException, IOException { // Now let's move to the parsing stuff SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser parser = spf.newSAXParser(); this.docID=xmlFile.getName(); try { parser.parse(xmlFile, this); } catch (org.xml.sax.SAXParseException spe) { System.out.println("SAXParser caught SAXParseException at line: " + spe.getLineNumber() + " column " + spe.getColumnNumber() + " details: " + spe.getMessage()); } } // call at document start public void startDocument() throws SAXException { parsedDocuments= new Vector<Document>(); elemStack=new Stack<String>(); } // call at element start public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attrs) throws SAXException { String eName = localName; if ("".equals(eName)) { eName = qualifiedName; // namespaceAware = false } elemStack.addElement(eName); if(eName=="DOC") { textBuffer.setLength(0); titleBuffer.setLength(0); docID=attrs.getValue("id"); currentDocument=new Document(); } } // call when cdata found public void characters(char[] text, int start, int length) throws SAXException { if(elemStack.peek().equalsIgnoreCase("HEADLINE")){ titleBuffer.append(text, start, length); } else if (elemStack.peek().equalsIgnoreCase("HEADLINE") || elemStack.peek().equalsIgnoreCase("P")) { textBuffer.append(text, start, length); } } // call at element end public void endElement(String namespaceURI, String simpleName, String qualifiedName) throws SAXException { String eName = simpleName; if ("".equals(eName)) { eName = qualifiedName; // namespaceAware = false } elemStack.pop(); if (eName.equals("DOC")){ currentDocument.add(new Field("title", titleBuffer.toString(), Field.Store.YES, Field.Index.ANALYZED)); currentDocument.add(new Field("text", textBuffer.toString(), Field.Store.YES, Field.Index.ANALYZED)); currentDocument.add(new Field("id", this.docID, Field.Store.YES, Field.Index.NOT_ANALYZED)); parsedDocuments.add(currentDocument); } } public Vector<Document> getParsedDocuments() { return this.parsedDocuments; } }
dbuscaldi/SOPA
src/fr/lipn/sts/ir/indexing/AquaintXMLHandler.java
Java
gpl-2.0
3,298
describe("region", function(){ "use strict"; describe("when creating a new region manager and no configuration has been provided", function(){ it("should throw an exception saying an 'el' is required", function(){ expect( Backbone.Marionette.Region.extend({}) ).toThrow("An 'el' must be specified for a region."); }); }); describe("when showing a view", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "#region", onShow: function(){} }); var MyView = Backbone.View.extend({ render: function(){ $(this.el).html("some content"); }, onShow: function(){ $(this.el).addClass("onShowClass"); } }); var myRegion, view, showEvent, showContext, showViewPassed; beforeEach(function(){ setFixtures("<div id='region'></div>"); view = new MyView(); spyOn(view, "render").andCallThrough(); myRegion = new MyRegion(); spyOn(myRegion, "onShow"); myRegion.on("show", function(v){ showViewPassed = v === view; showEvent = true; showContext = this; }); myRegion.show(view); }); it("should render the view", function(){ expect(view.render).toHaveBeenCalled(); }); it("should append the rendered HTML to the manager's 'el'", function(){ expect(myRegion.$el).toHaveHtml(view.el); }); it("shoudl call 'onShow' for the view, after the rendered HTML has been added to the DOM", function(){ expect($(view.el)).toHaveClass("onShowClass"); }) it("shoudl call 'onShow' for the region, after the rendered HTML has been added to the DOM", function(){ expect(myRegion.onShow).toHaveBeenCalled(); }) it("should trigger a show event for the view", function(){ expect(showEvent).toBeTruthy(); }); it("should pass the shown view as an argument for the show event", function(){ expect(showViewPassed).toBeTruthy(); }); it("should set 'this' to the manager, from the show event", function(){ expect(showContext).toBe(myRegion); }); }); describe("when a view is already shown and showing another", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "#region" }); var MyView = Backbone.View.extend({ render: function(){ $(this.el).html("some content"); }, close: function(){ } }); var myRegion, view1, view2; beforeEach(function(){ setFixtures("<div id='region'></div>"); view1 = new MyView(); view2 = new MyView(); myRegion = new MyRegion(); spyOn(view1, "close"); myRegion.show(view1); myRegion.show(view2); }); it("should call 'close' on the already open view", function(){ expect(view1.close).toHaveBeenCalled(); }); it("should reference the new view as the current view", function(){ expect(myRegion.currentView).toBe(view2); }); }); describe("when a view is already shown and showing the same one", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "#region" }); var MyView = Backbone.View.extend({ render: function(){ $(this.el).html("some content"); }, close: function(){ }, open: function(){ } }); var myRegion, view; beforeEach(function(){ setFixtures("<div id='region'></div>"); view = new MyView(); myRegion = new MyRegion(); myRegion.show(view); spyOn(view, "close"); spyOn(myRegion, "open"); spyOn(view, "render"); myRegion.show(view); }); it("should not call 'close' on the view", function(){ expect(view.close).not.toHaveBeenCalled(); }); it("should not call 'open' on the view", function(){ expect(myRegion.open).not.toHaveBeenCalledWith(view); }); it("should call 'render' on the view", function(){ expect(view.render).toHaveBeenCalled(); }); }); describe("when a view is already shown, close, and showing the same one", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "#region" }); var MyView = Backbone.Marionette.ItemView.extend({ render: function(){ $(this.el).html("some content"); }, open : function() {} }); var myRegion, view; beforeEach(function(){ setFixtures("<div id='region'></div>"); view = new MyView(); myRegion = new MyRegion(); myRegion.show(view); view.close(); spyOn(view, "close"); spyOn(myRegion, "open"); spyOn(view, "render") myRegion.show(view); }); it("should not call 'close' on the view", function(){ expect(view.close).not.toHaveBeenCalled(); }); it("should call 'open' on the view", function(){ expect(myRegion.open).toHaveBeenCalledWith(view); }); it("should call 'render' on the view", function(){ expect(view.render).toHaveBeenCalled(); }); }); describe("when a view is already closed and showing another", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "#region" }); var MyView = Backbone.Marionette.View.extend({ render: function(){ $(this.el).html("some content"); } }); var myRegion, view1, view2; beforeEach(function(){ setFixtures("<div id='region'></div>"); view1 = new MyView(); view2 = new MyView(); myRegion = new MyRegion(); spyOn(view1, "close").andCallThrough(); }); it("shouldn't call 'close' on an already closed view", function(){ myRegion.show(view1); view1.close(); myRegion.show(view2); expect(view1.close.callCount).toEqual(1); }); }); describe("when closing the current view", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "#region" }); var MyView = Backbone.View.extend({ render: function(){ $(this.el).html("some content"); }, close: function(){ } }); var myRegion, view, closed, closedContext; beforeEach(function(){ setFixtures("<div id='region'></div>"); view = new MyView(); spyOn(view, "close"); spyOn(view, "remove"); myRegion = new MyRegion(); myRegion.on("close", function(){ closed = true; closedContext = this; }); myRegion.show(view); myRegion.close(); }); it("should trigger a close event", function(){ expect(closed).toBeTruthy(); }); it("should set 'this' to the manager, from the close event", function(){ expect(closedContext).toBe(myRegion); }); it("should call 'close' on the already show view", function(){ expect(view.close).toHaveBeenCalled(); }); it("should not call 'remove' directly, on the view", function(){ expect(view.remove).not.toHaveBeenCalled(); }); it("should delete the current view reference", function(){ expect(myRegion.currentView).toBeUndefined(); }); }); describe("when closing the current view and it does not have a 'close' method", function(){ var MyRegion = Backbone.Marionette.Region.extend({ el: "<div></div>" }); var MyView = Backbone.View.extend({ render: function(){ $(this.el).html("some content"); } }); var myRegion, view; beforeEach(function(){ view = new MyView(); spyOn(view, "remove"); myRegion = new MyRegion(); myRegion.show(view); myRegion.close(); }); it("should call 'remove' on the view", function(){ expect(view.remove).toHaveBeenCalled(); }); }); describe("when initializing a region manager and passing an 'el' option", function(){ var manager, el; beforeEach(function(){ el = "#foo"; manager = new Backbone.Marionette.Region({ el: el }); }); it("should manage the specified el", function(){ expect(manager.el).toBe(el); }); }); describe("when initializing a region manager with an existing view", function(){ var manager, view; beforeEach(function(){ view = new (Backbone.View.extend({ onShow: function(){} }))(); spyOn(view, "render"); spyOn(view, "onShow"); manager = new Backbone.Marionette.Region({ el: "#foo", currentView: view }); }); it("should not render the view", function(){ expect(view.render).not.toHaveBeenCalled(); }); it("should not `show` the view", function(){ expect(view.onShow).not.toHaveBeenCalled(); }); }); describe("when attaching an existing view to a region manager", function(){ var manager, view; beforeEach(function(){ setFixtures("<div id='foo'>bar</div>"); view = new (Backbone.View.extend({onShow: function(){}}))(); spyOn(view, "render"); spyOn(view, "onShow"); manager = new Backbone.Marionette.Region({ el: "#foo" }); manager.attachView(view); }); it("should not render the view", function(){ expect(view.render).not.toHaveBeenCalled(); }); it("should not `show` the view", function(){ expect(view.onShow).not.toHaveBeenCalled(); }); it("should not replace the existing html", function(){ expect($(manager.el).text()).toBe("bar"); }) }); describe("when creating a region instance with an initialize method", function(){ var Manager, actualOptions, expectedOptions; beforeEach(function(){ expectedOptions = {foo: "bar"}; Manager = Backbone.Marionette.Region.extend({ el: "#foo", initialize: function(options){ } }); spyOn(Manager.prototype, "initialize").andCallThrough(); new Manager({ foo: "bar" }); }); it("should call the initialize method with the options from the constructor", function(){ expect(Manager.prototype.initialize).toHaveBeenCalledWith(expectedOptions); }); }); describe("when removing a region", function(){ var MyApp, region; beforeEach(function(){ setFixtures("<div id='region'></div><div id='region2'></div>"); MyApp = new Backbone.Marionette.Application(); MyApp.addRegions({ MyRegion: "#region", anotherRegion: "#region2" }); region = MyApp.MyRegion; spyOn(region, "close"); MyApp.removeRegion('MyRegion') }); it("should be removed from the app", function(){ expect(MyApp.MyRegion).not.toBeDefined() }) it("should call 'close' of the region", function(){ expect(region.close).toHaveBeenCalled() }) }) describe("when resetting a region", function(){ var region; beforeEach(function(){ setFixtures("<div id='region'></div>"); region = new Backbone.Marionette.Region({ el: "#region" }); spyOn(region, "close"); region.ensureEl(); region.reset(); }); it("should not hold on to the region's previous `el`", function(){ expect(region.$el).not.toExist(); }); it("should close any existing view", function(){ expect(region.close).toHaveBeenCalled(); }); }); });
RoryDuncan/Idea-Planner
node_modules/backbone.marionette/spec/javascripts/region.spec.js
JavaScript
gpl-2.0
11,267
/* * Copyright (c) 1998-2011 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Resin Open Source 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, or any warranty * of NON-INFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the * * Free Software Foundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * * @author Scott Ferguson */ package com.caucho.server.http; import com.caucho.util.L10N; import com.caucho.vfs.OutputStreamWithBuffer; import com.caucho.vfs.Path; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.Locale; import java.util.logging.Logger; /** * API for handling the PrintWriter/ServletOutputStream */ public class StubResponseStream extends AbstractResponseStream { private final byte []_byteBuffer = new byte[16]; private final char []_charBuffer = new char[16]; /** * Returns true for a Caucho response stream. */ @Override public boolean isCauchoResponseStream() { return true; } /** * Sets the buffer size. */ @Override public void setBufferSize(int size) { } /** * Gets the buffer size. */ @Override public int getBufferSize() { return 0; } /** * Returns the remaining buffer entries. */ @Override public int getRemaining() { return 0; } /** * Returns the stream's buffer. */ public byte []getBuffer() throws IOException { return _byteBuffer; } /** * Returns the stream's buffer offset. */ public int getBufferOffset() throws IOException { return 0; } /** * Sets the stream's buffer length. */ public void setBufferOffset(int offset) throws IOException { } /** * Returns the next buffer. * * @param length the length of the completed buffer * * @return the next buffer */ public byte []nextBuffer(int offset) throws IOException { return _byteBuffer; } /** * Returns the char buffer. */ @Override public char []getCharBuffer() throws IOException { return _charBuffer; } /** * Returns the char buffer offset. */ @Override public int getCharOffset() throws IOException { return 0; } /** * Sets the char buffer offset. */ @Override public void setCharOffset(int offset) throws IOException { } /** * Returns the next char buffer. */ @Override public char []nextCharBuffer(int offset) throws IOException { return _charBuffer; } /** * Writes a byte to the output. */ @Override public void write(int v) throws IOException { } /** * Writes a byte array to the output. */ @Override public void write(byte []buffer, int offset, int length) throws IOException { } /** * Writes a character to the output. */ @Override public void print(int ch) throws IOException { } /** * Writes a char array to the output. */ @Override public void print(char []buffer, int offset, int length) throws IOException { } /** * Clears the output buffer. */ @Override public void clearBuffer() { } /** * Flushes the output buffer. */ @Override public void flushBuffer() throws IOException { } }
dlitz/resin
modules/resin/src/com/caucho/server/http/StubResponseStream.java
Java
gpl-2.0
3,994
delete from user_role_assoc where application_user_id = '2'; delete from user_role_assoc where application_user_id = '3'; delete from user_role_assoc where application_user_id = '4';
lamsfoundation/lams
3rdParty_sources/tacitknowledge/autopatch/src/test/resources/com/tacitknowledge/util/migration/jdbc/test/patch0001-rollback.sql
SQL
gpl-2.0
193
#ifndef __LINUX_BIT_SPINLOCK_H #define __LINUX_BIT_SPINLOCK_H <<<<<<< HEAD #include <linux/kernel.h> #include <linux/preempt.h> #include <asm/atomic.h> ======= >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a /* * bit-based spin_lock() * * Don't use this unless you really need to: spin_lock() and spin_unlock() * are significantly faster. */ static inline void bit_spin_lock(int bitnum, unsigned long *addr) { /* * Assuming the lock is uncontended, this never enters * the body of the outer loop. If it is contended, then * within the inner loop a non-atomic test is used to * busywait with less bus contention for a good time to * attempt to acquire the lock bit. */ preempt_disable(); #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) while (unlikely(test_and_set_bit_lock(bitnum, addr))) { <<<<<<< HEAD preempt_enable(); do { cpu_relax(); } while (test_bit(bitnum, addr)); preempt_disable(); ======= while (test_bit(bitnum, addr)) { preempt_enable(); cpu_relax(); preempt_disable(); } >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a } #endif __acquire(bitlock); } /* * Return true if it was acquired */ static inline int bit_spin_trylock(int bitnum, unsigned long *addr) { preempt_disable(); #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) if (unlikely(test_and_set_bit_lock(bitnum, addr))) { preempt_enable(); return 0; } #endif __acquire(bitlock); return 1; } /* * bit-based spin_unlock() */ static inline void bit_spin_unlock(int bitnum, unsigned long *addr) { #ifdef CONFIG_DEBUG_SPINLOCK BUG_ON(!test_bit(bitnum, addr)); #endif #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) clear_bit_unlock(bitnum, addr); #endif preempt_enable(); __release(bitlock); } /* * bit-based spin_unlock() * non-atomic version, which can be used eg. if the bit lock itself is * protecting the rest of the flags in the word. */ static inline void __bit_spin_unlock(int bitnum, unsigned long *addr) { #ifdef CONFIG_DEBUG_SPINLOCK BUG_ON(!test_bit(bitnum, addr)); #endif #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) __clear_bit_unlock(bitnum, addr); #endif preempt_enable(); __release(bitlock); } /* * Return true if the lock is held. */ static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) { #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) return test_bit(bitnum, addr); #elif defined CONFIG_PREEMPT return preempt_count(); #else return 1; #endif } #endif /* __LINUX_BIT_SPINLOCK_H */
Core2idiot/Kernel-Samsung-3.0...-
include/linux/bit_spinlock.h
C
gpl-2.0
2,528
/** * Copyright (C) 2015 Chalmers REVERE * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. */ #ifndef PROXY_PROXYIMU_H #define PROXY_PROXYIMU_H #include <memory> #include <opendavinci/odcore/base/module/TimeTriggeredConferenceClientModule.h> #include <opendavinci/odcore/data/Container.h> namespace opendlv { namespace core { namespace system { namespace proxy { class PololuAltImu10Device; /** * This class provides interface to an IMU through I2C. */ class ProxyIMU : public odcore::base::module::TimeTriggeredConferenceClientModule { public: ProxyIMU(int32_t const &, char **); ProxyIMU(ProxyIMU const &) = delete; ProxyIMU &operator=(ProxyIMU const &) = delete; virtual ~ProxyIMU(); odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode body(); private: void setUp(); void tearDown(); std::unique_ptr< PololuAltImu10Device > m_device; bool m_debug; }; } } } } // opendlv::core::system::proxy #endif
chalmers-revere/opendlv.core
code/core/system/proxy-imu/include/ProxyIMU.h
C
gpl-2.0
1,647
cmd_net/xfrm/built-in.o := arm-arago-linux-gnueabi-ld -EL -r -o net/xfrm/built-in.o net/xfrm/xfrm_policy.o net/xfrm/xfrm_state.o net/xfrm/xfrm_hash.o net/xfrm/xfrm_input.o net/xfrm/xfrm_output.o net/xfrm/xfrm_algo.o net/xfrm/xfrm_sysctl.o
calixtolinux/linux-2.6.37-AM18x-OMAPL13x-Calixto-Versa-EVM-V1
net/xfrm/.built-in.o.cmd
Batchfile
gpl-2.0
244
(function($) { Drupal.total_gallery_formatter = Drupal.total_gallery_formatter || {}; Drupal.total_gallery_formatter.tgfToBoolean = function(number) { if (number) { return true; } else { return false; } }; Drupal.behaviors.totalGalleryFormatter = { attach : function(context, settings) { var carouselConfiguration = Drupal.settings.totalGalleryFormatter.galleryCarouselConfiguration; var itemsVisible = carouselConfiguration.itemsVisible; var scrollFx = carouselConfiguration.scrollFx; var direction = carouselConfiguration.direction; var slideDuration = carouselConfiguration.slideDuration; var autoplay = carouselConfiguration.autoplay; var circular = carouselConfiguration.circular; var infinite = carouselConfiguration.infinite; var colorbox = carouselConfiguration.colorbox; var easing = carouselConfiguration.easing; var pagDuration = carouselConfiguration.pagDuration; var responsive = carouselConfiguration.responsive; $('body').once('total_gallery_formatter', function() { // Pagination. var pagWidth = null; var pagItems = parseInt(itemsVisible); // Getting main image size. var mainImgWidth = null; var mainImgHeight = null; if (responsive) { mainImgWidth = parseInt($('.tgf-container .tgf-slides img:first', context).attr('width')); mainImgHeight = parseInt($('.tgf-container .tgf-slides img:first', context).attr('height')); var mainImgHeightPercent = (mainImgHeight * 100) / mainImgWidth; mainImgHeight = mainImgHeightPercent + '%'; // Responsive pagination. pagWidth = '100%'; pagItems = null; }; // Building gallery. $('.tgf-container', context).each(function(index){ var $thisCarousel = $(this); $thisCarousel.find('.tgf-slides').carouFredSel({ responsive: Drupal.total_gallery_formatter.tgfToBoolean(responsive), items : { visible : 1, width : mainImgWidth, height : mainImgHeight }, align : 'center', direction : direction, auto : Drupal.total_gallery_formatter.tgfToBoolean(autoplay), scroll : { fx : scrollFx, duration : parseInt(slideDuration), onAfter : function(data) { var slideId = $(data.items.visible[0]).attr('data-slide-id'); $thisCarousel.find('.tgf-pagination .tgf-pag-item').removeClass('selected'); $thisCarousel.find('.tgf-pagination .tgf-pag-item[data-slide-id="' + slideId + '"]').addClass('selected'); } }, prev : { button : $('.tgf-prev-button', $thisCarousel), key : 'left' }, next : { button : $('.tgf-next-button', $thisCarousel), key : 'right' }, }); $thisCarousel.find('.tgf-pagination').carouFredSel({ width : pagWidth, items : { visible : pagItems }, circular: Drupal.total_gallery_formatter.tgfToBoolean(circular), infinite: Drupal.total_gallery_formatter.tgfToBoolean(infinite), auto : false, scroll : { easing : easing, duration : parseInt(pagDuration), }, prev : { button : $thisCarousel.find('.tgf-pag-prev-button') }, next : { button : $thisCarousel.find('.tgf-pag-next-button'), } }); // Setting the selected class. $thisCarousel.find('.tgf-pagination .tgf-pag-item').each(function(index) { $(this).click(function(e) { var slideId = $(this).attr('data-slide-id'); $thisCarousel.find('.tgf-slides').trigger("slideTo", '.tgf-slide-item[data-slide-id="' + slideId + '"]'); $thisCarousel.find('.tgf-pagination .tgf-pag-item').removeClass('selected'); $(this).addClass('selected'); }); }); }); if (!$('.page-admin').length) { if (colorbox) { $('.tgf-slides a').colorbox({returnFocus:false, maxHeight:'98%', maxWidth:'98%', fixed: true}); } } }); } }; })(jQuery);
shweta-sagar/whitemag
sites/all/modules/total_gallery_formatter/js/tgf-gallery-with-carousel.js
JavaScript
gpl-2.0
4,474
<?php /** * Joomla! Content Management System * * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\User; \defined('_JEXEC') or die; /** * Interface defining a factory which can create User objects * * @since 4.0.0 */ interface UserFactoryInterface { /** * Method to get an instance of a user for the given id. * * @param int $id The id * * @return User * * @since 4.0.0 */ public function loadUserById(int $id): User; /** * Method to get an instance of a user for the given username. * * @param string $username The username * * @return User * * @since 4.0.0 */ public function loadUserByUsername(string $username): User; }
astridx/joomla-cms
libraries/src/User/UserFactoryInterface.php
PHP
gpl-2.0
825
<?php /** * radio-image Customizer Control. * * @package Kirki * @subpackage Controls * @copyright Copyright (c) 2016, Aristeides Stathopoulos * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 1.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Kirki_Controls_Radio_Image_Control' ) ) { class Kirki_Controls_Radio_Image_Control extends Kirki_Customize_Control { public $type = 'radio-image'; public function enqueue() { Kirki_Styles_Customizer::enqueue_customizer_control_script( 'kirki-radio-image', 'controls/radio-image', array( 'jquery', 'jquery-ui-button' ) ); } protected function content_template() { ?> <# if ( data.tooltip ) { #> <a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a> <# } #> <label class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-title">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </label> <div id="input_{{ data.id }}" class="image"> <# for ( key in data.choices ) { #> <input class="image-select" type="radio" value="{{ key }}" name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #>> <label for="{{ data.id }}{{ key }}"> <img src="{{ data.choices[ key ] }}"> </label> </input> <# } #> </div> <?php } } }
vvhuang/Agama2
framework/admin/kirki/includes/controls/class-kirki-controls-radio-image-control.php
PHP
gpl-2.0
1,651
---------------------------------------------------------------------------------------- -- Based on oUF_AuraWatch(by Astromech) ---------------------------------------------------------------------------------------- local _, ns = ... local oUF = ns.oUF local GUIDs = {} local PLAYER_UNITS = { player = true, vehicle = true, pet = true, } local setupGUID do local cache = setmetatable({}, {__type = "k"}) local frame = CreateFrame("Frame") frame:SetScript("OnEvent", function(self, event) for k,t in pairs(GUIDs) do GUIDs[k] = nil for a in pairs(t) do t[a] = nil end cache[t] = true end end) frame:RegisterEvent("PLAYER_REGEN_ENABLED") frame:RegisterEvent("PLAYER_ENTERING_WORLD") function setupGUID(guid) local t = next(cache) if t then cache[t] = nil else t = {} end GUIDs[guid] = t end end local function resetIcon(icon, frame, count, duration, remaining) icon:Show() if icon.cd then if duration and duration > 0 then icon.cd:SetCooldown(remaining - duration, duration) icon.cd:Show() else icon.cd:Hide() end end if icon.count then icon.count:SetText((count > 1 and count)) end if icon.overlay then icon.overlay:Hide() end icon:SetAlpha(1) end local function expireIcon(icon, frame) if icon.cd then icon.cd:Hide() end if icon.count then icon.count:SetText() end icon:SetAlpha(0) if icon.overlay then icon.overlay:Show() end icon:Show() end local found = {} local function Update(frame, event, unit) if frame.unit ~= unit then return end local watch = frame.AuraWatch local index, icons = 1, watch.watched local _, name, texture, count, duration, remaining, caster, key, icon, spellID local filter = "HELPFUL" local guid = UnitGUID(unit) if not guid then return end if not GUIDs[guid] then setupGUID(guid) end for key, icon in pairs(icons) do icon:Hide() end while true do name, _, texture, count, _, duration, remaining, caster, _, _, spellID = UnitAura(unit, index, filter) if not name then if filter == "HELPFUL" then filter = "HARMFUL" index = 1 else break end else if watch.strictMatching then key = spellID else key = name..texture end icon = icons[key] if icon and not RaidBuffsIgnore[spellID] and (icon.anyUnit or (caster and icon.fromUnits and icon.fromUnits[caster])) then resetIcon(icon, watch, count, duration, remaining) GUIDs[guid][key] = true found[key] = true end index = index + 1 end end for key in pairs(GUIDs[guid]) do if icons[key] and not found[key] then expireIcon(icons[key], watch) end end for k in pairs(found) do found[k] = nil end end local function setupIcons(self) local watch = self.AuraWatch local icons = watch.icons watch.watched = {} for _, icon in pairs(icons) do local name, _, image = GetSpellInfo(icon.spellID) if name then icon.name = name if not icon.cd and not (watch.hideCooldown or icon.hideCooldown) then local cd = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate") cd:SetAllPoints(icon) cd:SetDrawEdge(false) icon.cd = cd end if not icon.icon then local tex = icon:CreateTexture(nil, "BACKGROUND") tex:SetAllPoints(icon) tex:SetTexture(image) icon.icon = tex if not icon.overlay then local overlay = icon:CreateTexture(nil, "OVERLAY") overlay:SetTexture("Interface\\Buttons\\UI-Debuff-Overlays") overlay:SetAllPoints(icon) overlay:SetTexCoord(0.296875, 0.5703125, 0, 0.515625) overlay:SetVertexColor(1, 0, 0) icon.overlay = overlay end end if not icon.count and not (watch.hideCount or icon.hideCount) then local count = icon:CreateFontString(nil, "OVERLAY") count:SetFontObject(NumberFontNormal) count:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -1, 0) icon.count = count end if icon.fromUnits == nil then icon.fromUnits = watch.fromUnits or PLAYER_UNITS end if icon.anyUnit == nil then icon.anyUnit = watch.anyUnit end if watch.strictMatching then watch.watched[icon.spellID] = icon else watch.watched[name..image] = icon end if watch.PostCreateIcon then watch:PostCreateIcon(icon, icon.spellID, name, self) end else print(""..tostring(icon.spellID).."") end end end local function Enable(self) if self.AuraWatch then self:RegisterEvent("UNIT_AURA", Update) setupIcons(self) return true else return false end end local function Disable(self) if self.AuraWatch then self:UnregisterEvent("UNIT_AURA", Update) for _, icon in pairs(self.AuraWatch.icons) do icon:Hide() end end end oUF:AddElement("AuraWatch", Update, Enable, Disable)
davymai/CN-QulightUI
Interface/AddOns/QulightUI/Addons/UF/Raid/elements/AuraWatch.lua
Lua
gpl-2.0
4,680
<?php /*************************************************************************** * * * Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ // // $Id: chronopay_form.php 10229 2010-07-27 14:21:39Z 2tl $ // if ( !defined('AREA') ) { if (!empty($_REQUEST['cs1'])) { // Settle data is received DEFINE ('AREA', 'C'); DEFINE ('AREA_NAME' ,'customer'); require './../prepare.php'; require './../init.php'; $order_id = $_REQUEST['cs1']; $order_info = fn_get_order_info($order_id); $processor_data = $order_info['payment_method']; $inner_sign = md5($processor_data['params']['sharedsec'] . $_REQUEST['customer_id'] . $_REQUEST['transaction_id'] . $_REQUEST['transaction_type'] . $order_info['total']); if ($_REQUEST['sign'] == $inner_sign) { fwrite($fp, "\nOK"); $pp_response['order_status'] = 'P'; $pp_response["reason_text"] = 'Approved; Customer ID: ' . $_REQUEST['customer_id']; $pp_response["transaction_id"] = $_REQUEST['transaction_id']; if (fn_check_payment_script('chronopay_form.php', $order_id)) { fn_finish_payment($order_id, $pp_response); } } exit; } else { die('Access denied'); } } if (defined('PAYMENT_NOTIFICATION')) { if ($mode == 'notify') { $order_id = (int) $_REQUEST['order_id']; $order_info = fn_get_order_info($order_id); $processor_data = $order_info['payment_method']; // We are trying to avoid mess with declined and success urls $sign = md5($processor_data['params']['product_id'] . '-' . $order_info['total'] . '-' . $processor_data['params']['sharedsec']); // Because the callback comes only after return we have to make sure that this redirect is successful if (in_array($order_info['status'], array('N', 'D')) && (empty($_REQUEST['sign']) || $sign != $_REQUEST['sign'])) { $pp_response['order_status'] = 'D'; $pp_response["reason_text"] = fn_get_lang_var('text_transaction_declined'); fn_finish_payment($order_id, $pp_response, false); } else { // Set open status until callback from chronopay service is recieved fn_change_order_status($order_id, 'O', $order_info['status'], false); } fn_order_placement_routines($order_id); } } else { if (!defined('AREA') ) { die('Access denied'); } $post_url = Registry::get('config.current_location') . '/payments/chronopay_form.php'; $return_url = Registry::get('config.current_location') . "/$index_script?dispatch=payment_notification.notify&payment=chronopay_form&order_id=$order_id"; $country = db_get_field("SELECT code_A3 FROM ?:countries WHERE code = ?s", $order_info['b_country']); $product_name = ""; // Products if (!empty($order_info['items'])) { foreach ($order_info['items'] as $v) { $product_name = $product_name . str_replace(', ', ' ', $v['product']) . ",<br>\n "; } } // Certificates if (!empty($order_info['gift_certificates'])) { foreach ($order_info['gift_certificates'] as $v) { $product_name = $product_name . str_replace(', ', ' ', $v['gift_cert_code']) . ",<br>\n "; } } // Shippings if (floatval($order_info['shipping_cost'])) { foreach ($order_info['shipping'] as $v) { $product_name .= str_replace(', ', ' ', $v['shipping']) . ",<br>\n "; } } $sign = md5($processor_data['params']['product_id'] . '-' . $order_info['total'] . '-' . $processor_data['params']['sharedsec']); $lang_code = CART_LANGUAGE; echo <<<EOT <html> <body onLoad="javascript: document.process.submit();"> <form action="https://payments.chronopay.com/" method="POST" name="process"> <input type="hidden" name="product_id" value="{$processor_data['params']['product_id']}" /> <input type="hidden" name="product_name" value="{$product_name}" /> <input type="hidden" name="product_price" value="{$order_info['total']}" /> <input type="hidden" name="order_id" value="{$order_id}" /> <input type="hidden" name="cs1" value="{$order_id}" /> <input type="hidden" name="language" value="{$lang_code}" /> <input type="hidden" name="f_name" value="{$order_info['b_firstname']}" /> <input type="hidden" name="s_name" value="{$order_info['b_lastname']}" /> <input type="hidden" name="street" value="{$order_info['b_address']}" /> <input type="hidden" name="city" value="{$order_info['b_city']}" /> <input type="hidden" name="state" value="{$order_info['b_state']}" /> <input type="hidden" name="zip" value="{$order_info['b_zipcode']}" /> <input type="hidden" name="country" value="{$country}" /> <input type="hidden" name="phone" value="{$order_info['phone']}" /> <input type="hidden" name="email" value="{$order_info['email']}" /> <input type="hidden" name="cb_url" value="{$post_url}" /> <input type="hidden" name="success_url" value="{$return_url}&sign={$sign}" /> <input type="hidden" name="decline_url" value="{$return_url}" /> <input type="hidden" name="sign" value="{$sign}" /> EOT; $msg = fn_get_lang_var('text_cc_processor_connection'); $msg = str_replace('[processor]', 'Chronopay server', $msg); echo <<<EOT </form> <p><div align=center>{$msg}</div></p> </body> </html> EOT; die(); } exit; ?>
diedsmiling/busenika
payments/chronopay_form.php
PHP
gpl-2.0
5,787
# Building Angular Apps Using Flux Architecture ##### (In this video, we will take a look at Facebook's Flux design pattern, and how we can use it with Angular.js) > Flux is the application architecture that Facebook uses for building client-side web applications. It's more of a pattern rather than a formal framework, and you can start using Flux immediately without a lot of new code. [facebook flux docs](https://facebook.github.io/flux/docs/overview.html) #### (show flux diagram) The big idea behind Flux is **unidirectional data flow**. This is in sharp contrast to Angular.js, where the core principle is two-way data binding. The three main components in a Flux application are: #### (highlight diagram) + Dispatcher - a singleton event bus (of sorts) that forward actions to stores. + Stores - hold application data and logic, similar to a *model* in traditional MVC. Stores are also event emitters, so views can listen for update messages from individual stores. + Views - stateless components responsible for displaying data to, and receiving input from the user. Interestingly enough, these components map faily easily to Angular constructs: #### (highlight code implementation) + Dispatcher - can be implemented very naturally using an Angular's service object. The easiest way to implement an AppDispatcher is to instantiate Facebook's own dispatcher class as a service. + Stores - works exactly like what Angular services are meant to work, except that Angular services are not opinionated about being driven by even dispatchers. The store service would need to be an event emitter somehow, and have an instance of the dispatcher injected into it as a dependency. + Views - can be implemented as a controller bound to a view, or more interestingly, as an Angular directive. The directive would need an instance of the dispatcher so it can dispatch events when needed, as well as an instance of each store it wants to listen to. #### (here's a demo of this in action) ```` +---------------+------------------------+ | <UserBadge> | <Conversation> | +---------------+ | | <Search> | | +---------------+ | | <FriendsList> | | | | | | | | | | | | +------------------------+ | | <InputForm> | +---------------+------------------------+ ```` #### (for individual videos: Building a WhatsApp in Angular - web app) ## UserBadge directive Saturday, 11. July 2015 04:22PM
formigone/easylearntutorial
angular/flux/README.md
Markdown
gpl-2.0
2,667
<?php /* * id = ot_billsafe.php * location = /includes/modules/order_total * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * @package BillSAFE_2 * @copyright (C) 2011 Bernd Blazynski * @license GPLv2 */ class ot_billsafe { var $title, $output; function ot_billsafe() { $this->code = 'ot_billsafe'; $this->title = MODULE_ORDER_TOTAL_BILLSAFE_TITLE; $this->description = MODULE_ORDER_TOTAL_BILLSAFE_DESCRIPTION; $this->enabled = MODULE_ORDER_TOTAL_BILLSAFE_STATUS=='true'?true:false; $this->sort_order = MODULE_ORDER_TOTAL_BILLSAFE_SORT_ORDER; $this->output = array(); $this->amount = 0; $this->original_total = 0; $this->amounts = array(); $this->schg = array(); } function process() { global $order, $xtPrice; if ($this->enabled) { if ($_SESSION['payment'] == 'billsafe_2') { $this->xtc_order_total(); $this->calc_schg(); if ($this->schg['amount'] != 0) { if (stristr(MODULE_PAYMENT_BILLSAFE_2_SCHG, '%')) { $this->output[] = array('title' => MODULE_PAYMENT_BILLSAFE_2_SCHG.'&nbsp;'.MODULE_ORDER_TOTAL_BILLSAFE_SCHG, 'text' => $xtPrice->xtcFormat($this->schg['amount'], true), 'value' => $this->schg['amount']); } else { $this->output[] = array('title' => MODULE_ORDER_TOTAL_BILLSAFE_SCHG, 'text' => $xtPrice->xtcFormat($this->schg['amount'], true), 'value' => $this->schg['amount']); } $order->info['total'] += $this->schg['amount']; // $order->info['tax'] += $this->schg['tax']; } } } } function calc_schg() { global $order; if (MODULE_PAYMENT_BILLSAFE_2_SCHG != '') { $schg_tax_rate = xtc_get_tax_rate(MODULE_PAYMENT_BILLSAFE_2_SCHGTAX); $schg_tax_name = xtc_get_tax_description(MODULE_PAYMENT_BILLSAFE_2_SCHGTAX); if (stristr(MODULE_PAYMENT_BILLSAFE_2_SCHG, '%')) { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) { $schg_amount = xtc_add_tax(($this->amount * MODULE_PAYMENT_BILLSAFE_2_SCHG / 100), $schg_tax_rate); $schg_amount_calc = $this->amount * MODULE_PAYMENT_BILLSAFE_2_SCHG / 100; } else { $schg_amount = $this->amount * MODULE_PAYMENT_BILLSAFE_2_SCHG / 100; $schg_amount_calc = $this->amount * MODULE_PAYMENT_BILLSAFE_2_SCHG / 100; } } else { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) { $schg_amount = xtc_add_tax(MODULE_PAYMENT_BILLSAFE_2_SCHG, $schg_tax_rate); $schg_amount_calc = MODULE_PAYMENT_BILLSAFE_2_SCHG; } else { $schg_amount = MODULE_PAYMENT_BILLSAFE_2_SCHG; $schg_amount_calc = MODULE_PAYMENT_BILLSAFE_2_SCHG; } } $schg_tax = $schg_amount_calc * $schg_tax_rate / 100; } else { $schg_amount = 0; $schg_tax = 0; } if ($schg_tax_rate && ($schg_tax > 0)) { reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if (strpos($key, $schg_tax_rate.'%')) { $order->info['tax_groups'][$key] += $schg_tax; } else { $order->info['tax_groups'][TAX_ADD_TAX.$schg_tax_name] += $schg_tax; } } } $this->schg['amount'] = $schg_amount; $this->schg['tax'] = $schg_tax; } function xtc_order_total() { global $order; $order_total = $order->info['total']; $products = $_SESSION['cart']->get_products(); for ($i=0; $i < sizeof($products); $i++) { $prid = xtc_get_prid($products[$i]['id']); $gv_query = xtc_db_query('SELECT products_price, products_tax_class_id, products_model FROM '.TABLE_PRODUCTS.' WHERE products_id = "'.$prid.'"'); $gv_result = xtc_db_fetch_array($gv_query); $qty = $_SESSION['cart']->get_quantity($products[$i]['id']); $products_tax = xtc_get_tax_rate($gv_result['products_tax_class_id']); if (preg_match('/^GIFT/', addslashes($gv_result['products_model']))) { if ($this->include_tax =='false') { $gv_amount = $gv_result['products_price'] * $qty; } else { $gv_amount = ($gv_result['products_price'] + xtc_calculate_tax($gv_result['products_price'],$products_tax)) * $qty; } $order_total -= $gv_amount; } else { $this->amounts[(string)$products_tax] += $gv_result['products_price'] * (int)$qty; $this->amounts['total'] += $gv_result['products_price'] * $qty; } } $this->amount = $order_total; } function check() { if (!isset($this->check)) { $check_query = xtc_db_query('SELECT configuration_value FROM '.TABLE_CONFIGURATION.' WHERE configuration_key = "MODULE_ORDER_TOTAL_BILLSAFE_STATUS"'); $this->check = xtc_db_num_rows($check_query); } return $this->check; } function install() { xtc_db_query('INSERT INTO '.TABLE_CONFIGURATION.' (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ("MODULE_ORDER_TOTAL_BILLSAFE_STATUS", "true", "6", "1", "xtc_cfg_select_option(array(\'true\', \'false\'), ", now())'); xtc_db_query('INSERT INTO '.TABLE_CONFIGURATION.' (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ("MODULE_ORDER_TOTAL_BILLSAFE_SORT_ORDER", "39", "6", "2", now())'); } function keys() { $keys = array(); $check_query = xtc_db_query('SELECT configuration_key FROM '.TABLE_CONFIGURATION.' WHERE configuration_key LIKE "MODULE_ORDER_TOTAL_BILLSAFE_%" ORDER BY sort_order'); while ($key = xtc_db_fetch_array($check_query)) $keys[] = $key['configuration_key']; return $keys; } function remove() { xtc_db_query('DELETE FROM '.TABLE_CONFIGURATION.' WHERE configuration_key LIKE "MODULE_ORDER_TOTAL_BILLSAFE_%"'); } } ?>
commerceseo/v2next
includes/modules/order_total/ot_billsafe.php
PHP
gpl-2.0
6,027
<?php $kses_filter = array( 'input' => array( 'type' => array(), 'name' => array(), 'id' => array(), 'class' => array(), 'value' => array(), ), ); $clear_api_cache_button = get_submit_button( __( 'Clear Cache', 'wp-rest-api-controller' ), 'secondary', 'clear-wp-rest-api-controller-cache' ); $save_settings_button = get_submit_button( __( 'Save Settings', 'wp-rest-api-controller' ), 'primary', 'save-wp-rest-api-controller-settings' ); ?> <h2><?php esc_html_e( 'WP REST API Controller Settings', 'wp-rest-api-controller' ); ?></h2> <form method="POST" action="options.php"> <?php settings_fields( 'wp-rest-api-controller' ); do_settings_sections( 'wp-rest-api-controller' ); wp_nonce_field( 'clear_wp_rest_api_controller_cache', 'clear_wp_rest_api_controller_cache' ); echo wp_kses_post( '<div class="submit-buttons">' ); echo wp_kses( $save_settings_button, $kses_filter ); echo '<span class="top-right tipso delete-rest-api-cache-tipso" data-tipso-title="' . esc_attr__( 'Delete REST API Cache', 'wp-rest-api-controller' ) . '" data-tipso="' . esc_attr__( 'Clear the WP REST API Cache stored in this plugin. If you recently registered a new post type, or assigned new meta data to a post - click this to update the lists above.', 'wp-rest-api-controller' ) . '">'; echo wp_kses( $clear_api_cache_button, $kses_filter ); echo '</span>'; echo wp_kses_post( '</div>' ); ?> </form>
yikesinc/wp-rest-api-controller
admin/partials/settings-page.php
PHP
gpl-2.0
1,472
<?php /* SLO Cloud - A Cloud-Based SLO Reporting Tool for Higher Education This is a peer-reviewed, open-source, public project made possible by the Open Innovation in Higher Education project. Copyright (C) 2015 Jesse Lawson, San Bernardino Community College District Contributors: Jesse Lawson Jason Brady THIS PROJECT IS LICENSED UNDER GPLv2. YOU MAY COPY, DISTRIBUTE AND MODIFY THE SOFTWARE AS LONG AS YOU TRACK CHANGES/DATES OF IN SOURCE FILES AND KEEP ALL MODIFICATIONS UNDER GPL. YOU CAN DISTRIBUTE YOUR APPLICATION USING A GPL LIBRARY COMMERCIALLY, BUT YOU MUST ALSO DISCLOSE THE SOURCE CODE. GNU General Public License Version 2 Disclaimer: --- This file is part of SLO Cloud SLO Cloud is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later. SLO Cloud is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit http://opensource.org/licenses/GPL-2.0 --- */ use Doctrine\DBAL\Types\Type; if (file_exists('./vendor')) { require_once './vendor/autoload.php'; } else { require_once '../vendor/autoload.php'; } Type::addType('utc_datetime', 'SLOCloud\Model\Storage\Mapping\UTCDateTimeType');
lawsonry/slocloud
src/bootstrap.php
PHP
gpl-2.0
1,650
#ifndef _GTKUTIL_ICONV_H #define _GTKUTIL_ICONV_H #include <glib/gconvert.h> #include <glib/gmessages.h> #include <glib/gunicode.h> #include <glib/gmem.h> #include <string> #include <cassert> namespace gtkutil { /** * greebo: This is a wrapper class around the iconv functions. * Many codeparts have been taken from the GLib::IConv * class in the glibmm 2.14.2 library. */ class IConv { private: GIConv gobject_; public: /** Open new conversion descriptor. * @param to_codeset Destination codeset. * @param from_codeset %Source codeset. */ IConv (const std::string& to_codeset, const std::string& from_codeset) : gobject_(g_iconv_open(to_codeset.c_str(), from_codeset.c_str())) { if (gobject_ == reinterpret_cast<GIConv> (-1)) { GError* gerror = 0; // Abuse g_convert() to create a GError object. This may seem a weird // thing to do, but it gives us consistently translated error messages // at no further cost. g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), 0, 0, &gerror); // If this should ever fail we're fucked. assert(gerror != 0); } } /** Close conversion descriptor. */ ~IConv () { g_iconv_close(gobject_); } /** Same as the standard UNIX routine %iconv(), but may be implemented * via libiconv on UNIX flavors that lack a native implementation. glibmm * provides Glib::convert() and Glib::locale_to_utf8() which are likely * more convenient than the raw iconv wrappers. * @param inbuf Bytes to convert. * @param inbytes_left In/out parameter, bytes remaining to convert in @a inbuf. * @param outbuf Converted output bytes. * @param outbytes_left In/out parameter, bytes available to fill in @a outbuf. * @return Count of non-reversible conversions, or <tt>static_cast<size_t>(-1)</tt> on error. */ size_t iconv (char** inbuf, gsize* inbytes_left, char** outbuf, gsize* outbytes_left) { return g_iconv(gobject_, inbuf, inbytes_left, outbuf, outbytes_left); } /** Reset conversion descriptor to initial state. * Same as <tt>iconv(0, 0, 0, 0)</tt>, but implemented slightly differently * in order to work on Sun Solaris <= 7. It's also more obvious so you're * encouraged to use it. */ void reset () { // Apparently iconv() on Solaris <= 7 segfaults if you pass in // NULL for anything but inbuf; work around that. (NULL outbuf // or NULL *outbuf is allowed by Unix98.) char* outbuf = 0; gsize inbytes_left = 0; gsize outbytes_left = 0; g_iconv(gobject_, 0, &inbytes_left, &outbuf, &outbytes_left); } /** Convert from one encoding to another. * @param str The string to convert. * @return The converted string. * @throw Glib::ConvertError */ std::string convert (const std::string& str) { gsize bytes_written = 0; GError* gerror = 0; char * const buf = g_convert_with_iconv(str.data(), static_cast<gssize> (str.size()), gobject_, 0, &bytes_written, &gerror); if (gerror) { return ""; } std::string returnValue(buf, bytes_written); g_free(buf); return returnValue; } GIConv gobj () { return gobject_; } /** * greebo: Converts the given string to UTF-8 encoding. * Returns an empty string if the conversion fails. */ static std::string localeToUTF8 (const std::string& input) { gsize bytes_written = 0; GError* gerror = 0; char * const buf = g_locale_to_utf8(input.data(), static_cast<gssize> (input.size()), 0, &bytes_written, &gerror); if (gerror) return ""; std::string returnValue(buf, bytes_written); g_free(buf); return returnValue; } /** * greebo: Converts the given string from UTF-8 to the current locale. * Returns an empty string if the conversion fails. */ static std::string localeFromUTF8 (const std::string& input) { gsize bytes_written = 0; GError* gerror = 0; char * const buf = g_locale_from_utf8(input.data(), static_cast<gssize> (input.size()), 0, &bytes_written, &gerror); if (gerror) return ""; std::string returnValue(buf, bytes_written); g_free(buf); return returnValue; } static bool isUTF8() { return g_get_charset(NULL); } /** * greebo: Converts the given filename to UTF-8. * Returns an empty string if the conversion fails. */ static std::string filenameToUTF8 (const std::string& input) { gsize bytes_written = 0; GError* gerror = 0; char * const buf = g_filename_to_utf8(input.data(), static_cast<gssize> (input.size()), 0, &bytes_written, &gerror); if (gerror) return ""; std::string returnValue(buf, bytes_written); g_free(buf); return returnValue; } }; } // namespace gtkutil #endif /* _GTKUTIL_ICONV_H */
chrisglass/ufoai
src/tools/radiant/libs/gtkutil/IConv.h
C
gpl-2.0
4,912
CC=sdcc NO_OPT=--nogcse --noinvariant --noinduction --nojtbound --noloopreverse \ --nolabelopt --nooverlay --peep-asm DEBUG=--debug CFLAGS=--model-large $(DEBUG) --less-pedantic \ --no-peep --int-long-reent --float-reent \ --data-loc 0x30 LDFLAGS=--out-fmt-ihx LDFLAGS_RAM=$(LDFLAGS) --code-loc 0xf000 --xram-loc 0xf800 --xram-size 1024 LDFLAGS_FLASH=$(LDFLAGS) --code-loc 0x0000 --xram-loc 0xf000 --xram-size 1024 SRC=serial.c ADB=$(SRC:.c=.adb) ASM=$(SRC:.c=.asm) LNK=$(SRC:.c=.lnk) LST=$(SRC:.c=.lst) REL=$(SRC:.c=.rel) RST=$(SRC:.c=.rst) SYM=$(SRC:.c=.sym) PROGS=serial-flash.ihx serial-ram.ihx PCDB=$(PROGS:.ihx=.cdb) PLNK=$(PROGS:.ihx=.lnk) PMAP=$(PROGS:.ihx=.map) PMEM=$(PROGS:.ihx=.mem) PAOM=$(PROGS:.ihx=) %.rel : %.c $(CC) -c $(CFLAGS) -o$*.rel $< all: $(PROGS) serial-ram.ihx: $(REL) Makefile $(CC) $(LDFLAGS_RAM) $(CFLAGS) -o serial-ram.ihx $(REL) $(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o serial-flash.ihx $(REL) serial-flash.ihx: serial-ram.ihx clean: rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM) rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM) install:
ajtowns/altos
ao-tools/target/serial/Makefile
Makefile
gpl-2.0
1,098
<table id="table" class="pure-table pure-table-horizontal table"> <thead> <tr> <th>#</th> <th>Handle</th> <th>Offensive Points</th> <th>Development Points</th> <th>Total Points</th> </tr> </thead> <tbody> {% for leader in leaders %} <tr onclick="document.location='/user/{{leader['username']}}';" > {% if page is defined and count is defined %} <td>{{count*page+leaders.index(leader)}}</td> {% else %} <td>{{leaders.index(leader)}}</td> {% endif %} <td>{{leader['username']}}</td> <td>{{leader['attack_points']}}</td> <td>{{leader['challenge_points']}}</td> <td>{{leader['challenge_points']+leader['attack_points']}} </tr> {% endfor %} </tbody> </table>
coldwaterq/want2hack
app/templates/injects/_leaderboard.html
HTML
gpl-2.0
758
<?php namespace Augwa\ShortUrlBundle\Controller; /** * Class UserFactoryController * @package Augwa\ShortUrlBundle\Controller */ class UserFactoryController extends FactoryController { /** * @return UserController */ public function make() { $user = new UserController; $user->setContainer($this->container); return $user; } }
augwa/short-url
src/Augwa/ShortUrlBundle/Controller/UserFactoryController.php
PHP
gpl-2.0
383
/* * 3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73 * * NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask(). * * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. */ #if HAVE_CONFIG_H #include "config.h" #endif #include <pthread.h> #include <signal.h> #include <errno.h> #include <rtems/system.h> #include <rtems/posix/pthread.h> #include <rtems/posix/psignal.h> #include <rtems/seterr.h> int pthread_sigmask( int how, const sigset_t *set, sigset_t *oset ) { POSIX_API_Control *api; if ( !set && !oset ) rtems_set_errno_and_return_minus_one( EINVAL ); api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; if ( oset ) *oset = api->signals_blocked; if ( !set ) return 0; switch ( how ) { case SIG_BLOCK: api->signals_blocked |= *set; break; case SIG_UNBLOCK: api->signals_blocked &= ~*set; break; case SIG_SETMASK: api->signals_blocked = *set; break; default: rtems_set_errno_and_return_minus_one( EINVAL ); } /* XXX are there critical section problems here? */ /* XXX evaluate the new set */ if ( ~api->signals_blocked & (api->signals_pending | _POSIX_signals_Pending) ) { _Thread_Dispatch(); } return 0; }
yangxi/omap4m3
cpukit/posix/src/pthreadsigmask.c
C
gpl-2.0
1,475
/*************************************************************************** Copyright (C) 2005-2009 Robby Stephenson <robby@periapsis.org> ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License or (at your option) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * ***************************************************************************/ #include "datefieldwidget.h" #include "datewidget.h" #include "../field.h" using Tellico::GUI::DateFieldWidget; DateFieldWidget::DateFieldWidget(Tellico::Data::FieldPtr field_, QWidget* parent_) : FieldWidget(field_, parent_) { m_widget = new DateWidget(this); connect(m_widget, &DateWidget::signalModified, this, &DateFieldWidget::checkModified); registerWidget(); } QString DateFieldWidget::text() const { return m_widget->text(); } void DateFieldWidget::setTextImpl(const QString& text_) { m_widget->setDate(text_); } void DateFieldWidget::clearImpl() { m_widget->clear(); editMultiple(false); } QWidget* DateFieldWidget::widget() { return m_widget; }
KDE/tellico
src/gui/datefieldwidget.cpp
C++
gpl-2.0
2,371
--- layout: post title: "Java Generics" date: 2016-10-30 14:49:52 categories: java generics published: true comments: true thread: 20161030145055555 --- Java 泛型 --- ## 为什么要使用泛型 使用泛型的好处: - 编译期的强类型检查 - 去除类型的强制转换 - 使程序员能实现通用算法 ## 泛型类型(Generic Types) 泛型类型是class/interface的类型参数化。 ```java public class Box { private Object object; public void set(Object object) { this.object = object; } public Object get() { return object; } } ``` 泛型版本的代码: ```java public class Box<T>{ private T t; public void set(T t) {this.t = t;} public T get() { return t;} } ``` ## 泛型类型参数命名规约(Type Parameter Naming Conventions) 类型参数命名是单个大写的字母,常用的命名: - E 元素(Java 集合框架广泛使用) - K key - N Number - T Type - V Value - S,U V etc. 2nd, 3rd, 4th types ## 调用&实例化一个泛型 代码中引用Box泛型类,你必须执行一个泛型类型调用,使用具体值替换T,比如Integer。 ```java Box<Integer> integerBox; Terminology: - Type Parameter = 'T' - Type Argument = 'Integer' - Parameterized type = 'Box<Integer>' 泛型类型的一次调用通常被称为一个 parameterized type. - Raw Type= 'Box raw = new Box();' ``` ## 泛型,继承和子类型(Generics, Inheritance, and Subtypes) 考虑一下方法的定义: ```java public void boxTest(Box<Number> n) { /** * */ } ``` 调用该方法是,传入Box<Integer>/Box<Double>是变异不通过的,因为, Box<Integer>和Box<Double>不是Box<Number>的子类。
lanceliu/lanceliu.github.io
_posts/2016-10-30-java-generics.md
Markdown
gpl-2.0
1,666
/* * Distributed bus system for robotic applications * Copyright (C) 2009 University of Cambridge * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package uk.ac.cam.dbs; import static uk.ac.cam.dbs.util.ByteBufferHelper.numFromBytes; import static uk.ac.cam.dbs.util.ByteBufferHelper.numToBytes; import java.io.IOException; import java.util.Vector; import java.util.Hashtable; import java.util.Iterator; import java.util.Enumeration; /** <p>Clock synchronisation protocol implementation.</p> * * <p>The clock synchronisation protocol works on a peer-to-peer basis, * attempting to synchronise to a network clock that is the average of * the internal clocks of all the devices on the network.</p> */ public class ClockSync extends TimeProvider implements DMPMessageListener, Runnable { private static final int PORT = 50123; private static final int UPDATE_PERIOD = 1000; private static final int MAX_STORE_SIZE = 5; /* Contains RecvRecord, keyed by BusConnection */ private Hashtable recvStore; /* Contains SendRecord (sent time), keyed by seq % sentStore.size() */ private long[] sentStore; private Object offsetLock; private long offset; private Object seqLock; private int seq; /* Contains *previous* sequence number */ private double gain; private TimeProvider internalTime; /** Create a new ClockSync service. */ public ClockSync() { this(TimeProvider.systemTimeProvider()); } /** Create a new ClockSync service using a given reference * clock. This is mostly intended for testing. * * @param internalTime TimeProvider instance that the ClockSync * should use as its "reference time". */ public ClockSync(TimeProvider internalTime) { this.internalTime = internalTime; recvStore = new Hashtable(); sentStore = new long[10]; offset = 0; offsetLock = new Object(); seq = 0; seqLock = new Object(); gain = 1.0; } /** Get the current clock offset estimate. * * @return the estimated difference between the internal clock * source and the network clock. */ public long getOffset(long offset) { return offset; } /** <p>Run the clock synchronisation service. Should be executed in * its own thread, e.g.:</p> * * <code>ClockSync service = new ClockSync(); * Thread clockSyncThread = new Thread(service); * clockSyncThread.setDaemon(true); * clockSyncThread.start();</code> * * <p>The function first binds itself to a DMP port. It then * enters a loop which repeatedly sends out clock sync protocol * messages, and updates the current clock estimate based on any * messages that have been received.</p> * */ public void run() { try { SystemBus.getSystemBus().addDMPService(this, PORT); } catch (DMPBindException e) { System.err.println("Could not start clock sync service: " + e.getMessage()); return; } while (true) { /* Send clock sync messages */ Vector connections = SystemBus.getSystemBus().getConnections(); synchronized (connections) { for (int i = 0; i < connections.size(); i++) { try { sendMessage((BusConnection) connections.elementAt(i)); } catch (IOException e) { System.err.println("Failed to send clock message: " + e.getMessage()); continue; } } } /* Sleep for UPDATE_PERIOD + a random delay between 0 and * UPDATE_PERIOD/2. This is to avoid multiple devices * phase-locking their clock sync loops. */ try { int sleepTime = (int) (UPDATE_PERIOD * (1.0 + Math.random() / 2)); Thread.sleep(sleepTime); } catch (InterruptedException e) { System.err.println("Stopping clock sync service."); break; } /* Update estimate */ updateOffset(); } SystemBus.getSystemBus().removeDMPService(this, -1); } /** Get the current estimate of network time. * * @return the current network time estimate in milliseconds. */ public long currentTimeMillis() { long sysTime = internalTime.currentTimeMillis(); return sysTime + offset; } /** Process a clock protocol message. Calculates the roundtrip * latency, and stores message information for the next update to * the clock offset estimate. * * @param connection The connection that the message arrived on. * @param msg The message that was received. */ public void recvDMPMessage(BusConnection connection, DMPMessage msg) { long localTime = System.currentTimeMillis(); /* Parse the message payload */ byte[] buf = msg.getPayload(); if (buf.length != 24) { /* The message appears to be invalid. */ return; } int recvSeq = (int) numFromBytes(buf, 0, 4); long remoteTime = numFromBytes(buf, 4, 8); int oldSeq = (int) numFromBytes(buf, 12, 4); long holdTime = numFromBytes(buf, 16, 8); /* Calculate the latency if we can */ long sentTime = -1; long roundTrip = 0; boolean roundTripValid = false; synchronized (sentStore) { if ((oldSeq == 0) || (oldSeq <= this.seq - 10)) { sentTime = -1; } else { sentTime = sentStore[oldSeq % sentStore.length]; } } if (sentTime >= 0) { roundTrip = localTime - sentTime - holdTime; roundTripValid = true; } /* Do all the synchronized operations last, in one go, to * avoid problems with added latency while waiting to * synchronise */ RecvRecord rec = null; synchronized (recvStore) { rec = (RecvRecord) recvStore.get(connection); if (rec == null) { rec = this.new RecvRecord(); recvStore.put(connection, rec); } synchronized (rec) { rec.seq = recvSeq; rec.remoteTime = remoteTime; rec.localTime = localTime; rec.roundTrip = roundTrip; rec.roundTripValid = roundTripValid; rec.usedForUpdate = false; } } } /** Entry in the record of received packets. */ private class RecvRecord { int seq; long localTime; long remoteTime; long roundTrip; boolean roundTripValid; boolean usedForUpdate; RecvRecord() { roundTripValid = false; usedForUpdate = false; } } /** Send a clock sync message */ private void sendMessage (BusConnection connection) throws IOException { RecvRecord rec = null; synchronized (recvStore) { rec = (RecvRecord) recvStore.get(connection); } long now = internalTime.currentTimeMillis(); byte[] payload = new byte[24]; /* Get the next sequence number */ /* Ensure we never send out a message with seq=0 */ int seq = 0; synchronized (seqLock) { while (seq == 0) { seq = ++this.seq; } } /* Did we receive a message from this connection? */ int oldSeq = 0; long holdTime = 0; if (rec != null) { oldSeq = rec.seq; holdTime = now - rec.localTime; } /* Pack data into the message payload */ numToBytes(seq, payload, 0, 4); numToBytes(now+offset, payload, 4, 8); numToBytes(oldSeq, payload, 12, 4); numToBytes(holdTime, payload, 16, 8); /* Send message */ DMPMessage msg = new DMPMessage(PORT, payload); /* Add to record of sent messages */ synchronized(sentStore) { sentStore[seq % sentStore.length] = now; } SystemBus.getSystemBus().sendDMPMessage(connection, msg); } /** Uses the received messages to calculate a new clock offset. */ private void updateOffset () { synchronized (recvStore) { Enumeration conns = recvStore.keys(); int N = SystemBus.getSystemBus().getConnections().size(); double e = 0.0; synchronized (offsetLock) { while (conns.hasMoreElements()) { Object k = conns.nextElement(); RecvRecord rec = (RecvRecord) recvStore.get(k); synchronized (rec) { if (rec.roundTripValid && !rec.usedForUpdate) { e += rec.remoteTime + rec.roundTrip/2 - rec.localTime - offset; rec.usedForUpdate = true; } } } offset += (long) gain * e / (N+1.0); } } } }
peter-b/distributed-bus-system
nxt-src/uk/ac/cam/dbs/ClockSync.java
Java
gpl-2.0
10,111