content
stringlengths
4
1.04M
lang
stringclasses
358 values
score
int64
0
5
repo_name
stringlengths
5
114
repo_path
stringlengths
4
229
repo_licenses
listlengths
1
8
# This file is a part of Julia. License is MIT: https://julialang.org/license using Test, Libdl, OpenLibm_jll @testset "OpenLibm_jll" begin @test ccall((:isopenlibm, libopenlibm), Cint, ()) == 1 end
Julia
4
jonas-schulze/julia
stdlib/OpenLibm_jll/test/runtests.jl
[ "MIT" ]
import {Component, NgModule} from '@angular/core'; @Component({ selector: 'my-component', template: `<div class="grape" [attr.class]="'banana'" [class.apple]="yesToApple" [class]="myClassExp" [class.orange]="yesToOrange"></div>` }) export class MyComponent { myClassExp = {a: true, b: true}; yesToApple = true; yesToOrange = true; } @NgModule({declarations: [MyComponent]}) export class MyModule { }
TypeScript
4
John-Cassidy/angular
packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/class_bindings/class_ordering.ts
[ "MIT" ]
-include ../../run-make-fulldeps/tools.mk OUTPUT_DIR := "$(TMPDIR)/rustdoc" all: $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
Makefile
4
ohno418/rust
src/test/run-make/rustdoc-with-output-option/Makefile
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
data { int<lower=1> N; // number of observations int<lower=1> R; // number of suspect races int<lower=1> D; // number of counties int<lower=1,upper=R> r[N]; // race of suspect int<lower=1,upper=D> d[N]; // county where stop occurred int<lower=1> n[N]; // # of stops int<lower=0> s[N]; // # of searches int<lower=0> h[N]; // # of successful searches (hits) } parameters { // hyperparameters real<lower=0> sigma_t; #standard deviation for the normal the thresholds are drawn from. // search thresholds vector[R] t_r; vector[N] t_i_raw; // parameters for signal distribution vector[R] phi_r; vector[D-1] phi_d_raw; real mu_phi; vector[R] delta_r; vector[D-1] delta_d_raw; real mu_delta; } transformed parameters { vector[D] phi_d; vector[D] delta_d; vector[N] phi; vector[N] delta; vector[N] t_i; vector<lower=0, upper=1>[N] search_rate; vector<lower=0, upper=1>[N] hit_rate; real successful_search_rate; real unsuccessful_search_rate; phi_d[1] = 0; phi_d[2:D] = phi_d_raw; delta_d[1] = 0; delta_d[2:D] = delta_d_raw; t_i = t_r[r] + t_i_raw * sigma_t; for (i in 1:N) { // phi is the fraction of people of race r, d who are guilty (ie, carrying contraband) phi[i] = inv_logit(phi_r[r[i]] + phi_d[d[i]]); // mu is the center of the guilty distribution. delta[i] = exp(delta_r[r[i]] + delta_d[d[i]]); successful_search_rate = phi[i] * (1 - normal_cdf(t_i[i], delta[i], 1)); unsuccessful_search_rate = (1 - phi[i]) * (1 - normal_cdf(t_i[i], 0, 1)); search_rate[i] = (successful_search_rate + unsuccessful_search_rate); hit_rate[i] = successful_search_rate / search_rate[i]; } } model { // Draw threshold hyperparameters sigma_t ~ normal(0, 1); // Draw race parameters. Each is centered at a mu, and we allow for inter-race heterogeneity. mu_phi ~ normal(0, 1); mu_delta ~ normal(0, 1); phi_r ~ normal(mu_phi, .1); delta_r ~ normal(mu_delta, .1); t_r ~ normal(0, 1); // Draw department parameters (for un-pinned departments) phi_d_raw ~ normal(0, .1); delta_d_raw ~ normal(0, .1); //thresholds t_i_raw ~ normal(0, 1); s ~ binomial(n, search_rate); h ~ binomial(s, hit_rate); }
Stan
5
stan-dev/stancon_talks
2018/Contributed-Talks/11_simoiu/threshold_test.stan
[ "CC-BY-4.0", "BSD-3-Clause" ]
#pragma rtGlobals=3 #pragma version=1.3 #pragma IgorVersion = 6.3.0 #pragma IndependentModule=CodeBrowserModule #include "CodeBrowser_gui" #include <Resize Controls> // Copyright (c) 2019, () byte physics support@byte-physics.de // All rights reserved. // // This source code is licensed under the BSD 3-Clause license found in the // LICENSE file in the root directory of this source tree. // // source: https://github.com/byte-physics/igor-code-browser/blob/6a1497795f606d9d837d4012cbb4bbc481af3683/procedures/CodeBrowser.ipf Menu "CodeBrowser" // CTRL+0 is the keyboard shortcut "Open/0", /Q, CodeBrowserModule#CreatePanel() "Reset", /Q, CodeBrowserModule#ResetPanel() End // Markers for the different listbox elements StrConstant strConstantMarker = "\\W539" StrConstant constantMarker = "\\W534" Function addDecoratedStructure(text, declWave, lineWave, [parseVariables]) WAVE/T text WAVE/T declWave WAVE/D lineWave Variable parseVariables if(paramIsDefault(parseVariables) | parseVariables != 1) parseVariables = 1 // added for debugging endif variable numLines, idx, numEntries, numMatches string procText, reStart, name, StaticKeyword Wave/T helpWave = getHelpWave() // regexp: match case insensitive (?i) leading spaces don't matter. optional static statement. search for structure name which contains no spaces. followed by an optional space and nearly anything like inline comments // help for regex on https://regex101.com/ reStart = "^(?i)[[:space:]]*((?:static[[:space:]])?)[[:space:]]*structure[[:space:]]+([^[:space:]\/]+)[[:space:]\/]?.*" Grep/Q/INDX/E=reStart text Wave W_Index Duplicate/FREE W_Index wavStructureStart KillWaves/Z W_Index KillStrings/Z S_fileName WaveClear W_Index if(!V_Value) // no matches return 0 endif numMatches = DimSize(wavStructureStart, 0) // optionally analyze structure elements if(parseVariables) // regexp: match case insensitive endstructure followed by (space or /) and anything else or just a lineend // does not match endstructure23 but endstructure// Grep/Q/INDX/E="^(?i)[[:space:]]*(?:endstructure(?:[[:space:]]|\/).*)|endstructure$" text Wave W_Index Duplicate/FREE W_Index wavStructureEnd KillWaves/Z W_Index KillStrings/Z S_fileName WaveClear W_Index if(numMatches != DimSize(wavStructureEnd, 0)) numMatches = 0 return 0 endif endif numEntries = DimSize(declWave, 0) Redimension/N=(numEntries + numMatches, -1) declWave, lineWave, helpWave for(idx = numEntries; idx < (numEntries + numMatches); idx +=1) SplitString/E=reStart text[wavStructureStart[(idx - numEntries)]], StaticKeyword, name declWave[idx][0] = createMarkerForType(LowerStr(StaticKeyword) + "structure") // no " " between static and structure needed declWave[idx][1] = name // optionally parse structure elements if(parseVariables) Duplicate/FREE/R=[(wavStructureStart[(idx - numEntries)]),(wavStructureEnd[(idx - numEntries)])] text, temp declWave[idx][1] += getStructureElements(temp) WaveClear temp endif lineWave[idx] = wavStructureStart[(idx - numEntries)] endfor WaveClear wavStructureStart, wavStructureEnd End /// @brief Return the text of the given procedure as free wave splitted at the EOL static Function/WAVE getProcedureTextAsWave(module, procedureWithoutModule) string module, procedureWithoutModule string procText variable numLines // get procedure code procText = getProcedureText("", 0, module, procedureWithoutModule) #if (IgorVersion() >= 7.0) return ListToTextWave(procText, "\r") #else numLines = ItemsInList(procText, "\r") if(numLines == 0) Make/FREE/N=(numLines)/T wv return wv endif Make/FREE/N=(numLines)/T wv = StringFromList(p, procText, "\r") return wv #endif End // add basic html Function/S AddHTML(context) string context string line, html, re string str0, str1, str2, str3, str4 variable n, lines html = "" lines = ItemsInList(context, "\r") for(n = 0; n < lines; n += 1) line = StringFromList(n, context, "\r") re = "\s*([\/]{2,})\s?(.*)" SplitString/E=(re) line, str0, str1 if(V_flag != 2) break endif line = str1 if(strlen(str0) == 3) // Doxygen comments re = "(?i)(.*@param(?:\[(?:in|out)\])?\s+)(\w+)(\s.*)" SplitString/E=(re) line, str0, str1, str2 if(V_flag == 3) line = str0 line += "<b>" + str1 + "</b> " line += str2 endif re = "(?i)(.*)@(\w+)(\s.*)" SplitString/E=(re) line, str0, str1, str2 if(V_flag == 3) line = str0 line += "<b>@</b><i>" + str1 + "</i>" line += str2 endif endif html += line + "<br>" endfor html = RemoveEnding(html, "<br>") html = "<code>" + html + "</code>" return html End // get code of procedure in module // // see `DisplayHelpTopic("ProcedureText")` // // @param funcName Name of Function. Leave blank to get full procedure text // @param linesOfContext line numbers in addition to the function definition. Set to @c 0 to return only the function. // set to @c -1 to return lines before the procedure that are not part of the preceding macro or function // @param module independent module // @param procedure procedure without module definition // @return multi-line string with function definition Function/S getProcedureText(funcName, linesOfContext, module, procedure) string funcName, module, procedure variable linesOfContext if(!isProcGlobal(module)) debugPrint(procedure + " is not in ProcGlobal") procedure = procedure + " [" + module + "]" endif return ProcedureText(funcName, linesOfContext, procedure) End // Returns a list of independent modules // Includes ProcGlobal but skips all WM modules and the current module in release mode Function/S getModuleList() String moduleList moduleList = IndependentModuleList(";") moduleList = ListMatch(moduleList, "!WM*", ";") // skip WM modules moduleList = ListMatch(moduleList, "!RCP*", ";") // skip WM's Resize Controls modul String module = GetIndependentModuleName() moduleList = "ProcGlobal;" + SortList(moduleList) return moduleList End // get help wave: after parsing the function comment is stored here // // Return refrence to (text) Wave/T Function/Wave getHelpWave() DFREF dfr = createDFWithAllParents(pkgFolder) WAVE/Z/T/SDFR=dfr wv = $helpWave if(!WaveExists(wv)) Make/T/N=(128, 2) dfr:$helpWave/Wave=wv endif return wv End static Structure procedure String id Variable row String name String module String fullName Endstructure /// @brief compile all procedures Function compile() Execute/P/Z/Q "COMPILEPROCEDURES " End
IGOR Pro
5
Cardsareus/linguist
samples/IGOR Pro/CodeBrowser.ipf
[ "MIT" ]
#include "pch.h" #include "centralized_kb_hook.h" #include <common/debug_control.h> #include <common/utils/winapi_error.h> #include <common/logger/logger.h> #include <common/interop/shared_constants.h> namespace CentralizedKeyboardHook { struct HotkeyDescriptor { Hotkey hotkey; std::wstring moduleName; std::function<bool()> action; bool operator<(const HotkeyDescriptor& other) const { return hotkey < other.hotkey; }; }; std::multiset<HotkeyDescriptor> hotkeyDescriptors; std::mutex mutex; HHOOK hHook{}; // To store information about handling pressed keys. struct PressedKeyDescriptor { DWORD virtualKey; // Virtual Key code of the key we're keeping track of. std::wstring moduleName; std::function<bool()> action; UINT_PTR idTimer; // Timer ID for calling SET_TIMER with. UINT millisecondsToPress; // How much time the key must be pressed. bool operator<(const PressedKeyDescriptor& other) const { // We'll use the virtual key as the real key, since looking for a hit with the key is done in the more time sensitive path (low level keyboard hook). return virtualKey < other.virtualKey; }; }; std::multiset<PressedKeyDescriptor> pressedKeyDescriptors; std::mutex pressedKeyMutex; // keep track of last pressed key, to detect repeated keys and if there are more keys pressed. const DWORD VK_DISABLED = CommonSharedConstants::VK_DISABLED; DWORD vkCodePressed = VK_DISABLED; // Save the runner window handle for registering timers. HWND runnerWindow; struct DestroyOnExit { ~DestroyOnExit() { Stop(); } } destroyOnExitObj; // Handle the pressed key proc void PressedKeyTimerProc( HWND hwnd, UINT message, UINT_PTR idTimer, DWORD dwTime) { std::multiset<PressedKeyDescriptor> copy; { // Make a copy, to look for the action to call. std::unique_lock lock{ pressedKeyMutex }; copy = pressedKeyDescriptors; } for (const auto& it : copy) { if (it.idTimer == idTimer) { it.action(); } } KillTimer(hwnd, idTimer); } LRESULT CALLBACK KeyboardHookProc(_In_ int nCode, _In_ WPARAM wParam, _In_ LPARAM lParam) { if (nCode < 0) { return CallNextHookEx(hHook, nCode, wParam, lParam); } const auto& keyPressInfo = *reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam); // Check if the keys are pressed. if (!pressedKeyDescriptors.empty()) { bool wasKeyPressed = vkCodePressed != VK_DISABLED; // Hold the lock for the shortest possible duration if ((wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN)) { if (!wasKeyPressed) { // If no key was pressed before, let's start a timer to take into account this new key. std::unique_lock lock{ pressedKeyMutex }; PressedKeyDescriptor dummy{ .virtualKey = keyPressInfo.vkCode }; auto [it, last] = pressedKeyDescriptors.equal_range(dummy); for (; it != last; ++it) { SetTimer(runnerWindow, it->idTimer, it->millisecondsToPress, PressedKeyTimerProc); } } else if (vkCodePressed != keyPressInfo.vkCode) { // If a different key was pressed, let's clear the timers we have started for the previous key. std::unique_lock lock{ pressedKeyMutex }; PressedKeyDescriptor dummy{ .virtualKey = vkCodePressed }; auto [it, last] = pressedKeyDescriptors.equal_range(dummy); for (; it != last; ++it) { KillTimer(runnerWindow, it->idTimer); } } vkCodePressed = keyPressInfo.vkCode; } if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP) { std::unique_lock lock{ pressedKeyMutex }; PressedKeyDescriptor dummy{ .virtualKey = keyPressInfo.vkCode }; auto [it, last] = pressedKeyDescriptors.equal_range(dummy); for (; it != last; ++it) { KillTimer(runnerWindow, it->idTimer); } vkCodePressed = 0x100; } } if ((wParam != WM_KEYDOWN) && (wParam != WM_SYSKEYDOWN)) { return CallNextHookEx(hHook, nCode, wParam, lParam); } Hotkey hotkey{ .win = (GetAsyncKeyState(VK_LWIN) & 0x8000) || (GetAsyncKeyState(VK_RWIN) & 0x8000), .ctrl = static_cast<bool>(GetAsyncKeyState(VK_CONTROL) & 0x8000), .shift = static_cast<bool>(GetAsyncKeyState(VK_SHIFT) & 0x8000), .alt = static_cast<bool>(GetAsyncKeyState(VK_MENU) & 0x8000), .key = static_cast<unsigned char>(keyPressInfo.vkCode) }; std::function<bool()> action; { // Hold the lock for the shortest possible duration std::unique_lock lock{ mutex }; HotkeyDescriptor dummy{ .hotkey = hotkey }; auto it = hotkeyDescriptors.find(dummy); if (it != hotkeyDescriptors.end()) { action = it->action; } } if (action) { if (action()) { // After invoking the hotkey send a dummy key to prevent Start Menu from activating INPUT dummyEvent[1] = {}; dummyEvent[0].type = INPUT_KEYBOARD; dummyEvent[0].ki.wVk = 0xFF; dummyEvent[0].ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, dummyEvent, sizeof(INPUT)); // Swallow the key press return 1; } } return CallNextHookEx(hHook, nCode, wParam, lParam); } void SetHotkeyAction(const std::wstring& moduleName, const Hotkey& hotkey, std::function<bool()>&& action) noexcept { Logger::trace(L"Register hotkey action for {}", moduleName); std::unique_lock lock{ mutex }; hotkeyDescriptors.insert({ .hotkey = hotkey, .moduleName = moduleName, .action = std::move(action) }); } void AddPressedKeyAction(const std::wstring& moduleName, const DWORD vk, const UINT milliseconds, std::function<bool()>&& action) noexcept { // Calculate a unique TimerID. auto hash = std::hash<std::wstring>{}(moduleName); // Hash the module as the upper part of the timer ID. const UINT upperId = hash & 0xFFFF; const UINT lowerId = vk & 0xFFFF; // The key to press can be the lower ID. const UINT timerId = upperId << 16 | lowerId; std::unique_lock lock{ pressedKeyMutex }; pressedKeyDescriptors.insert({ .virtualKey = vk, .moduleName = moduleName, .action = std::move(action), .idTimer = timerId, .millisecondsToPress = milliseconds }); } void ClearModuleHotkeys(const std::wstring& moduleName) noexcept { Logger::trace(L"UnRegister hotkey action for {}", moduleName); { std::unique_lock lock{ mutex }; auto it = hotkeyDescriptors.begin(); while (it != hotkeyDescriptors.end()) { if (it->moduleName == moduleName) { it = hotkeyDescriptors.erase(it); } else { ++it; } } } { std::unique_lock lock{ pressedKeyMutex }; auto it = pressedKeyDescriptors.begin(); while (it != pressedKeyDescriptors.end()) { if (it->moduleName == moduleName) { it = pressedKeyDescriptors.erase(it); } else { ++it; } } } } void Start() noexcept { #if defined(DISABLE_LOWLEVEL_HOOKS_WHEN_DEBUGGED) const bool hook_disabled = IsDebuggerPresent(); #else const bool hook_disabled = false; #endif if (!hook_disabled) { if (!hHook) { hHook = SetWindowsHookExW(WH_KEYBOARD_LL, KeyboardHookProc, NULL, NULL); if (!hHook) { DWORD errorCode = GetLastError(); show_last_error_message(L"SetWindowsHookEx", errorCode, L"centralized_kb_hook"); } } } } void Stop() noexcept { if (hHook && UnhookWindowsHookEx(hHook)) { hHook = NULL; } } void RegisterWindow(HWND hwnd) noexcept { runnerWindow = hwnd; } }
C++
5
tameemzabalawi/PowerToys
src/runner/centralized_kb_hook.cpp
[ "MIT" ]
; placeholder file to get incremental selection to work
Scheme
0
yzia2000/nvim-treesitter
queries/clojure/locals.scm
[ "Apache-2.0" ]
xipag-zohut-zepuk-pisyv-kamog-pupus-netud-tudis-melup-cynov-gaxox
BitBake
1
ArrogantWombatics/openbsd-src
regress/usr.bin/ssh/unittests/sshkey/testdata/rsa1_2.fp.bb
[ "BSD-3-Clause" ]
{ "Version" : 0.2, "ModuleName" : "ecere-ide", "Options" : { "Warnings" : "All", "PreprocessorDefinitions" : [ "GDB_DEBUG_GUI", "ECERE_IDE" ], "IncludeDirs" : [ "../extras/include" ], "TargetType" : "Executable", "TargetFileName" : "ecere-ide", "Libraries" : [ "ecere" ] }, "Platforms" : [ { "Name" : "linux", "Options" : { "IncludeDirs" : [ "/usr/X11R6/include" ], "Libraries" : [ "X11", "m" ], "LibraryDirs" : [ "/usr/X11R6/lib" ] } }, { "Name" : "apple", "Options" : { "IncludeDirs" : [ "/usr/X11R6/include" ], "Libraries" : [ "X11", "m" ], "LibraryDirs" : [ "/usr/X11R6/lib" ] } } ], "Configurations" : [ { "Name" : "Debug", "Options" : { "Debug" : true, "Optimization" : "None", "PreprocessorDefinitions" : [ "_DEBUG" ], "Console" : true, "FastMath" : false } }, { "Name" : "Release", "Options" : { "Warnings" : "All", "NoLineNumbers" : true, "Optimization" : "Speed", "LibraryDirs" : [ "../obj/$(PLATFORM)/bin", "../obj/$(PLATFORM)/lib" ], "FastMath" : true, "PostbuildCommands" : [ "$(call cp,$(TARGET),../obj/$(PLATFORM)/bin/)" ], "InstallCommands" : [ "$(if $(WINDOWS_HOST),$(call cp,$(TARGET),\"$(BINDIR)/\"),install $(INSTALL_FLAGS) $(TARGET) $(BINDIR)/$(MODULE)$(E))" ] } }, { "Name" : "MemoryGuard", "Options" : { "Debug" : true, "MemoryGuard" : true, "Optimization" : "None", "PreprocessorDefinitions" : [ "_DEBUG" ], "Console" : true, "FastMath" : false } }, { "Name" : "Profile", "Options" : { "Debug" : true, "Profile" : true, "Optimization" : "Speed", "PreprocessorDefinitions" : [ "ECERE_STATIC" ], "Libraries" : [ "ecereStatic", "ecStatic", "jpeg", "png", "z", "ungif", "freetype", "harfbuzz" ], "Console" : true, "FastMath" : true }, "Platforms" : [ { "Name" : "Linux", "Options" : { "Libraries" : [ "X11", "GL", "ncurses", "pthread", "m", "Xrender", "fontconfig", "expat" ] } }, { "Name" : "Win32", "Options" : { "Libraries" : [ "dxguid", "ddraw", "dinput", "winmm", "opengl32", "ws2_32", "kernel32", "user32", "gdi32", "mpr", "advapi32", "shell32", "winspool", "imm32" ] } } ] } ], "Files" : [ { "Folder" : "extern", "Files" : [ "../extras/FileSystemIterator.ec", "../extras/gui/layout.ec", "../extras/gui/controls/StringsBox.ec", "../extras/types/DynamicString.ec", "../extras/include/dpl.ec" ] }, { "Folder" : "src", "Files" : [ { "Folder" : "dialogs", "Files" : [ "CompilersDetectionDialog.ec", "FindInFilesDialog.ec", "GlobalSettingsDialog.ec", "NewProjectDialog.ec", "NodeProperties.ec", "WorkspaceSettings.ec", "ProjectTabSettings.ec", "FontPicker.ec" ] }, { "Folder" : "project", "Files" : [ "Project.ec", "ProjectConfig.ec", "ProjectNode.ec", "ProjectView.ec", "Workspace.ec", { "FileName" : "vsSupport.ec", "Options" : { "ExcludeFromBuild" : true }, "Platforms" : [ { "Name" : "win32", "Options" : { "ExcludeFromBuild" : false } } ] } ] }, { "Folder" : "designer", "Files" : [ "CodeEditor.ec", "CodeObject.ec", "Designer.ec", "findCtx.ec", "findExp.ec", "findParams.ec", "Sheet.ec", "ToolBox.ec", "SyntaxHighlighting.ec" ] }, { "Folder" : "debugger", "Files" : [ "debugFindCtx.ec", "Debugger.ec", "debugTools.ec", "GDBDialog.ec", "process.ec" ] }, { "Folder" : "panels", "Files" : [ "BreakpointsView.ec", "CallStackView.ec", "OutputView.ec", "ThreadsView.ec", "WatchesView.ec" ] }, { "Folder" : "documents", "Files" : [ "ModelView.ec", "PictureEdit.ec" ] }, "about.ec", "ide.ec", "IDESettings.ec", "OldIDESettings.ec", "ProjectSettings.ec", "licensing.ec", "resources.rc" ] } ], "ResourcesPath" : "res", "Resources" : [ { "Folder" : "actions", "Files" : [ "attach.png", "delete.png", "detach.png", "docNew.png", "editCopy.png", "editDelete.png", "delete2.png", "build.png", "clean.png", "debug.png", "docOpen.png", "docSave.png", "docSaveAll.png", "pause.png", "projAdd.png", "projNew.png", "projOpen.png", "rebuild.png", "regMakefile.png", "relink.png", "restart.png", "run.png", "skipBreaks.png", "stepInto.png", "stepOut.png", "stepOver.png", "stopDebug.png", "stepOverSkipBreak.png" ] }, { "Folder" : "codeMarks", "Files" : [ "breakpoint.png", "breakpointDisabled.png", "breakpointHalf.png", "breakpointHalfDisabled.png", "cursor.png", "cursorError.png", "topFrame.png", "topFrameError.png", "topFrameHalf.png", "topFrameHalfError.png" ] }, { "Folder" : "others", "Files" : [ "mousePointer.png" ] }, { "Folder" : "status", "Files" : [ "software-update-available.png" ] }, { "Folder" : "locale", "Files" : [ "locale/es.mo", "locale/pt_BR.mo", "locale/ru.mo", "locale/vi.mo", "locale/zh_CN.mo" ] }, { "Folder" : "licenses", "Files" : [ "../LICENSE", "../extras/res/licenses/png.LICENSE", "../extras/res/licenses/tango.COPYING", "../extras/res/licenses/zlib.README", "../extras/res/licenses/sqlite.LICENSE", "../extras/res/licenses/jpg.LICENSE", "../extras/res/licenses/ungif.LICENSE", "../extras/res/licenses/freetype.LICENSE", "../extras/res/licenses/harfbuzz.LICENSE", "../extras/res/licenses/upx.LICENSE", "../extras/res/licenses/MinGW-w64.LICENSE", "../extras/res/licenses/tdm-gcc.LICENSE", "../extras/res/licenses/ffi.LICENSE" ] }, { "Folder" : "countryCode", "Files" : [ "../extras/res/types/countryCode/es.png", "../extras/res/types/countryCode/gb.png", "../extras/res/types/countryCode/hu.png", "../extras/res/types/countryCode/cn.png", "../extras/res/types/countryCode/pt.png", "../extras/res/types/countryCode/vn.png", "../extras/res/types/countryCode/ru.png", "../extras/res/types/countryCode/in.png", "../extras/res/types/countryCode/nl.png", "../extras/res/types/countryCode/il.png", "../extras/res/types/countryCode/br.png" ] }, "ecere.jpg", "ecereBack.jpg", "icon.png", "../crossplatform.mk" ] }
Ecere Projects
3
N-eil/ecere-sdk
ide/ide.epj
[ "BSD-3-Clause" ]
Strict Rem bbdoc: BASIC/Reflection End Rem Module BRL.Reflection ModuleInfo "Version: 1.02" ModuleInfo "Author: Mark Sibly" ModuleInfo "License: zlib/libpng" ModuleInfo "Copyright: Blitz Research Ltd" ModuleInfo "Modserver: BRL" ModuleInfo "History: 1.02 Release" ModuleInfo "History: Added Brucey's size fix to GetArrayElement()/SetArrayElement()." ModuleInfo "History: 1.01 Release" ModuleInfo "History: Fixed NewArray using temp type name" Import BRL.LinkedList Import BRL.Map Import "reflection.cpp" Private Extern Function bbObjectNew:Object( class ) Function bbObjectRegisteredTypes:Int Ptr( count Var ) Function bbArrayNew1D:Object( typeTag:Byte Ptr,length ) Function bbRefArrayClass() Function bbRefStringClass() Function bbRefObjectClass() Function bbRefArrayLength( array:Object, dim:Int = 0 ) Function bbRefArrayTypeTag$( array:Object ) Function bbRefArrayDimensions:Int( array:Object ) Function bbRefArrayCreate:Object( typeTag:Byte Ptr,dims:Int[] ) Function bbRefFieldPtr:Byte Ptr( obj:Object,index ) Function bbRefMethodPtr:Byte Ptr( obj:Object,index ) Function bbRefArrayElementPtr:Byte Ptr( sz,array:Object,index ) Function bbRefGetObject:Object( p:Byte Ptr ) Function bbRefPushObject( p:Byte Ptr,obj:Object ) Function bbRefInitObject( p:Byte Ptr,obj:Object ) Function bbRefAssignObject( p:Byte Ptr,obj:Object ) Function bbRefGetObjectClass( obj:Object ) Function bbRefGetSuperClass( class ) End Extern Type TClass Method Compare( with:Object ) Return _class-TClass( with )._class End Method Method SetClass:TClass( class ) _class=class Return Self End Method Field _class End Type Function _Get:Object( p:Byte Ptr,typeId:TTypeId ) Select typeId Case ByteTypeId Return String.FromInt( (Byte Ptr p)[0] ) Case ShortTypeId Return String.FromInt( (Short Ptr p)[0] ) Case IntTypeId Return String.FromInt( (Int Ptr p)[0] ) Case LongTypeId Return String.FromLong( (Long Ptr p)[0] ) Case FloatTypeId Return String.FromFloat( (Float Ptr p)[0] ) Case DoubleTypeId Return String.FromDouble( (Double Ptr p)[0] ) Default Return bbRefGetObject( p ) End Select End Function Function _Push:Byte Ptr( sp:Byte Ptr,typeId:TTypeId,value:Object ) Select typeId Case ByteTypeId,ShortTypeId,IntTypeId (Int Ptr sp)[0]=value.ToString().ToInt() Return sp+4 Case LongTypeId (Long Ptr sp)[0]=value.ToString().ToLong() Return sp+8 Case FloatTypeId (Float Ptr sp)[0]=value.ToString().ToFloat() Return sp+4 Case DoubleTypeId (Double Ptr sp)[0]=value.ToString().ToDouble() Return sp+8 Case StringTypeId If Not value value="" bbRefPushObject sp,value Return sp+4 Default If value Local c=typeId._class Local t=bbRefGetObjectClass( value ) While t And t<>c t=bbRefGetSuperClass( t ) Wend If Not t Throw "ERROR" EndIf bbRefPushObject sp,value Return sp+4 End Select End Function Function _Assign( p:Byte Ptr,typeId:TTypeId,value:Object ) Select typeId Case ByteTypeId (Byte Ptr p)[0]=value.ToString().ToInt() Case ShortTypeId (Short Ptr p)[0]=value.ToString().ToInt() Case IntTypeId (Int Ptr p)[0]=value.ToString().ToInt() Case LongTypeId (Long Ptr p)[0]=value.ToString().ToLong() Case FloatTypeId (Float Ptr p)[0]=value.ToString().ToFloat() Case DoubleTypeId (Double Ptr p)[0]=value.ToString().ToDouble() Case StringTypeId If Not value value="" bbRefAssignObject p,value Default If value Local c=typeId._class Local t=bbRefGetObjectClass( value ) While t And t<>c t=bbRefGetSuperClass( t ) Wend If Not t Throw "ERROR" EndIf bbRefAssignObject p,value End Select End Function Function _Call:Object( p:Byte Ptr,typeId:TTypeId,obj:Object,args:Object[],argTypes:TTypeId[] ) Local q[10],sp:Byte Ptr=q bbRefPushObject sp,obj sp:+4 If typeId=LongTypeId sp:+8 For Local i=0 Until args.length If Int Ptr(sp)>=Int Ptr(q)+8 Throw "ERROR" sp=_Push( sp,argTypes[i],args[i] ) Next If Int Ptr(sp)>Int Ptr(q)+8 Throw "ERROR" Select typeId Case ByteTypeId,ShortTypeId,IntTypeId Local f(p0,p1,p2,p3,p4,p5,p6,p7)=p Return String.FromInt( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) Case LongTypeId Throw "TODO" Case FloatTypeId Local f:Float(p0,p1,p2,p3,p4,p5,p6,p7)=p Return String.FromFloat( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) Case DoubleTypeId Local f:Double(p0,p1,p2,p3,p4,p5,p6,p7)=p Return String.FromDouble( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) Default Local f:Object(p0,p1,p2,p3,p4,p5,p6,p7)=p Return f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) End Select End Function Function TypeTagForId$( id:TTypeId ) If id.ExtendsType( ArrayTypeId ) Return "[]"+TypeTagForId( id.ElementType() ) EndIf If id.ExtendsType( ObjectTypeId ) Return ":"+id.Name() EndIf Select id Case ByteTypeId Return "b" Case ShortTypeId Return "s" Case IntTypeId Return "i" Case LongTypeId Return "l" Case FloatTypeId Return "f" Case DoubleTypeId Return "d" Case StringTypeId Return "$" End Select Throw "ERROR" End Function Function TypeIdForTag:TTypeId( ty$ ) If ty.StartsWith( "[" ) Local dims:Int = ty.split(",").length ty=ty[ty.Find("]")+1..] Local id:TTypeId = TypeIdForTag( ty ) If id Then id._arrayType = Null id=id.ArrayType(dims) End If Return id EndIf If ty.StartsWith( ":" ) ty=ty[1..] Local i=ty.FindLast( "." ) If i<>-1 ty=ty[i+1..] Return TTypeId.ForName( ty ) EndIf Select ty Case "b" Return ByteTypeId Case "s" Return ShortTypeId Case "i" Return IntTypeId Case "l" Return LongTypeId Case "f" Return FloatTypeId Case "d" Return DoubleTypeId Case "$" Return StringTypeId End Select End Function Function ExtractMetaData$( meta$,key$ ) If Not key Return meta Local i=0 While i<meta.length Local e=meta.Find( "=",i ) If e=-1 Throw "Malformed meta data" Local k$=meta[i..e],v$ i=e+1 If i<meta.length And meta[i]=Asc("~q") i:+1 Local e=meta.Find( "~q",i ) If e=-1 Throw "Malformed meta data" v=meta[i..e] i=e+1 Else Local e=meta.Find( " ",i ) If e=-1 e=meta.length v=meta[i..e] i=e EndIf If k=key Return v If i<meta.length And meta[i]=Asc(" ") i:+1 Wend End Function Public Rem bbdoc: Primitive byte type End Rem Global ByteTypeId:TTypeId=New TTypeId.Init( "Byte",1 ) Rem bbdoc: Primitive short type End Rem Global ShortTypeId:TTypeId=New TTypeId.Init( "Short",2 ) Rem bbdoc: Primitive int type End Rem Global IntTypeId:TTypeId=New TTypeId.Init( "Int",4 ) Rem bbdoc: Primitive long type End Rem Global LongTypeId:TTypeId=New TTypeId.Init( "Long",8 ) Rem bbdoc: Primitive float type End Rem Global FloatTypeId:TTypeId=New TTypeId.Init( "Float",4 ) Rem bbdoc: Primitive double type End Rem Global DoubleTypeId:TTypeId=New TTypeId.Init( "Double",8 ) Rem bbdoc: Primitive object type End Rem Global ObjectTypeId:TTypeId=New TTypeId.Init( "Object",4,bbRefObjectClass() ) Rem bbdoc: Primitive string type End Rem Global StringTypeId:TTypeId=New TTypeId.Init( "String",4,bbRefStringClass(),ObjectTypeId ) Rem bbdoc: Primitive array type End Rem Global ArrayTypeId:TTypeId=New TTypeId.Init( "Null[]",4,bbRefArrayClass(),ObjectTypeId ) Rem bbdoc: Type member - field or method. End Rem Type TMember Rem bbdoc: Get member name End Rem Method Name$() Return _name End Method Rem bbdoc: Get member type End Rem Method TypeId:TTypeId() Return _typeId End Method Rem bbdoc: Get member meta data End Rem Method MetaData$( key$="" ) Return ExtractMetaData( _meta,key ) End Method Field _name$,_typeId:TTypeId,_meta$ End Type Rem bbdoc: Type field End Rem Type TField Extends TMember Method Init:TField( name$,typeId:TTypeId,meta$,index ) _name=name _typeId=typeId _meta=meta _index=index Return Self End Method Rem bbdoc: Get field value End Rem Method Get:Object( obj:Object ) Return _Get( bbRefFieldPtr( obj,_index ),_typeId ) End Method Rem bbdoc: Get int field value End Rem Method GetInt:Int( obj:Object ) Return GetString( obj ).ToInt() End Method Rem bbdoc: Get long field value End Rem Method GetLong:Long( obj:Object ) Return GetString( obj ).ToLong() End Method Rem bbdoc: Get float field value End Rem Method GetFloat:Float( obj:Object ) Return GetString( obj ).ToFloat() End Method Rem bbdoc: Get double field value End Rem Method GetDouble:Double( obj:Object ) Return GetString( obj ).ToDouble() End Method Rem bbdoc: Get string field value End Rem Method GetString$( obj:Object ) Return String( Get( obj ) ) End Method Rem bbdoc: Set field value End Rem Method Set( obj:Object,value:Object ) _Assign bbRefFieldPtr( obj,_index ),_typeId,value End Method Rem bbdoc: Set int field value End Rem Method SetInt( obj:Object,value:Int ) SetString obj,String.FromInt( value ) End Method Rem bbdoc: Set long field value End Rem Method SetLong( obj:Object,value:Long ) SetString obj,String.FromLong( value ) End Method Rem bbdoc: Set float field value End Rem Method SetFloat( obj:Object,value:Float ) SetString obj,String.FromFloat( value ) End Method Rem bbdoc: Set double field value End Rem Method SetDouble( obj:Object,value:Double ) SetString obj,String.FromDouble( value ) End Method Rem bbdoc: Set string field value End Rem Method SetString( obj:Object,value$ ) Set obj,value End Method Field _index End Type Rem bbdoc: Type method End Rem Type TMethod Extends TMember Method Init:TMethod( name$,typeId:TTypeId,meta$,selfTypeId:TTypeId,index,argTypes:TTypeId[] ) _name=name _typeId=typeId _meta=meta _selfTypeId=selfTypeId _index=index _argTypes=argTypes Return Self End Method Rem bbdoc: Get method arg types End Rem Method ArgTypes:TTypeId[]() Return _argTypes End Method Rem bbdoc: Invoke method End Rem Method Invoke:Object( obj:Object,args:Object[] ) If _index<4096 Return _Call( bbRefMethodPtr( obj,_index ),_typeId,obj,args,_argTypes ) EndIf Return _Call( Byte Ptr(_index),_typeId,obj,args,_argTypes ) End Method Field _selfTypeId:TTypeId,_index,_argTypes:TTypeId[] End Type Rem bbdoc: Type id End Rem Type TTypeId Rem bbdoc: Get name of type End Rem Method Name$() Return _name End Method Rem bbdoc: Get type meta data End Rem Method MetaData$( key$="" ) Return ExtractMetaData( _meta,key ) End Method Rem bbdoc: Get super type End Rem Method SuperType:TTypeId() Return _super End Method Rem bbdoc: Get array type End Rem Method ArrayType:TTypeId(dims:Int = 1) If Not _arrayType Local dim:String If dims > 1 Then For Local i:Int = 1 Until dims dim :+ "," Next End If _arrayType=New TTypeId.Init( _name+"[" + dim + "]",4,bbRefArrayClass() ) _arrayType._elementType=Self If _super _arrayType._super=_super.ArrayType() Else _arrayType._super=ArrayTypeId EndIf EndIf Return _arrayType End Method Rem bbdoc: Get element type End Rem Method ElementType:TTypeId() Return _elementType End Method Rem bbdoc: Determine if type extends a type End Rem Method ExtendsType( typeId:TTypeId ) If Self=typeId Return True If _super Return _super.ExtendsType( typeId ) End Method Rem bbdoc: Get list of derived types End Rem Method DerivedTypes:TList() If Not _derived _derived=New TList Return _derived End Method Rem bbdoc: Create a new object End Rem Method NewObject:Object() If Not _class Throw "Unable to create new object" Return bbObjectNew( _class ) End Method Rem bbdoc: Get list of fields about: Only returns fields declared in this type, not in super types. End Rem Method Fields:TList() Return _fields End Method Rem bbdoc: Get list of methods about: Only returns methods declared in this type, not in super types. End Rem Method Methods:TList() Return _methods End Method Rem bbdoc: Find a field by name about: Searchs type hierarchy for field called @name. End Rem Method FindField:TField( name$ ) name=name.ToLower() For Local t:TField=EachIn _fields If t.Name().ToLower()=name Return t Next If _super Return _super.FindField( name ) End Method Rem bbdoc: Find a method by name about: Searchs type hierarchy for method called @name. End Rem Method FindMethod:TMethod( name$ ) name=name.ToLower() For Local t:TMethod=EachIn _methods If t.Name().ToLower()=name Return t Next If _super Return _super.FindMethod( name ) End Method Rem bbdoc: Enumerate all fields about: Returns a list of all fields in type hierarchy End Rem Method EnumFields:TList( list:TList=Null ) If Not list list=New TList If _super _super.EnumFields list For Local t:TField=EachIn _fields list.AddLast t Next Return list End Method Rem bbdoc: Enumerate all methods about: Returns a list of all methods in type hierarchy - TO DO: handle overrides! End Rem Method EnumMethods:TList( list:TList=Null ) If Not list list=New TList If _super _super.EnumMethods list For Local t:TMethod=EachIn _methods list.AddLast t Next Return list End Method Rem bbdoc: Create a new array End Rem Method NewArray:Object( length, dims:Int[] = Null ) If Not _elementType Throw "TypeID is not an array type" Local tag:Byte Ptr=_elementType._typeTag If Not tag tag=TypeTagForId( _elementType ).ToCString() _elementType._typeTag=tag EndIf If Not dims Then Return bbArrayNew1D( tag,length ) Else Return bbRefArrayCreate( tag, dims ) End If End Method Rem bbdoc: Get array length End Rem Method ArrayLength( array:Object, dim:Int = 0 ) If Not _elementType Throw "TypeID is not an array type" Return bbRefArrayLength( array, dim ) End Method Rem bbdoc: Get the number of dimensions End Rem Method ArrayDimensions:Int( array:Object ) If Not _elementType Throw "TypeID is not an array type" Return bbRefArrayDimensions( array ) End Method Rem bbdoc: Get an array element End Rem Method GetArrayElement:Object( array:Object,index ) If Not _elementType Throw "TypeID is not an array type" Local p:Byte Ptr=bbRefArrayElementPtr( _elementType._size,array,index ) Return _Get( p,_elementType ) End Method Rem bbdoc: Set an array element End Rem Method SetArrayElement( array:Object,index,value:Object ) If Not _elementType Throw "TypeID is not an array type" Local p:Byte Ptr=bbRefArrayElementPtr( _elementType._size,array,index ) _Assign p,_elementType,value End Method Rem bbdoc: Get Type by name End Rem Function ForName:TTypeId( name$ ) _Update If name.EndsWith( "]" ) ' TODO name=name[..name.length-2] Return TTypeId( _nameMap.ValueForKey( name.ToLower() ) ).ArrayType() Else Return TTypeId( _nameMap.ValueForKey( name.ToLower() ) ) EndIf End Function Rem bbdoc: Get Type by object End Rem Function ForObject:TTypeId( obj:Object ) _Update Local class=bbRefGetObjectClass( obj ) If class=ArrayTypeId._class If Not bbRefArrayLength( obj ) Return ArrayTypeId Return TypeIdForTag( bbRefArrayTypeTag( obj ) ).ArrayType() Else Return TTypeId( _classMap.ValueForKey( New TClass.SetClass( class ) ) ) EndIf End Function Rem bbdoc: Get list of all types End Rem Function EnumTypes:TList() _Update Local list:TList=New TList For Local t:TTypeId=EachIn _nameMap.Values() list.AddLast t Next Return list End Function '***** PRIVATE ***** Method Init:TTypeId( name$,size,class=0,supor:TTypeId=Null ) _name=name _size=size _class=class _super=supor _fields=New TList _methods=New TList _nameMap.Insert _name.ToLower(),Self If class _classMap.Insert New TClass.SetClass( class ),Self Return Self End Method Method SetClass:TTypeId( class ) Local debug=(Int Ptr class)[2] Local name$=String.FromCString( Byte Ptr( (Int Ptr debug)[1] ) ),meta$ Local i=name.Find( "{" ) If i<>-1 meta=name[i+1..name.length-1] name=name[..i] EndIf _name=name _meta=meta _class=class _nameMap.Insert _name.ToLower(),Self _classMap.Insert New TClass.SetClass( class ),Self Return Self End Method Function _Update() Local count,p:Int Ptr=bbObjectRegisteredTypes( count ) If count=_count Return Local list:TList=New TList For Local i=_count Until count Local ty:TTypeId=New TTypeId.SetClass( p[i] ) list.AddLast ty Next _count=count For Local t:TTypeId=EachIn list t._Resolve Next End Function Method _Resolve() If _fields Or Not _class Return _fields=New TList _methods=New TList _super=TTypeId( _classMap.ValueForKey( New TClass.SetClass( (Int Ptr _class)[0] ) ) ) If Not _super _super=ObjectTypeId If Not _super._derived _super._derived=New TList _super._derived.AddLast Self Local debug=(Int Ptr _class)[2] Local p:Int Ptr=(Int Ptr debug)+2 While p[0] Local id$=String.FromCString( Byte Ptr p[1] ) Local ty$=String.FromCString( Byte Ptr p[2] ) Local meta$ Local i=ty.Find( "{" ) If i<>-1 meta=ty[i+1..ty.length-1] ty=ty[..i] EndIf Select p[0] Case 3 'field Local typeId:TTypeId=TypeIdForTag( ty ) If typeId _fields.AddLast New TField.Init( id,typeId,meta,p[3] ) Case 6 'method Local t$[]=ty.Split( ")" ) Local retType:TTypeId=TypeIdForTag( t[1] ) If retType Local argTypes:TTypeId[] If t[0].length>1 Local i,b,q$=t[0][1..],args:TList=New TList While i<q.length Select q[i] Case Asc( "," ) args.AddLast q[b..i] i:+1 b=i Case Asc( "[" ) i:+1 While i<q.length And q[i]=Asc(",") i:+1 Wend Default i:+1 End Select Wend If b<q.length args.AddLast q[b..q.length] argTypes=New TTypeId[args.Count()] i=0 For Local arg$=EachIn args argTypes[i]=TypeIdForTag( arg ) If Not argTypes[i] retType=Null i:+1 Next EndIf If retType _methods.AddLast New TMethod.Init( id,retType,meta,Self,p[3],argTypes ) EndIf EndIf End Select p:+4 Wend End Method Field _name$ Field _meta$ Field _class Field _size=4 Field _fields:TList Field _methods:TList Field _super:TTypeId Field _derived:TList Field _arrayType:TTypeId Field _elementType:TTypeId Field _typeTag:Byte Ptr Global _count,_nameMap:TMap=New TMap,_classMap:TMap=New TMap End Type
BlitzMax
5
jabdoa2/blitzmax
mod/brl.mod/reflection.mod/reflection.bmx
[ "Zlib" ]
camera { location <0, 10, -25> look_at <0, 3, 0> } light_source { <7, 12, -7> color rgb <1, 1, 1> * 1.75 area_light <3, 0, 0>, <0, 3, 0>, 15, 15 fade_distance 8 fade_power 2 circular orient } // Floor plane { y, 0 pigment { color rgb <1, 1, 1> } finish { ambient 0 diffuse 0.1 specular 1.0 roughness 0.001 reflection 0.3 } } // Earth sphere { <0, 0, 0>, 5 pigment{ image_map { gif "map/earthmap.gif" map_type 1 } } rotate <-18, -10, 0> translate <0, 5, 0> }
POV-Ray SDL
4
spcask/pov-ray-tracing
src/scene14.pov
[ "MIT" ]
#!/usr/bin/osascript # Required parameters: # @raycast.schemaVersion 1 # @raycast.title Today # @raycast.mode inline # @raycast.refreshTime 1m # Optional parameters: # @raycast.packageName Things # @raycast.icon images/things.png # Documentation: # @raycast.description Get an overview of your completed tasks for today. # @raycast.author Things # @raycast.authorURL https://twitter.com/culturedcode/ if application "Things3" is not running then log "Things is not running" return end if tell application "Things3" set todayTodos to to dos of list "Today" set todosCount to the length of todayTodos set completedTodosCount to 0 repeat with i from 1 to count of todayToDos set todo to item i of todayToDos if status of todo is completed then set completedTodosCount to completedTodosCount + 1 end if end repeat if completedTodosCount is equal to todosCount then log "You're all done for today 🎉" else set progress to round(100 * completedTodosCount / todosCount) log (progress as string) & "% Completed of " & todosCount & " To-Dos" end if end tell
AppleScript
4
daviddzhou/script-commands
commands/apps/things/things-today.applescript
[ "MIT" ]
Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend. Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the midichlorians to create life… He had such a knowledge of the dark side that he could even keep the ones he cared about from dying. The dark side of the Force is a pathway to many abilities some consider to be unnatural. He became so powerful… the only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep. Ironic. He could save others from death, but not himself. <hr> <button (click)="dialogRef.close()">Close</button>
HTML
1
volvachev/components
src/components-examples/cdk/dialog/cdk-dialog-styling/cdk-dialog-styling-example-dialog.html
[ "MIT" ]
table t1 : {A : int, B : string, C : float} val q1 = (SELECT * FROM t1 WHERE A = 0) val a1 = (INSERT INTO t1 VALUES (0, "1", 2.0)) val a2 = (UPDATE t1 SET A = 3, B = "4", C = 5.0) val a3 = (DELETE FROM t1 WHERE B <> "good") val q2 = (SELECT * FROM t1 WHERE A = 0 OR B = "hi" AND (C <> 10.01 OR A = 8) AND (B = B OR B = B AND C = C OR (D = 6 AND 8 = 8)))
UrWeb
3
apple314159/urweb
tests/sql_indent.ur
[ "BSD-3-Clause" ]
complete -c my-app -n "__fish_use_subcommand" -s h -l help -d 'Print help information' complete -c my-app -n "__fish_use_subcommand" -s V -l version -d 'Print version information' complete -c my-app -n "__fish_use_subcommand" -s c -s C -l config -l conf -d 'some config file' complete -c my-app -n "__fish_use_subcommand" -f -a "test" -d 'tests things' complete -c my-app -n "__fish_use_subcommand" -f -a "some_cmd" -d 'top level subcommand' complete -c my-app -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c my-app -n "__fish_seen_subcommand_from test" -l case -d 'the case to test' -r complete -c my-app -n "__fish_seen_subcommand_from test" -s h -l help -d 'Print help information' complete -c my-app -n "__fish_seen_subcommand_from test" -s V -l version -d 'Print version information' complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help information' complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version information' complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand' complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -l config -d 'the other case to test' -r -f -a "{Lest quotes aren/'t escaped. }" complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s h -l help -d 'Print help information' complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s V -l version -d 'Print version information'
fish
4
omjadas/clap
clap_complete/tests/snapshots/sub_subcommands.fish
[ "Apache-2.0", "MIT" ]
div.svelte-xyz>p{color:red}
CSS
1
Theo-Steiner/svelte
test/css/samples/omit-scoping-attribute-descendant-global-inner/expected.css
[ "MIT" ]
# RUN: llc -march=amdgcn -verify-machineinstrs -run-pass simple-register-coalescing,rename-independent-subregs -o - %s | FileCheck %s --- | define amdgpu_kernel void @test0() { ret void } define amdgpu_kernel void @test1() { ret void } define amdgpu_kernel void @test2() { ret void } ... --- # In the test below we have two independent def+use pairs of subregister1 which # can be moved to a new virtual register. The third def of sub1 however is used # in combination with sub0 and needs to stay with the original vreg. # CHECK-LABEL: name: test0 # CHECK: S_NOP 0, implicit-def undef %0.sub0 # CHECK: S_NOP 0, implicit-def undef %2.sub1 # CHECK: S_NOP 0, implicit %2.sub1 # CHECK: S_NOP 0, implicit-def undef %1.sub1 # CHECK: S_NOP 0, implicit %1.sub1 # CHECK: S_NOP 0, implicit-def %0.sub1 # CHECK: S_NOP 0, implicit %0 name: test0 registers: - { id: 0, class: sgpr_128 } body: | bb.0: S_NOP 0, implicit-def undef %0.sub0 S_NOP 0, implicit-def %0.sub1 S_NOP 0, implicit %0.sub1 S_NOP 0, implicit-def %0.sub1 S_NOP 0, implicit %0.sub1 S_NOP 0, implicit-def %0.sub1 S_NOP 0, implicit %0 ... --- # Test for a bug where we would incorrectly query liveness at the instruction # index in rewriteOperands(). This should pass the verifier afterwards. # CHECK-LABEL: test1 # CHECK: bb.0 # CHECK: S_NOP 0, implicit-def undef %2.sub2 # CHECK: bb.1 # CHECK: S_NOP 0, implicit-def %2.sub1 # CHECK-NEXT: S_NOP 0, implicit-def %2.sub3 # CHECK-NEXT: S_NOP 0, implicit %2 # CHECK-NEXT: S_NOP 0, implicit-def undef %0.sub0 # CHECK-NEXT: S_NOP 0, implicit %2.sub1 # CHECK-NEXT: S_NOP 0, implicit %0.sub0 # CHECK: bb.2 # CHECK: S_NOP 0, implicit %2.sub name: test1 registers: - { id: 0, class: sgpr_128 } - { id: 1, class: sgpr_128 } body: | bb.0: S_NOP 0, implicit-def undef %0.sub2 S_CBRANCH_VCCNZ %bb.1, implicit undef $vcc S_BRANCH %bb.2 bb.1: S_NOP 0, implicit-def %0.sub1 S_NOP 0, implicit-def %0.sub3 %1 = COPY %0 S_NOP 0, implicit %1 S_NOP 0, implicit-def %1.sub0 S_NOP 0, implicit %1.sub1 S_NOP 0, implicit %1.sub0 bb.2: S_NOP 0, implicit %0.sub2 ... # In this test, there are two pairs of tied operands # within the inline asm statement: # (1) %0.sub0 + %0.sub0 and (2) %0.sub1 + %0.sub1 # Check that renaming (2) does not inadvertently rename (1). # CHECK-LABEL: name: test2 # CHECK: INLINEASM &"", 32, 327690, def undef %0.sub0, 327690, def dead %1.sub1, 2147483657, undef %0.sub0(tied-def 3), 2147549193, %1.sub1(tied-def 5) name: test2 body: | bb.0: undef %0.sub0:vreg_64 = IMPLICIT_DEF bb.1: undef %0.sub1:vreg_64 = V_ALIGNBIT_B32 %0.sub0:vreg_64, %0.sub0:vreg_64, 16, implicit $exec INLINEASM &"", 32, 327690, def undef %0.sub0:vreg_64, 327690, def %0.sub1:vreg_64, 2147483657, undef %0.sub0:vreg_64(tied-def 3), 2147549193, %0.sub1:vreg_64(tied-def 5) S_BRANCH %bb.1 ...
Mirah
4
medismailben/llvm-project
llvm/test/CodeGen/AMDGPU/rename-independent-subregs.mir
[ "Apache-2.0" ]
import Hash "mo:base/Hash"; import Types "Types"; module { public type Role = Types.Role; public func equal(r1 : Role, r2 : Role) : Bool { r1 == r2 }; public func max(r1 : Role, r2 : Role) : Role { switch (r1, r2) { case (#admin, _) { #admin }; case (_, #admin) { #admin }; case (#user, #user) { #user }; case (#user, #guest) { #user }; case (#guest, #user) { #user }; case (#guest, #guest) { #guest }; } }; public func hash(r : Role) : Hash.Hash { switch r { case (#user) 0; case (#admin) 1; case (#guest) 2; }; }; }
Modelica
4
gajendraks/cancan
backend/Role.mo
[ "Apache-2.0" ]
// test-tap.click // This user-level configuration tests the KernelTap element, which accesses // Linux's ethertap device (or, equivalently, *BSD's /dev/tun* devices). These // devices let user-level programs trade packets with the kernel. You will // need to run it as root. // // This configuration should work on FreeBSD, OpenBSD, and Linux. It should // produce a stream of 'tap-ok' printouts if all goes well. // On OpenBSD, you may need to run // route add 1.0.0.0 -interface 1.0.0.1 // after starting the Click configuration. // // See test-tun.click for the KernelTun version of this configuration, which // is better documented. // Linux kernel taps don't work unless you set Ethernet addresses right. AddressInfo(tap_local 1:1:1:1:1:1, tap_remote 2:2:2:2:2:2); // The ETHER argument is required on Linux, but ignored on FreeBSD. tap :: KernelTap(1.0.0.1/8, ETHER tap_remote); ICMPPingSource(1.0.0.2, 1.0.0.1) -> out :: EtherEncap(0x0800, tap_local, tap_remote) -> tap; tap // -> Print(tap-in) -> c :: Classifier(12/0800, 12/0806); c[0] -> Strip(14) -> ch :: CheckIPHeader -> ipc :: IPClassifier(icmp echo-reply, icmp echo, -) -> IPPrint(tap-ok) -> d :: Discard; ipc[1] -> Print(tap-ping) -> ICMPPingResponder -> out; ipc[2] -> d; ch[1] -> Print(tap-bad) -> d; c[1] -> ARPResponder(0/0 tap_local) -> tap;
Click
4
MacWR/Click-changed-for-ParaGraph
conf/test-tap.click
[ "Apache-2.0" ]
pragma solidity ^0.5.0; import "../WithSemverError.sol"; contract ImportsBadSemver {}
Solidity
1
santanaluiz/truffle
packages/compile-solidity/test/sources/multipleSolcVersions/withImports/ImportsBadSemver.sol
[ "MIT" ]
a#mylyn-query img { background-image: url(../../images/topiclabel/tu_query48.gif); } a#mylyn-query:hover img { background-image: url(../../images/topiclabel/tu_query48_hov.gif); } a#mylyn-task img { background-image: url(../../images/topiclabel/tu_task48.gif); } a#mylyn-task:hover img { background-image: url(../../images/topiclabel/tu_task48_hov.gif); }
CSS
3
SubOptimal/dbeaver
plugins/org.jkiss.dbeaver.intro/intro/css/tutorials.css
[ "Apache-2.0" ]
^XA ^FO60,60,0 ^A0N,84,84^FDExample GS1 Logistics Label^FS ^FO60,141,0 ^GB1060,1,1,B,0^FS ^FO60,153,0 ^A0N,72,60^FDABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF^FS ^FO60,213,0 ^A0N,72,60^FDABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF^FS ^FO60,282,0 ^GB1060,1,1,B,0^FS ^FO60,306,0 ^A0N,54,54^FDSSCC^FS ^FO60,354,0 ^A0N,117,66^FD123456789012345678^FS ^FO768,306,0 ^A0N,54,54^FDMaterial^FS ^FO768,354,0 ^A0N,117,66^FD12345678^FS ^FO60,471,0 ^A0N,54,54^FDContent^FS ^FO60,519,0 ^A0N,117,66^FD12345678901234^FS ^FO768,471,0 ^A0N,54,54^FDQuantity^FS ^FO768,519,0 ^A0N,117,66^FD1234 CS^FS ^FO60,639,0 ^A0N,54,54^FDBest Before (dd.mm.yy)^FS ^FO60,684,0 ^A0N,117,66^FD12.34.56^FS ^FO768,639,0 ^A0N,54,54^FDBatch^FS ^FO768,684,0 ^A0N,117,66^FD123456789^FS ^BY3,2,10 ^FO141,792,0 ^BCN,378,N,N,N^FD>;>8021234567890123415563412371234>81012345678>69^FS ^FO177,1182,0 ^A0N,72,36^FD(02)12345678901234(15)563412(37)1234(10)123456789^FS ^BY6,2,10 ^FO123,1263,0 ^BCN,354,N,N,N^FD>;>800123456789012345678^FS ^FO219,1629,0 ^A0N,72,72^FD(00)123456789012345678^FS ^XZ
Zimpl
2
auslavs/Fabra
Examples/GS1.zpl
[ "MIT" ]
Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; HTC Vision Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; HTC Vision Build/IMM76L; CyanogenMod-mimicry) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 2.3.3; pl-pl; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; HTC Vision Build/GRI40; CyanogenMod-7.2.0) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; HTC Vision Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; Android 4.0.4; HTC Vision Build/IMM76L) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19 Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; HTC Vision Build/JDQ39; CyanogenMod-10.1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 UCBrowser/2.3.1.257 Mozilla/5.0 (Linux; U; Android 2.3.3; en-au; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 1.0; en-us; HTC Vision Build/IMM76I; CyanogenMod-Audacity Beta 4) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; Android 1.0; HTC Vision Build/IMM76I) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19 Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; HTC Vision Build/JDQ39; CyanogenMod-10.1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) Mozilla/5.0 (Linux; U; Android 2.3.7; sv-se; HTC Vision Build/CyanogenMod-4) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; HTC Vision Build/JZO54K; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safa Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; HTC Vision Build/IMM76I; CyanogenMod-9.0.0) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 2.3.2; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.3.7; en-ca; HTC Vision Build/GRI40; ILWT-CM7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 4.2.2; pl-pl; HTC Vision Build/JDQ39; CyanogenMod-10.1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 4.2.2; lv-lv; HTC Vision Build/JDQ39; CyanogenMod-10.1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/1.1 (Linux; U; Android 8.8.8; en-us; HTC Vision Build/GRI40) AppleWebKit/933.1 (KHTML, like Gecko) Version/11.0 Mobile Safari/033.0 Mozilla/5.0 (Linux; U; Android 2.3.3; en-ca; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.3.3; en-ru; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1; Maxthon (4.0.4.1000); Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; HTC Vision Build/GRI40) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 4.0.1; English-UK; HTC Vision Build/GRI40) AppleWebKit/571.0.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/571.0.1 Mozilla/5.0 (Linux; U; Android 2.3.3; en-gb; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; Android 4.0.4; HTC Vision Build/IMM76L) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31 OPR/14.0.1074.58201 Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; HTC Vision Build/IMM76D; CyanogenMod-9.0.0) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 6.0; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/66.0.1 Chrome Mozilla/5.0 (Linux; U; Android 6.0.1; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/66.0.1 Chrome Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1; Trident/6.0) Mozilla/8.0 (Linux; U; Android 3.3.3; en-us; HTC Vision Build/GRI40) AppleWebKit/333.1 (KHTML, like Gecko) Version/3.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/11.0 (Linux; U; Androids 3.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; Android 4.0.4; HTC Vision Build/IMM76L) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31 OPR/14.0.1074.57768 Mozilla/8.0 (Linux; U; Android 0.3.8; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 3.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.3.7; cs-cz; HTC Vision Build/GRI40; CyanogenMod-7.2.0) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 4.2.2; de-de; HTC Vision Build/JDQ39; CyanogenMod-10.1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/5.0 (Linux; U; Android 4.2.2; pl-pl; HTC Vision Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mozilla/4.0 (compatible; Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1; Windows NT 6.1; Trident/4.0) Mozilla/5.0 (Linux; U; Android 2.3.5; hd-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; HTC Vision Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Godzilla/5.0 (Linux; U;bukan Android 2.3.5; en-us; HTC Vision Build/GRI40) ApelWebKit/533.1 (KHTML, like Gecko) Version/4.0 GodZilla/533.1 Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; HTC Vision Build/GRI40; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Text
1
5tr1x/SecLists
Fuzzing/User-Agents/operating-platform/htc-vision.txt
[ "MIT" ]
// CopsAndTerrorists.pwn By Gammix // An old gamemode of mine i hosted times ago! #include <a_samp> #undef MAX_PLAYERS #define MAX_PLAYERS \ 50 #pragma dynamic \ 10000 #if !defined KEY_AIM #define KEY_AIM \ 128 #endif #if !defined IsValidVehicle native IsValidVehicle(vehicleid); #endif #define ZMSG_HYPHEN_END \ "" #define ZMSG_HYPHEN_START \ "" #include <zmessage> #include <zcmd> #include <sscanf2> #include <streamer> #include <PreviewModelDialog> #include <easyDialog> #include <attachmentfix> #include <dini2> #include <progress2> #define COLOR_WHITE (0xFFFFFFFF) #define COLOR_TOMATO (0xFF6347FF) #define COLOR_YELLOW (0xFFDD00FF) #define COLOR_GREEN (0x00FF00FF) #define COLOR_DEFAULT (0xA9C4E4FF) #define COL_WHITE "{FFFFFF}" #define COL_TOMATO "{FF6347}" #define COL_YELLOW "{FFDD00}" #define COL_GREEN "{00FF00}" #define COL_DEFAULT "{A9C4E4}" #define DIRECTORY \ "" #define MAX_SECURITY_QUESTIONS \ 25 #define MAX_SECURITY_QUESTION_SIZE \ 128 #define CAPTURE_TIME \ 60 #define SET_ALPHA(%1,%2) \ ((%1 & ~0xFF) | (clamp(%2, 0x00, 0xFF))) main() { SetGameModeText("TDM - v1.6"); } new DB:db; enum { TEAM_COPS, TEAM_TERRORISTS }; enum { TEAM_COLOR_COPS = 0x095EE8FF, TEAM_COLOR_TERRORISTS = 0xE80909FF }; enum e_USER { e_USER_SQLID, e_USER_PASSWORD[64 + 1], e_USER_SALT[64 + 1], e_USER_KILLS, e_USER_DEATHS, e_USER_MONEY, e_USER_ADMIN_LEVEL, e_USER_VIP_LEVEL, e_USER_REGISTER_TIMESTAMP, e_USER_LASTLOGIN_TIMESTAMP, e_USER_SECURITY_QUESTION[MAX_SECURITY_QUESTION_SIZE], e_USER_SECURITY_ANSWER[64 + 1] }; new eUser[MAX_PLAYERS][e_USER]; new iPlayerLoginAttempts[MAX_PLAYERS]; new iPlayerAnswerAttempts[MAX_PLAYERS]; enum e_STATIC_PICKUP { e_STATIC_PICKUP_ID, e_STATIC_PICKUP_MODEL, Float:e_STATIC_PICKUP_AMOUNT, e_STATIC_PICKUP_TIMER } new eStaticPickup[MAX_PICKUPS][e_STATIC_PICKUP]; new iStaticPickupCount; enum e_CAPTURE_ZONE { e_CAPTURE_ZONE_NAME[35], Float:e_CAPTURE_ZONE_POS[4], Float:e_CAPTURE_ZONE_CPPOS[3], e_CAPTURE_ZONE_OWNER, e_CAPTURE_ZONE_ATTACKER, e_CAPTURE_ZONE_TICK, e_CAPTURE_ZONE_ID, e_CAPTURE_ZONE_CPID, e_CAPTURE_ZONE_TIMER, e_CAPTURE_ZONE_PLAYERS }; new eCaptureZone[][e_CAPTURE_ZONE] = { {"Cash Store", {607.3975, -523.7447, 676.2416, -476.0361}, {623.3041, -506.1986, 16.3525}, TEAM_TERRORISTS}, {"Drug Den", {673.9339, -650.8413, 717.4572, -606.4443}, {705.4277, -639.7715, 16.3359}, TEAM_COPS}, {"Houses", {726.5567, -598.6243, 836.5234, -477.0225}, {804.3663, -575.2430, 21.3363}, TEAM_TERRORISTS} }; new PlayerText:ptxtCapture[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; new PlayerBar:pbarCapture[MAX_PLAYERS] = {INVALID_PLAYER_BAR_ID, ...}; new PlayerText:ptxtCaptureText[MAX_PLAYERS][2]; new tmrPlayerCaptureText[MAX_PLAYERS][2]; new iPlayerCaptureZone[MAX_PLAYERS]; enum e_WEAPON_SHOP { e_WEAPON_SHOP_MODEL, e_WEAPON_SHOP_NAME[35], e_WEAPON_SHOP_PRICE, e_WEAPON_SHOP_AMMO }; new const WEAPON_SHOP[][e_WEAPON_SHOP] = { {335, "Knife", 750, 1}, {341, "Chainsaw", 1500, 1}, {342, "Grenade", 1545, 1}, {343, "Moltove", 1745, 1}, {347, "Silenced 9mm", 1500, 150}, {348, "Desert Eagle", 3199, 150}, {350, "Sawnoff Shotgun", 4999, 100}, {351, "Combat Shotgun", 3870, 100}, {352, "Micro-UZI", 3500, 300}, {353, "MP5", 2999, 200}, {372, "Tec-9", 3500, 300}, {358, "Sniper Rifle", 4999, 50}, {355, "Ak47", 2999, 200}, {356, "M4", 3155, 200}, {359, "RPG", 1999, 1}, {361, "Flamethrower", 3500, 350}, {362, "Minigun", 10000, 350}, {363, "Satchel Charge", 1999, 2}, {365, "Spray Can", 800, 200}, {366, "Fire Extinguisher", 855, 200} }; enum e_VEHICLE_SHOP { e_VEHICLE_SHOP_MODEL, e_VEHICLE_SHOP_NAME[64], e_VEHICLE_SHOP_PRICE }; new const VEHICLE_SHOP[][e_VEHICLE_SHOP] = { {406, "Dumper", 15055}, {409, "Stretch", 19999}, {411, "Infernus", 26750}, {425, "Hunter", 100000}, {427, "Enforcer", 23599}, {432, "Rhino", 55099}, {434, "Hotknife", 17099}, {437, "Coach", 12050}, {444, "Monster", 19999}, {447, "Seasparrow", 48900}, {457, "Caddy", 8075}, {461, "PCJ-600", 14699}, {470, "Patriot", 10000}, {481, "BMX", 7777}, {494, "Hotring Racer", 25000}, {532, "Combine Harvester", 15870} }; new bool:bPlayerGambleStarted[MAX_PLAYERS]; new iPlayerGambleBet[MAX_PLAYERS]; new iPlayerGambleRightCard[MAX_PLAYERS]; new sPlayerGambleCards[MAX_PLAYERS][3][64]; new PlayerText:ptxtGamble[MAX_PLAYERS][6]; new CARD[] = "ld_card:cdback"; new RED_CARD[] = "ld_card:cd13h"; new BLACK_CARD[] = "ld_card:cd13s"; new OTHER_CARD[] = "ld_bum:bum2"; new const Float:COPS_SPAWN[][4] = { {629.9655, -571.4874, 16.3359, 274.1459}, {613.8113, -602.2937, 17.2266, 273.8325}, {606.2744, -543.9374, 16.5985, 275.3991} }; new const Float:TERRORISTS_SPAWN[][4] = { {691.7385, -470.5683, 16.5363, 180.1450}, {672.1321, -462.5963, 16.5363, 152.2346}, {653.6218, -439.0352, 16.3359, 200.8018} }; new const HELMETS[] = { 18936, 18937, 18938, 19101, 19102, 19103, 19104, 19105, 19106, 19107, 19108, 19109, 19110, 19111, 19112, 19113, 19114, 19115, 19116, 19117, 19118, 19119, 19120 }; enum { NORMAL_DAY, CLOUDY_DAY, RAINY_DAY }; new iDayType; new iWeather; new iPlayerClassid[MAX_PLAYERS]; new iPlayerSkills[MAX_PLAYERS][11]; new PlayerText:ptxtDeathText[MAX_PLAYERS][2]; new tmrPlayerDeathText[MAX_PLAYERS]; new PlayerText:ptxtNotification[MAX_PLAYERS]; new tmrPlayerNotification[MAX_PLAYERS]; new iPlayerHeadshotData[MAX_PLAYERS][2]; new bool:bPlayerHelmet[MAX_PLAYERS]; new PlayerText:ptxtHelmet[MAX_PLAYERS]; new iPlayerOffRadar[MAX_PLAYERS][2]; new PlayerText:ptxtOffRadar[MAX_PLAYERS][2]; new iPlayerVehicleid[MAX_PLAYERS][3]; new iPlayerProtection[MAX_PLAYERS][2]; new Text3D:iPlayerProtection3DText[MAX_PLAYERS]; new PlayerText:ptxtProtection[MAX_PLAYERS][2]; new iPlayerSpree[MAX_PLAYERS]; IpToLong(const address[]) { new parts[4]; sscanf(address, "p<.>a<i>[4]", parts); return ((parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3]); } ReturnTimelapse(start, till) { new ret[32]; new seconds = till - start; const MINUTE = 60, HOUR = 60 * MINUTE, DAY = 24 * HOUR, MONTH = 30 * DAY; if (seconds == 1) format(ret, sizeof(ret), "a second"); if (seconds < (1 * MINUTE)) format(ret, sizeof(ret), "%i seconds", seconds); else if (seconds < (2 * MINUTE)) format(ret, sizeof(ret), "a minute"); else if (seconds < (45 * MINUTE)) format(ret, sizeof(ret), "%i minutes", (seconds / MINUTE)); else if (seconds < (90 * MINUTE)) format(ret, sizeof(ret), "an hour"); else if (seconds < (24 * HOUR)) format(ret, sizeof(ret), "%i hours", (seconds / HOUR)); else if (seconds < (48 * HOUR)) format(ret, sizeof(ret), "a day"); else if (seconds < (30 * DAY)) format(ret, sizeof(ret), "%i days", (seconds / DAY)); else if (seconds < (12 * MONTH)) { new months = floatround(seconds / DAY / 30); if (months <= 1) format(ret, sizeof(ret), "a month"); else format(ret, sizeof(ret), "%i months", months); } else { new years = floatround(seconds / DAY / 365); if (years <= 1) format(ret, sizeof(ret), "a year"); else format(ret, sizeof(ret), "%i years", years); } return ret; } bool:IsPasswordSecure(const password[]) { new bool:contain_number, bool:contain_highercase, bool:contain_lowercase; for (new i, j = strlen(password); i < j; i++) { switch (password[i]) { case '0'..'9': contain_number = true; case 'A'..'Z': contain_highercase = true; case 'a'..'z': contain_lowercase = true; } if (contain_number && contain_highercase && contain_lowercase) return true; } return false; } StaticPickup_Create(Float:x, Float:y, Float:z, model, Float:ammount, virtualworld = 0, expiretime = 0) { new i; if (iStaticPickupCount == MAX_PICKUPS) { StaticPickup_Destroy(0); } i = iStaticPickupCount++; eStaticPickup[i][e_STATIC_PICKUP_ID] = CreatePickup(model, 1, x, y, z, virtualworld); eStaticPickup[i][e_STATIC_PICKUP_MODEL] = model; eStaticPickup[i][e_STATIC_PICKUP_AMOUNT] = ammount; if (expiretime > 0) eStaticPickup[i][e_STATIC_PICKUP_TIMER] = SetTimerEx("StaticPickup_Destroy", expiretime, false, "i", i); else eStaticPickup[i][e_STATIC_PICKUP_TIMER] = -1; return i; } forward StaticPickup_Destroy(pickupid); public StaticPickup_Destroy(pickupid) { DestroyPickup(eStaticPickup[pickupid][e_STATIC_PICKUP_ID]); if (eStaticPickup[pickupid][e_STATIC_PICKUP_TIMER] != -1) { KillTimer(eStaticPickup[pickupid][e_STATIC_PICKUP_TIMER]); eStaticPickup[pickupid][e_STATIC_PICKUP_TIMER] = -1; } if (pickupid < (iStaticPickupCount - 1)) { eStaticPickup[pickupid][e_STATIC_PICKUP_ID] = eStaticPickup[(iStaticPickupCount - 1)][e_STATIC_PICKUP_ID]; eStaticPickup[pickupid][e_STATIC_PICKUP_MODEL] = eStaticPickup[(iStaticPickupCount - 1)][e_STATIC_PICKUP_MODEL]; eStaticPickup[pickupid][e_STATIC_PICKUP_AMOUNT] = eStaticPickup[(iStaticPickupCount - 1)][e_STATIC_PICKUP_AMOUNT]; eStaticPickup[pickupid][e_STATIC_PICKUP_TIMER] = eStaticPickup[(iStaticPickupCount - 1)][e_STATIC_PICKUP_TIMER]; } } GetModelWeaponID(weaponid) { switch(weaponid) { case 331: return 1; case 333: return 2; case 334: return 3; case 335: return 4; case 336: return 5; case 337: return 6; case 338: return 7; case 339: return 8; case 341: return 9; case 321: return 10; case 322: return 11; case 323: return 12; case 324: return 13; case 325: return 14; case 326: return 15; case 342: return 16; case 343: return 17; case 344: return 18; case 346: return 22; case 347: return 23; case 348: return 24; case 349: return 25; case 350: return 26; case 351: return 27; case 352: return 28; case 353: return 29; case 355: return 30; case 356: return 31; case 372: return 32; case 357: return 33; case 358: return 34; case 359: return 35; case 360: return 36; case 361: return 37; case 362: return 38; case 363: return 39; case 364: return 40; case 365: return 41; case 366: return 42; case 367: return 43; case 368: return 44; case 369: return 45; case 371: return 46; } return -1; } GetWeaponModelID(weaponid) { switch(weaponid) { case 1: return 331; case 2: return 333; case 3: return 334; case 4: return 335; case 5: return 336; case 6: return 337; case 7: return 338; case 8: return 339; case 9: return 341; case 10: return 321; case 11: return 322; case 12: return 323; case 13: return 324; case 14: return 325; case 15: return 326; case 16: return 342; case 17: return 343; case 18: return 344; case 22: return 346; case 23: return 347; case 24: return 348; case 25: return 349; case 26: return 350; case 27: return 351; case 28: return 352; case 29: return 353; case 30: return 355; case 31: return 356; case 32: return 372; case 33: return 357; case 34: return 358; case 35: return 359; case 36: return 360; case 37: return 361; case 38: return 362; case 39: return 363; case 40: return 364; case 41: return 365; case 42: return 366; case 43: return 367; case 44: return 368; case 45: return 369; case 46: return 371; } return -1; } ShowDeathText(playerid, killerid, expiretime, bool:headshot) { if (tmrPlayerDeathText[playerid] != -1) KillTimer(tmrPlayerDeathText[playerid]); tmrPlayerDeathText[playerid] = SetTimerEx("OnDeathTextExpire", expiretime, false, "i", playerid); if (tmrPlayerDeathText[killerid] != -1) KillTimer(tmrPlayerDeathText[killerid]); tmrPlayerDeathText[killerid] = SetTimerEx("OnDeathTextExpire", expiretime, false, "i", killerid); new name[MAX_PLAYER_NAME], string[64]; if (headshot) PlayerTextDrawSetString(playerid, ptxtDeathText[playerid][0], "~w~You got ~b~headshot ~w~by"); else PlayerTextDrawSetString(playerid, ptxtDeathText[playerid][0], "~w~You were ~r~killed ~w~by"); PlayerTextDrawShow(playerid, ptxtDeathText[playerid][0]); GetPlayerName(killerid, name, MAX_PLAYER_NAME); format(string, sizeof(string), "%s[%i]", name, killerid); PlayerTextDrawSetString(playerid, ptxtDeathText[playerid][1], string); PlayerTextDrawShow(playerid, ptxtDeathText[playerid][1]); if (headshot) PlayerTextDrawSetString(killerid, ptxtDeathText[killerid][0], "~w~You ~y~headshot"); else PlayerTextDrawSetString(killerid, ptxtDeathText[killerid][0], "~w~You ~g~killed"); PlayerTextDrawShow(killerid, ptxtDeathText[killerid][0]); GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string, sizeof(string), "%s[%i]", name, playerid); PlayerTextDrawSetString(killerid, ptxtDeathText[killerid][1], string); PlayerTextDrawShow(killerid, ptxtDeathText[killerid][1]); } forward OnDeathTextExpire(playerid); public OnDeathTextExpire(playerid) { PlayerTextDrawHide(playerid, ptxtDeathText[playerid][0]); PlayerTextDrawHide(playerid, ptxtDeathText[playerid][1]); tmrPlayerDeathText[playerid] = -1; } ShowCaptureText(playerid, index, text[], expiretime) { if (tmrPlayerCaptureText[playerid][index] != -1) KillTimer(tmrPlayerCaptureText[playerid][index]); tmrPlayerCaptureText[playerid][index] = SetTimerEx("OnCaptureTextExpire", expiretime, false, "ii", playerid, index); PlayerTextDrawSetString(playerid, ptxtCaptureText[playerid][index], text); PlayerTextDrawShow(playerid, ptxtCaptureText[playerid][index]); } forward OnCaptureTextExpire(playerid, index); public OnCaptureTextExpire(playerid, index) { PlayerTextDrawHide(playerid, ptxtCaptureText[playerid][index]); tmrPlayerCaptureText[playerid][index] = -1; } ShowNotification(playerid, text[], expiretime) { if (tmrPlayerNotification[playerid] != -1) KillTimer(tmrPlayerNotification[playerid]); if (!text[0] || text[0] == ' ') { OnNotificationExpire(playerid); return; } if (expiretime > 0) tmrPlayerNotification[playerid] = SetTimerEx("OnNotificationExpire", expiretime, false, "i", playerid); PlayerTextDrawSetString(playerid, ptxtNotification[playerid], text); PlayerTextDrawShow(playerid, ptxtNotification[playerid]); } forward OnNotificationExpire(playerid); public OnNotificationExpire(playerid) { PlayerTextDrawHide(playerid, ptxtNotification[playerid]); tmrPlayerNotification[playerid] = -1; } IsPlayerSpawned(playerid) { new Float:health; GetPlayerHealth(playerid, health); if (health <= 0.0) return 0; else if (GetPlayerState(playerid) == PLAYER_STATE_WASTED) return 0; else if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return 0; else return 1; } public OnGameModeInit() { if (strlen(DIRECTORY) > 1 && !dini_Exists(DIRECTORY)) { SendRconCommand("gmx"); return 0; } new string[1024]; if (!dini_Exists(DIRECTORY "config.ini")) { dini_Create(DIRECTORY "config.ini"); dini_Set(DIRECTORY "config.ini", "database_name", "database.db"); dini_IntSet(DIRECTORY "config.ini", "max_warnings", 5); dini_IntSet(DIRECTORY "config.ini", "max_login_attempts", 3); dini_IntSet(DIRECTORY "config.ini", "max_answer_attempts", 3); dini_IntSet(DIRECTORY "config.ini", "max_pint", 700); dini_IntSet(DIRECTORY "config.ini", "max_accounts", 3); dini_IntSet(DIRECTORY "config.ini", "max_admin_level", 5); dini_IntSet(DIRECTORY "config.ini", "max_vip_level", 3); dini_IntSet(DIRECTORY "config.ini", "min_password_length", 4); dini_IntSet(DIRECTORY "config.ini", "max_password_length", 45); dini_IntSet(DIRECTORY "config.ini", "account_lock_minutes", 2); dini_BoolSet(DIRECTORY "config.ini", "toggle_spectate_feed", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_secure_password", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_anti_spam", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_anti_advert", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_anti_caps", false); dini_BoolSet(DIRECTORY "config.ini", "toggle_blacklist", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_read_cmd", false); dini_BoolSet(DIRECTORY "config.ini", "toggle_read_pm", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_aka", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_admins_cmd", true); dini_BoolSet(DIRECTORY "config.ini", "toggle_guest_login", true); } if (!dini_Exists(DIRECTORY "adminspawns.ini")) { string = "1435.8024,2662.3647,11.3926,1.1650\r\n"; strcat(string, "1457.4762,2773.4868,10.8203,272.2754\r\n"); strcat(string, "2101.4192,2678.7874,10.8130,92.0607\r\n"); strcat(string, "1951.1090,2660.3877,10.8203,180.8461\r\n"); strcat(string, "1666.6949,2604.9861,10.8203,179.8495\r\n"); strcat(string, "1860.9672,1030.2910,10.8203,271.6988\r\n"); strcat(string, "1673.2345,1316.1067,10.8203,177.7294\r\n"); strcat(string, "1412.6187,2000.0596,14.7396,271.3568"); new File:h = fopen(DIRECTORY "adminspawns.ini", io_write); fwrite(h, string); fclose(h); } if (!dini_Exists(DIRECTORY "questions.ini")) { string = "What was your childhood nickname?\r\n"; strcat(string, "What is the name of your favorite childhood friend?\r\n"); strcat(string, "In what city or town did your mother and father meet?\r\n"); strcat(string, "What is the middle name of your oldest child?\r\n"); strcat(string, "What is your favorite team?\r\n"); strcat(string, "What is your favorite movie?\r\n"); strcat(string, "What is the first name of the boy or girl that you first kissed?\r\n"); strcat(string, "What was the make and model of your first car?\r\n"); strcat(string, "What was the name of the hospital where you were born?\r\n"); strcat(string, "Who is your childhood sports hero?\r\n"); strcat(string, "In what town was your first job?\r\n"); strcat(string, "What was the name of the company where you had your first job?\r\n"); strcat(string, "What school did you attend for sixth grade?\r\n"); strcat(string, "What was the last name of your third grade teacher?"); new File:h = fopen(DIRECTORY "questions.ini", io_write); fwrite(h, string); fclose(h); } db_debug_openresults(); string = DIRECTORY; strcat(string, dini_Get(DIRECTORY "config.ini", "database_name")); db = db_open(string); db_query(db, "PRAGMA synchronous = NORMAL"); db_query(db, "PRAGMA journal_mode = WAL"); string = "CREATE TABLE IF NOT EXISTS `users`(\ `id` INTEGER PRIMARY KEY, \ `name` VARCHAR(24) NOT NULL DEFAULT '', \ `ip` VARCHAR(18) NOT NULL DEFAULT '', \ `longip` INT NOT NULL DEFAULT '0', \ `password` VARCHAR(64) NOT NULL DEFAULT '', \ `salt` VARCHAR(64) NOT NULL DEFAULT '', \ `sec_question` VARCHAR("#MAX_SECURITY_QUESTION_SIZE") NOT NULL DEFAULT '', \ `sec_answer` VARCHAR(64) NOT NULL DEFAULT '', "; strcat(string, "`register_timestamp` INT NOT NULL DEFAULT '0', \ `lastlogin_timestamp` INT NOT NULL DEFAULT '0', \ `kills` INT NOT NULL DEFAULT '0', \ `deaths` INT NOT NULL DEFAULT '0', \ `money` INT NOT NULL DEFAULT '0', \ `adminlevel` INT NOT NULL DEFAULT '0', \ `viplevel` INT NOT NULL DEFAULT '0')"); db_query(db, string); string = "CREATE TABLE IF NOT EXISTS `user_skills` (\ `WEAPONSKILL_PISTOL` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_PISTOL_SILENCED` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_DESERT_EAGLE` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_SHOTGUN` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_SAWNOFF_SHOTGUN` INT NOT NULL DEFAULT '0', "; strcat(string, "`WEAPONSKILL_SPAS12_SHOTGUN` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_MICRO_UZI` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_MP5` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_AK47` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_M4` INT NOT NULL DEFAULT '0', \ `WEAPONSKILL_SNIPERRIFLE` INT NOT NULL DEFAULT '0', \ `user_id` INT NOT NULL DEFAULT '-1')"); db_query(db, string); db_query(db, "CREATE TABLE IF NOT EXISTS `temp_blocked_users` (\ `ip` VARCHAR(18) NOT NULL DEFAULT '', \ `lock_timestamp` INT NOT NULL DEFAULT '0', \ `user_id` INT NOT NULL DEFAULT '-1')"); EnableVehicleFriendlyFire(); DisableInteriorEnterExits(); UsePlayerPedAnims(); SetNameTagDrawDistance(20.0); AddPlayerClass(4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 1 AddPlayerClass(5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 2 AddPlayerClass(9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 3 AddPlayerClass(18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 5 AddPlayerClass(28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 6 AddPlayerClass(66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 7 AddPlayerClass(80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 8 AddPlayerClass(106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 10 AddPlayerClass(116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 11 AddPlayerClass(142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 13 AddPlayerClass(178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 14 AddPlayerClass(256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 15 AddPlayerClass(280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 1 AddPlayerClass(281, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 2 AddPlayerClass(282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 3 AddPlayerClass(283, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 4 AddPlayerClass(283, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 5 AddPlayerClass(286, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 8 AddPlayerClass(288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 9 AddPlayerClass(300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 10 AddPlayerClass(302, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 11 AddPlayerClass(310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 12 AddPlayerClass(311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // 13 for (new i; i < sizeof(eCaptureZone); i++) { eCaptureZone[i][e_CAPTURE_ZONE_ID] = GangZoneCreate(eCaptureZone[i][e_CAPTURE_ZONE_POS][0], eCaptureZone[i][e_CAPTURE_ZONE_POS][1], eCaptureZone[i][e_CAPTURE_ZONE_POS][2], eCaptureZone[i][e_CAPTURE_ZONE_POS][3]); eCaptureZone[i][e_CAPTURE_ZONE_CPID] = CreateDynamicCP(eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][0], eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][1], eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][2], 5.0, 0, .streamdistance = 250.0); CreateDynamicMapIcon(eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][0], eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][1], eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][2], 19, 0, 0, .streamdistance = 700.0); new label[65]; format(label, sizeof(label), "ZONE #%i\n%s", i, eCaptureZone[i][e_CAPTURE_ZONE_NAME]); CreateDynamic3DTextLabel(label, SET_ALPHA(COLOR_TOMATO, 150), eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][0], eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][1], eCaptureZone[i][e_CAPTURE_ZONE_CPPOS][2], 50.0); eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] = INVALID_PLAYER_ID; } BeginDay(); UpdateWeather(); SetTimer("BeginDay", (24 * 60 * 1000), true); SetTimer("UpdateWeather", (30 * 60 * 1000), true); return 1; } forward BeginDay(); public BeginDay() { #define PROBABILITY \ 10 iDayType = random(PROBABILITY); switch (iDayType) { case 0..(PROBABILITY - 3): iDayType = NORMAL_DAY; case (PROBABILITY - 2): iDayType = CLOUDY_DAY; case (PROBABILITY - 1): iDayType = RAINY_DAY; } } forward UpdateWeather(); public UpdateWeather() { new h, x; gettime(h, x, x); #pragma unused x switch (h) { case 0..5: iWeather = 23; case 6..10: { switch (iDayType) { case NORMAL_DAY: iWeather = 1; case CLOUDY_DAY: iWeather = 15; case RAINY_DAY: iWeather = 16; } } case 11..14: { switch (iDayType) { case NORMAL_DAY: iWeather = 3; case CLOUDY_DAY: iWeather = 17; case RAINY_DAY: iWeather = 9; } } case 15..18: { switch (iDayType) { case NORMAL_DAY: iWeather = 23; case CLOUDY_DAY: iWeather = 29; case RAINY_DAY: iWeather = 33; } } case 19..24: { switch (iDayType) { case NORMAL_DAY: iWeather = 2; case CLOUDY_DAY: iWeather = 36; case RAINY_DAY: iWeather = 36; } } } } public OnGameModeExit() { db_close(db); for (new i; i < iStaticPickupCount; i++) StaticPickup_Destroy(i); return 1; } public OnPlayerConnect(playerid) { iPlayerLoginAttempts[playerid] = 0; iPlayerAnswerAttempts[playerid] = 0; tmrPlayerDeathText[playerid] = -1; tmrPlayerCaptureText[playerid][0] = -1; tmrPlayerCaptureText[playerid][1] = -1; for (new i; i < sizeof(iPlayerSkills[]); i++) iPlayerSkills[playerid][i] = 0; iPlayerCaptureZone[playerid] = -1; iPlayerOffRadar[playerid][0] = 0; iPlayerOffRadar[playerid][1] = -1; tmrPlayerNotification[playerid] = -1; ptxtDeathText[playerid][0] = CreatePlayerTextDraw(playerid, 321.000000, 328.000000, "~w~You were ~r~killed ~w~by"); PlayerTextDrawAlignment(playerid, ptxtDeathText[playerid][0], 2); PlayerTextDrawBackgroundColor(playerid, ptxtDeathText[playerid][0], 255); PlayerTextDrawFont(playerid, ptxtDeathText[playerid][0], 2); PlayerTextDrawLetterSize(playerid, ptxtDeathText[playerid][0], 0.150000, 1.000000); PlayerTextDrawColor(playerid, ptxtDeathText[playerid][0], -1); PlayerTextDrawSetOutline(playerid, ptxtDeathText[playerid][0], 0); PlayerTextDrawSetProportional(playerid, ptxtDeathText[playerid][0], 1); PlayerTextDrawSetShadow(playerid, ptxtDeathText[playerid][0], 1); PlayerTextDrawSetSelectable(playerid, ptxtDeathText[playerid][0], 0); ptxtDeathText[playerid][1] = CreatePlayerTextDraw(playerid, 321.000000, 337.000000, "RydEr[4]"); PlayerTextDrawAlignment(playerid, ptxtDeathText[playerid][1], 2); PlayerTextDrawBackgroundColor(playerid, ptxtDeathText[playerid][1], 255); PlayerTextDrawFont(playerid, ptxtDeathText[playerid][1], 1); PlayerTextDrawLetterSize(playerid, ptxtDeathText[playerid][1], 0.250000, 1.400000); PlayerTextDrawColor(playerid, ptxtDeathText[playerid][1], -1); PlayerTextDrawSetOutline(playerid, ptxtDeathText[playerid][1], 1); PlayerTextDrawSetProportional(playerid, ptxtDeathText[playerid][1], 1); PlayerTextDrawSetSelectable(playerid, ptxtDeathText[playerid][1], 0); ptxtNotification[playerid] = CreatePlayerTextDraw(playerid, 10.000000, 150.000000, "~w~You have chossen team ~b~Cops~w~. You mission is to eliminate ~r~Terrorists ~w~and capture all their terroteries!"); PlayerTextDrawBackgroundColor(playerid, ptxtNotification[playerid], 0); PlayerTextDrawFont(playerid, ptxtNotification[playerid], 1); PlayerTextDrawLetterSize(playerid, ptxtNotification[playerid], 0.250000, 1.000000); PlayerTextDrawColor(playerid, ptxtNotification[playerid], -1); PlayerTextDrawSetOutline(playerid, ptxtNotification[playerid], 0); PlayerTextDrawSetProportional(playerid, ptxtNotification[playerid], 1); PlayerTextDrawSetShadow(playerid, ptxtNotification[playerid], 1); PlayerTextDrawUseBox(playerid, ptxtNotification[playerid], 1); PlayerTextDrawBoxColor(playerid, ptxtNotification[playerid], 150); PlayerTextDrawTextSize(playerid, ptxtNotification[playerid], 220.000000, 0.000000); PlayerTextDrawSetSelectable(playerid, ptxtNotification[playerid], 0); pbarCapture[playerid] = CreatePlayerProgressBar(playerid, 44.000000, 318.000000, 89.500000, 3.700000, -1429936641, CAPTURE_TIME, 0); ptxtCapture[playerid] = CreatePlayerTextDraw(playerid, 87.000000, 308.000000, "..."); PlayerTextDrawBackgroundColor(playerid, ptxtCapture[playerid], 255); PlayerTextDrawFont(playerid, ptxtCapture[playerid], 1); PlayerTextDrawLetterSize(playerid, ptxtCapture[playerid], 0.180000, 0.799999); PlayerTextDrawColor(playerid, ptxtCapture[playerid], -1); PlayerTextDrawAlignment(playerid, ptxtCapture[playerid], 2); PlayerTextDrawSetOutline(playerid, ptxtCapture[playerid], 1); ptxtCaptureText[playerid][0] = CreatePlayerTextDraw(playerid, 317.000000, 348.000000, "~g~We have won the turfwar against the ~b~~h~~h~~h~Grove ~g~in ~b~~h~~h~~h~Gangton ~g~(/turfs)"); PlayerTextDrawAlignment(playerid, ptxtCaptureText[playerid][0], 2); PlayerTextDrawBackgroundColor(playerid, ptxtCaptureText[playerid][0], 255); PlayerTextDrawFont(playerid, ptxtCaptureText[playerid][0], 1); PlayerTextDrawLetterSize(playerid, ptxtCaptureText[playerid][0], 0.180000, 0.799999); PlayerTextDrawColor(playerid, ptxtCaptureText[playerid][0], -1); PlayerTextDrawSetOutline(playerid, ptxtCaptureText[playerid][0], 1); PlayerTextDrawSetProportional(playerid, ptxtCaptureText[playerid][0], 1); PlayerTextDrawSetSelectable(playerid, ptxtCaptureText[playerid][0], 0); ptxtCaptureText[playerid][1] = CreatePlayerTextDraw(playerid, 317.000000, 355.000000, "~r~We have lost the turfwar against the ~b~~h~~h~~h~Azetecas ~r~in ~b~~h~~h~~h~LS. Beach ~r~(/turfs)"); PlayerTextDrawAlignment(playerid, ptxtCaptureText[playerid][1], 2); PlayerTextDrawBackgroundColor(playerid, ptxtCaptureText[playerid][1], 255); PlayerTextDrawFont(playerid, ptxtCaptureText[playerid][1], 1); PlayerTextDrawLetterSize(playerid, ptxtCaptureText[playerid][1], 0.180000, 0.799999); PlayerTextDrawColor(playerid, ptxtCaptureText[playerid][1], -1); PlayerTextDrawSetOutline(playerid, ptxtCaptureText[playerid][1], 1); PlayerTextDrawSetProportional(playerid, ptxtCaptureText[playerid][1], 1); PlayerTextDrawSetSelectable(playerid, ptxtCaptureText[playerid][1], 0); ptxtHelmet[playerid] = CreatePlayerTextDraw(playerid, 606.000000, 132.000000, "/Helmet: ~g~ON"); PlayerTextDrawAlignment(playerid, ptxtHelmet[playerid], 3); PlayerTextDrawBackgroundColor(playerid, ptxtHelmet[playerid], 255); PlayerTextDrawFont(playerid, ptxtHelmet[playerid], 1); PlayerTextDrawLetterSize(playerid, ptxtHelmet[playerid], 0.239999, 1.199999); PlayerTextDrawColor(playerid, ptxtHelmet[playerid], -1); PlayerTextDrawSetOutline(playerid, ptxtHelmet[playerid], 1); PlayerTextDrawSetProportional(playerid, ptxtHelmet[playerid], 1); PlayerTextDrawSetPreviewModel(playerid, ptxtHelmet[playerid], 355); PlayerTextDrawSetPreviewRot(playerid, ptxtHelmet[playerid], 0.000000, 0.000000, -50.000000, 1.000000); PlayerTextDrawSetSelectable(playerid, ptxtHelmet[playerid], 0); ptxtOffRadar[playerid][0] = CreatePlayerTextDraw(playerid, 606.000000, 111.000000, "/Offradar: ~g~ON"); PlayerTextDrawAlignment(playerid, ptxtOffRadar[playerid][0], 3); PlayerTextDrawBackgroundColor(playerid, ptxtOffRadar[playerid][0], 255); PlayerTextDrawFont(playerid, ptxtOffRadar[playerid][0], 1); PlayerTextDrawLetterSize(playerid, ptxtOffRadar[playerid][0], 0.239999, 1.199999); PlayerTextDrawColor(playerid, ptxtOffRadar[playerid][0], -1); PlayerTextDrawSetOutline(playerid, ptxtOffRadar[playerid][0], 1); PlayerTextDrawSetProportional(playerid, ptxtOffRadar[playerid][0], 1); PlayerTextDrawSetPreviewModel(playerid, ptxtOffRadar[playerid][0], 355); PlayerTextDrawSetPreviewRot(playerid, ptxtOffRadar[playerid][0], 0.000000, 0.000000, -50.000000, 1.000000); PlayerTextDrawSetSelectable(playerid, ptxtOffRadar[playerid][0], 0); ptxtOffRadar[playerid][1] = CreatePlayerTextDraw(playerid,606.000000, 122.000000, "You'll be visible back in ~y~2m 18s"); PlayerTextDrawAlignment(playerid, ptxtOffRadar[playerid][1], 3); PlayerTextDrawBackgroundColor(playerid, ptxtOffRadar[playerid][1], 255); PlayerTextDrawFont(playerid, ptxtOffRadar[playerid][1], 1); PlayerTextDrawLetterSize(playerid, ptxtOffRadar[playerid][1], 0.149999, 0.799998); PlayerTextDrawColor(playerid, ptxtOffRadar[playerid][1], -1); PlayerTextDrawSetOutline(playerid, ptxtOffRadar[playerid][1], 1); PlayerTextDrawSetProportional(playerid, ptxtOffRadar[playerid][1], 1); PlayerTextDrawSetPreviewModel(playerid, ptxtOffRadar[playerid][1], 355); PlayerTextDrawSetPreviewRot(playerid, ptxtOffRadar[playerid][1], 0.000000, 0.000000, -50.000000, 1.000000); PlayerTextDrawSetSelectable(playerid, ptxtOffRadar[playerid][1], 0); ptxtProtection[playerid][0] = CreatePlayerTextDraw(playerid, 319.000000, 189.000000, "Anti-Spawnkill Protection"); PlayerTextDrawAlignment(playerid, ptxtProtection[playerid][0], 2); PlayerTextDrawBackgroundColor(playerid, ptxtProtection[playerid][0], 255); PlayerTextDrawFont(playerid, ptxtProtection[playerid][0], 1); PlayerTextDrawLetterSize(playerid, ptxtProtection[playerid][0], 0.199999, 1.199999); PlayerTextDrawColor(playerid, ptxtProtection[playerid][0], -1); PlayerTextDrawSetOutline(playerid, ptxtProtection[playerid][0], 1); PlayerTextDrawSetProportional(playerid, ptxtProtection[playerid][0], 1); PlayerTextDrawSetPreviewModel(playerid, ptxtProtection[playerid][0], 355); PlayerTextDrawSetPreviewRot(playerid, ptxtProtection[playerid][0], 0.000000, 0.000000, -50.000000, 1.000000); PlayerTextDrawSetSelectable(playerid, ptxtProtection[playerid][0], 0); ptxtProtection[playerid][1] = CreatePlayerTextDraw(playerid, 320.000000, 197.000000, "10s"); PlayerTextDrawAlignment(playerid, ptxtProtection[playerid][1], 2); PlayerTextDrawBackgroundColor(playerid, ptxtProtection[playerid][1], 255); PlayerTextDrawFont(playerid, ptxtProtection[playerid][1], 1); PlayerTextDrawLetterSize(playerid, ptxtProtection[playerid][1], 0.329999, 1.799999); PlayerTextDrawColor(playerid, ptxtProtection[playerid][1], -16776961); PlayerTextDrawSetOutline(playerid, ptxtProtection[playerid][1], 1); PlayerTextDrawSetProportional(playerid, ptxtProtection[playerid][1], 1); PlayerTextDrawSetPreviewModel(playerid, ptxtProtection[playerid][1], 355); PlayerTextDrawSetPreviewRot(playerid, ptxtProtection[playerid][1], 0.000000, 0.000000, -50.000000, 1.000000); PlayerTextDrawSetSelectable(playerid, ptxtProtection[playerid][1], 0); // Gambling ptxtGamble[playerid][0] = CreatePlayerTextDraw(playerid, 229.000000, 168.000000, "ld_spac:white"); PlayerTextDrawBackgroundColor(playerid, ptxtGamble[playerid][0], 255); PlayerTextDrawFont(playerid, ptxtGamble[playerid][0], 4); PlayerTextDrawLetterSize(playerid, ptxtGamble[playerid][0], 0.500000, 1.000000); PlayerTextDrawColor(playerid, ptxtGamble[playerid][0], 255); PlayerTextDrawSetOutline(playerid, ptxtGamble[playerid][0], 0); PlayerTextDrawSetProportional(playerid, ptxtGamble[playerid][0], 1); PlayerTextDrawSetShadow(playerid, ptxtGamble[playerid][0], 1); PlayerTextDrawUseBox(playerid, ptxtGamble[playerid][0], 1); PlayerTextDrawBoxColor(playerid, ptxtGamble[playerid][0], 255); PlayerTextDrawTextSize(playerid, ptxtGamble[playerid][0], 54.000000, 74.000000); PlayerTextDrawSetSelectable(playerid, ptxtGamble[playerid][0], 0); ptxtGamble[playerid][1] = CreatePlayerTextDraw(playerid, 231.000000, 170.000000, "ld_card:cdback"); PlayerTextDrawBackgroundColor(playerid, ptxtGamble[playerid][1], 255); PlayerTextDrawFont(playerid, ptxtGamble[playerid][1], 4); PlayerTextDrawLetterSize(playerid, ptxtGamble[playerid][1], 0.500000, 1.000000); PlayerTextDrawColor(playerid, ptxtGamble[playerid][1], -1); PlayerTextDrawSetOutline(playerid, ptxtGamble[playerid][1], 0); PlayerTextDrawSetProportional(playerid, ptxtGamble[playerid][1], 1); PlayerTextDrawSetShadow(playerid, ptxtGamble[playerid][1], 1); PlayerTextDrawUseBox(playerid, ptxtGamble[playerid][1], 1); PlayerTextDrawBoxColor(playerid, ptxtGamble[playerid][1], 255); PlayerTextDrawTextSize(playerid, ptxtGamble[playerid][1], 50.000000, 70.000000); PlayerTextDrawSetSelectable(playerid, ptxtGamble[playerid][1], 1); ptxtGamble[playerid][2] = CreatePlayerTextDraw(playerid, 289.000000, 168.000000, "ld_spac:white"); PlayerTextDrawBackgroundColor(playerid, ptxtGamble[playerid][2], 255); PlayerTextDrawFont(playerid, ptxtGamble[playerid][2], 4); PlayerTextDrawLetterSize(playerid, ptxtGamble[playerid][2], 0.500000, 1.000000); PlayerTextDrawColor(playerid, ptxtGamble[playerid][2], 255); PlayerTextDrawSetOutline(playerid, ptxtGamble[playerid][2], 0); PlayerTextDrawSetProportional(playerid, ptxtGamble[playerid][2], 1); PlayerTextDrawSetShadow(playerid, ptxtGamble[playerid][2], 1); PlayerTextDrawUseBox(playerid, ptxtGamble[playerid][2], 1); PlayerTextDrawBoxColor(playerid, ptxtGamble[playerid][2], 255); PlayerTextDrawTextSize(playerid, ptxtGamble[playerid][2], 54.000000, 74.000000); PlayerTextDrawSetSelectable(playerid, ptxtGamble[playerid][2], 0); ptxtGamble[playerid][3] = CreatePlayerTextDraw(playerid, 291.000000, 170.000000, "ld_card:cdback"); PlayerTextDrawBackgroundColor(playerid, ptxtGamble[playerid][3], 255); PlayerTextDrawFont(playerid, ptxtGamble[playerid][3], 4); PlayerTextDrawLetterSize(playerid, ptxtGamble[playerid][3], 0.500000, 1.000000); PlayerTextDrawColor(playerid, ptxtGamble[playerid][3], -1); PlayerTextDrawSetOutline(playerid, ptxtGamble[playerid][3], 0); PlayerTextDrawSetProportional(playerid, ptxtGamble[playerid][3], 1); PlayerTextDrawSetShadow(playerid, ptxtGamble[playerid][3], 1); PlayerTextDrawUseBox(playerid, ptxtGamble[playerid][3], 1); PlayerTextDrawBoxColor(playerid, ptxtGamble[playerid][3], 255); PlayerTextDrawTextSize(playerid, ptxtGamble[playerid][3], 50.000000, 70.000000); PlayerTextDrawSetSelectable(playerid, ptxtGamble[playerid][3], 1); ptxtGamble[playerid][4] = CreatePlayerTextDraw(playerid, 349.000000, 168.000000, "ld_spac:white"); PlayerTextDrawBackgroundColor(playerid, ptxtGamble[playerid][4], 255); PlayerTextDrawFont(playerid, ptxtGamble[playerid][4], 4); PlayerTextDrawLetterSize(playerid, ptxtGamble[playerid][4], 0.500000, 1.000000); PlayerTextDrawColor(playerid, ptxtGamble[playerid][4], 255); PlayerTextDrawSetOutline(playerid, ptxtGamble[playerid][4], 0); PlayerTextDrawSetProportional(playerid, ptxtGamble[playerid][4], 1); PlayerTextDrawSetShadow(playerid, ptxtGamble[playerid][4], 1); PlayerTextDrawUseBox(playerid, ptxtGamble[playerid][4], 1); PlayerTextDrawBoxColor(playerid, ptxtGamble[playerid][4], 255); PlayerTextDrawTextSize(playerid, ptxtGamble[playerid][4], 54.000000, 74.000000); PlayerTextDrawSetSelectable(playerid, ptxtGamble[playerid][4], 0); ptxtGamble[playerid][5] = CreatePlayerTextDraw(playerid, 351.000000, 170.000000, "ld_card:cdback"); PlayerTextDrawBackgroundColor(playerid, ptxtGamble[playerid][5], 255); PlayerTextDrawFont(playerid, ptxtGamble[playerid][5], 4); PlayerTextDrawLetterSize(playerid, ptxtGamble[playerid][5], 0.500000, 1.000000); PlayerTextDrawColor(playerid, ptxtGamble[playerid][5], -1); PlayerTextDrawSetOutline(playerid, ptxtGamble[playerid][5], 0); PlayerTextDrawSetProportional(playerid, ptxtGamble[playerid][5], 1); PlayerTextDrawSetShadow(playerid, ptxtGamble[playerid][5], 1); PlayerTextDrawUseBox(playerid, ptxtGamble[playerid][5], 1); PlayerTextDrawBoxColor(playerid, ptxtGamble[playerid][5], 255); PlayerTextDrawTextSize(playerid, ptxtGamble[playerid][5], 50.000000, 70.000000); PlayerTextDrawSetSelectable(playerid, ptxtGamble[playerid][5], 1); return SetTimerEx("OnPlayerJoin", 150, false, "i", playerid); } forward OnPlayerJoin(playerid); public OnPlayerJoin(playerid) { for (new i; i < 100; i++) { SendClientMessage(playerid, COLOR_WHITE, ""); } SendClientMessage(playerid, COLOR_YELLOW, "You have connected to \"SA-MP 0.3.7 Server\""); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); new string[256]; format(string, sizeof(string), "SELECT * FROM `users` WHERE `name` = '%q' LIMIT 1", name); new DBResult:result = db_query(db, string); if (db_num_rows(result) == 0) { eUser[playerid][e_USER_SQLID] = -1; eUser[playerid][e_USER_PASSWORD][0] = EOS; eUser[playerid][e_USER_SALT][0] = EOS; eUser[playerid][e_USER_KILLS] = 0; eUser[playerid][e_USER_DEATHS] = 0; eUser[playerid][e_USER_MONEY] = 0; eUser[playerid][e_USER_ADMIN_LEVEL] = 0; eUser[playerid][e_USER_VIP_LEVEL] = 0; eUser[playerid][e_USER_REGISTER_TIMESTAMP] = 0; eUser[playerid][e_USER_LASTLOGIN_TIMESTAMP] = 0; eUser[playerid][e_USER_SECURITY_QUESTION][0] = EOS; eUser[playerid][e_USER_SECURITY_ANSWER][0] = EOS; Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Account Registeration... [Step: 1/3]", COL_WHITE "Welcome to our server. We will take you through "COL_GREEN"3 simple steps "COL_WHITE"to register your account with a backup option in case you forgot your password!\nPlease enter a password, "COL_TOMATO"case sensitivity"COL_WHITE" is on.", "Continue", "Options"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 1/3] Enter your new account's password."); } else { iPlayerLoginAttempts[playerid] = 0; iPlayerAnswerAttempts[playerid] = 0; eUser[playerid][e_USER_SQLID] = db_get_field_assoc_int(result, "id"); format(string, sizeof(string), "SELECT `lock_timestamp` FROM `temp_blocked_users` WHERE `user_id` = %i LIMIT 1", eUser[playerid][e_USER_SQLID]); new DBResult:lock_result = db_query(db, string); if (db_num_rows(lock_result) == 1) { new lock_timestamp = db_get_field_int(lock_result, 0); if ((gettime() - lock_timestamp) < 0) { format(string, sizeof(string), "Sorry!The account is temporarily locked on your IP. due to %i/%i failed login attempts.", dini_Int(DIRECTORY "config.ini", "max_login_attempts"), dini_Int(DIRECTORY "config.ini", "max_login_attempts")); SendClientMessage(playerid, COLOR_TOMATO, string); format(string, sizeof(string), "You'll be able to try again in %s.", ReturnTimelapse(gettime(), lock_timestamp)); SendClientMessage(playerid, COLOR_TOMATO, string); db_free_result(result); db_free_result(lock_result); return Kick(playerid); } else { new ip[18]; GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "DELETE FROM `temp_blocked_users` WHERE `user_id` = %i AND `ip` = '%s'", eUser[playerid][e_USER_SQLID], ip); db_query(db, string); } } db_free_result(lock_result); db_get_field_assoc(result, "password", eUser[playerid][e_USER_PASSWORD], 64); db_get_field_assoc(result, "salt", eUser[playerid][e_USER_SALT], 64); eUser[playerid][e_USER_SALT][64] = EOS; eUser[playerid][e_USER_KILLS] = db_get_field_assoc_int(result, "kills"); eUser[playerid][e_USER_DEATHS] = db_get_field_assoc_int(result, "deaths"); eUser[playerid][e_USER_MONEY] = db_get_field_assoc_int(result, "money"); eUser[playerid][e_USER_ADMIN_LEVEL] = db_get_field_assoc_int(result, "adminlevel"); eUser[playerid][e_USER_VIP_LEVEL] = db_get_field_assoc_int(result, "viplevel"); eUser[playerid][e_USER_REGISTER_TIMESTAMP] = db_get_field_assoc_int(result, "register_timestamp"); eUser[playerid][e_USER_LASTLOGIN_TIMESTAMP] = db_get_field_assoc_int(result, "lastlogin_timestamp"); db_get_field_assoc(result, "sec_question", eUser[playerid][e_USER_SECURITY_QUESTION], MAX_SECURITY_QUESTION_SIZE); db_get_field_assoc(result, "sec_answer", eUser[playerid][e_USER_SECURITY_ANSWER], 64); format(string, sizeof(string), "SELECT * FROM `user_skills` WHERE `user_id` = %i LIMIT 1", eUser[playerid][e_USER_SQLID]); new DBResult:result2 = db_query(db, string); if (db_num_rows(result2) == 1) { for (new i; i < sizeof(iPlayerSkills[]); i++) iPlayerSkills[playerid][i] = db_get_field_int(result2, i); } db_free_result(result2); format(string, sizeof(string), COL_WHITE "Insert your secret password to access this account. If you failed in "COL_YELLOW"%i "COL_WHITE"attempts, account will be locked for "COL_YELLOW"%i "COL_WHITE"minutes.", dini_Int(DIRECTORY "config.ini", "max_login_attempts"), dini_Int(DIRECTORY "config.ini", "account_lock_minutes")); Dialog_Show(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Account Login...", string, "Login", "Options"); } db_free_result(result); return 1; } Dialog:LOGIN(playerid, response, listitem, inputtext[]) { if (!response) { Dialog_Show(playerid, OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot password\nForgot username\nClose", "Select", "Back"); return 1; } new string[256]; new hash[64]; SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], hash, sizeof(hash)); if (strcmp(hash, eUser[playerid][e_USER_PASSWORD])) { if (++iPlayerLoginAttempts[playerid] == dini_Int(DIRECTORY "config.ini", "max_login_attempts")) { new lock_timestamp = (gettime() + (dini_Int(DIRECTORY "config.ini", "account_lock_minutes") * 60)); new ip[18]; GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "INSERT INTO `temp_blocked_users` VALUES('%s', %i, %i)", ip, lock_timestamp, eUser[playerid][e_USER_SQLID]); db_query(db, string); format(string, sizeof(string), "Sorry!The account has been temporarily locked on your IP. due to %i/%i failed login attempts.", dini_Int(DIRECTORY "config.ini", "max_login_attempts"), dini_Int(DIRECTORY "config.ini", "max_login_attempts")); SendClientMessage(playerid, COLOR_TOMATO, string); format(string, sizeof(string), "If you forgot your password/username, click on 'Options' in login window next time (you may retry in %s).", ReturnTimelapse(gettime(), lock_timestamp)); SendClientMessage(playerid, COLOR_TOMATO, string); return Kick(playerid); } format(string, sizeof(string), COL_WHITE "Insert your secret password to access this account. If you failed in "COL_YELLOW"%i "COL_WHITE"attempts, account will be locked for "COL_YELLOW"%i "COL_WHITE"minutes.", dini_Int(DIRECTORY "config.ini", "max_login_attempts"), dini_Int(DIRECTORY "config.ini", "account_lock_minutes")); Dialog_Show(playerid, LOGIN, DIALOG_STYLE_INPUT, "Account Login...", string, "Login", "Options"); format(string, sizeof(string), "Incorrect password!Your login tries left: %i/%i attempts.", iPlayerLoginAttempts[playerid], dini_Int(DIRECTORY "config.ini", "max_login_attempts")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } new name[MAX_PLAYER_NAME], ip[18]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "UPDATE `users` SET `lastlogin_timestamp` = %i, `ip` = '%s', `longip` = %i WHERE `id` = %i", gettime(), ip, IpToLong(ip), eUser[playerid][e_USER_SQLID]); db_query(db, string); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, eUser[playerid][e_USER_MONEY]); format(string, sizeof(string), "Successfully logged in!Welcome back to our server %s, we hope you enjoy your stay. [Last login: %s ago]", name, ReturnTimelapse(eUser[playerid][e_USER_LASTLOGIN_TIMESTAMP], gettime())); SendClientMessage(playerid, COLOR_GREEN, string); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); SetPVarInt(playerid, "LoggedIn", 1); CallRemoteFunction("OnPlayerLogin", "i", playerid); OnPlayerRequestClass(playerid, iPlayerClassid[playerid]); return 1; } Dialog:REGISTER(playerid, response, listitem, inputtext[]) { if (!response) { Dialog_Show(playerid, OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot password\nForgot username\nClose", "Select", "Back"); return 1; } if (!(dini_Int(DIRECTORY "config.ini", "min_password_length") <= strlen(inputtext) <= dini_Int(DIRECTORY "config.ini", "max_password_length"))) { Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Account Registeration... [Step: 1/3]", COL_WHITE "Welcome to our server. We will take you through "COL_GREEN"3 simple steps "COL_WHITE"to register your account with a backup option in case you forgot your password!\nPlease enter a password, "COL_TOMATO"case sensitivity"COL_WHITE" is on.", "Continue", "Options"); new string[150]; format(string, sizeof(string), "Invalid password length, must be between %i - %i characters.", dini_Int(DIRECTORY "config.ini", "min_password_length"), dini_Int(DIRECTORY "config.ini", "max_password_length")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } if (dini_Bool(DIRECTORY "config.ini", "toggle_secure_password")) { if (!IsPasswordSecure(inputtext)) { Dialog_Show(playerid, REGISTER, DIALOG_STYLE_INPUT, "Account Registeration... [Step: 1/3]", COL_WHITE "Welcome to our server. We will take you through "COL_GREEN"3 simple steps "COL_WHITE"to register your account with a backup option in case you forgot your password!\nPlease enter a password, "COL_TOMATO"case sensitivity"COL_WHITE" is on.", "Continue", "Options"); SendClientMessage(playerid, COLOR_TOMATO, "Password must contain atleast a Highercase, a Lowercase and a Number."); return 1; } } for (new i; i < 64; i++) { eUser[playerid][e_USER_SALT][i] = (random('z' - 'A') + 'A'); } eUser[playerid][e_USER_SALT][64] = EOS; SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_PASSWORD], 64); new line[MAX_SECURITY_QUESTION_SIZE], info[MAX_SECURITY_QUESTIONS * MAX_SECURITY_QUESTION_SIZE], File:h, count; h = fopen(DIRECTORY "questions.ini", io_read); while (fread(h, line)) { strcat(info, line); strcat(info, "\n"); if (++count >= MAX_SECURITY_QUESTIONS) break; } fclose(h); Dialog_Show(playerid, SEC_QUESTION, DIALOG_STYLE_LIST, "Account Registeration... [Step: 2/3]", info, "Continue", "Back"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 2/3] Select a security question. This will help you retrieve your password in case you forget it any time soon!"); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); return 1; } Dialog:SEC_QUESTION(playerid, response, listitem, inputtext[]) { if (!response) { Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Account Registeration... [Step: 1/3]", COL_WHITE "Welcome to our server. We will take you through "COL_GREEN"3 simple steps "COL_WHITE"to register your account with a backup option in case you forgot your password!\nPlease enter a password, "COL_TOMATO"case sensitivity"COL_WHITE" is on.", "Continue", "Options"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 1/3] Enter your new account's password."); return 1; } format(eUser[playerid][e_USER_SECURITY_QUESTION], MAX_SECURITY_QUESTION_SIZE, inputtext); new string[256]; format(string, sizeof(string), COL_TOMATO "%s\n"COL_WHITE"Insert your answer below in the box. (don't worry about CAPS, answers are NOT case sensitive).", inputtext); Dialog_Show(playerid, SEC_ANSWER, DIALOG_STYLE_INPUT, "Account Registeration... [Step: 3/3]", string, "Confirm", "Back"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 3/3] Write the answer to your secuirty question and you'll be done :)"); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); return 1; } Dialog:SEC_ANSWER(playerid, response, listitem, inputtext[]) { if (!response) { new line[MAX_SECURITY_QUESTION_SIZE], info[MAX_SECURITY_QUESTIONS * MAX_SECURITY_QUESTION_SIZE], File:h, count; h = fopen(DIRECTORY "questions.ini", io_read); while (fread(h, line)) { strcat(info, line); strcat(info, "\n"); if (++count >= MAX_SECURITY_QUESTIONS) break; } fclose(h); Dialog_Show(playerid, SEC_QUESTION, DIALOG_STYLE_LIST, "Account Registeration... [Step: 2/3]", info, "Continue", "Back"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 2/3] Select a security question. This will help you retrieve your password in case you forget it any time soon!"); return 1; } new string[512]; if (strlen(inputtext) < dini_Int(DIRECTORY "config.ini", "min_password_length") || inputtext[0] == ' ') { format(string, sizeof(string), COL_TOMATO "%s\n"COL_WHITE"Insert your answer below in the box. (don't worry about CAPS, answers are NOT case sensitive).", eUser[playerid][e_USER_SECURITY_QUESTION]); Dialog_Show(playerid, SEC_ANSWER, DIALOG_STYLE_INPUT, "Account Registeration... [Step: 3/3]", string, "Confirm", "Back"); format(string, sizeof(string), "Security answer cannot be an less than %i characters.", dini_Int(DIRECTORY "config.ini", "min_password_length")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } for (new i, j = strlen(inputtext); i < j; i++) { inputtext[i] = tolower(inputtext[i]); } SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_SECURITY_ANSWER], 64); new name[MAX_PLAYER_NAME], ip[18]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "INSERT INTO `users`(`name`, `ip`, `longip`, `password`, `salt`, `sec_question`, `sec_answer`, `register_timestamp`, `lastlogin_timestamp`) VALUES('%s', '%s', %i, '%q', '%q', '%q', '%q', %i, %i)", name, ip, IpToLong(ip), eUser[playerid][e_USER_PASSWORD], eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_SECURITY_QUESTION], eUser[playerid][e_USER_SECURITY_ANSWER], gettime(), gettime()); db_query(db, string); format(string, sizeof(string), "SELECT `id` FROM `users` WHERE `name` = '%q' LIMIT 1", name); new DBResult:result = db_query(db, string); eUser[playerid][e_USER_SQLID] = db_get_field_int(result, 0); db_free_result(result); format(string, sizeof(string), "INSERT INTO `user_skills`(`user_id`) VALUES(%i)", eUser[playerid][e_USER_SQLID]); db_query(db, string); eUser[playerid][e_USER_REGISTER_TIMESTAMP] = gettime(); eUser[playerid][e_USER_LASTLOGIN_TIMESTAMP] = gettime(); format(string, sizeof(string), "Successfully registered!Welcome to our server %s, we hope you enjoy your stay. [IP: %s]", name, ip); SendClientMessage(playerid, COLOR_GREEN, string); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); SetPVarInt(playerid, "LoggedIn", 1); CallRemoteFunction("OnPlayerRegister", "i", playerid); CallRemoteFunction("OnPlayerLogin", "i", playerid); OnPlayerRequestClass(playerid, iPlayerClassid[playerid]); return 1; } Dialog:OPTIONS(playerid, response, listitem, inputtext[]) { if (!response) { if (eUser[playerid][e_USER_SQLID] != -1) { new string[256]; format(string, sizeof(string), COL_WHITE "Insert your secret password to access this account. If you failed in "COL_YELLOW"%i "COL_WHITE"attempts, account will be locked for "COL_YELLOW"%i "COL_WHITE"minutes.", dini_Int(DIRECTORY "config.ini", "max_login_attempts"), dini_Int(DIRECTORY "config.ini", "account_lock_minutes")); Dialog_Show(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Account Login...", string, "Login", "Options"); } else Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Account Registeration... [Step: 1/3]", COL_WHITE "Welcome to our server. We will take you through "COL_GREEN"3 simple steps "COL_WHITE"to register your account with a backup option in case you forgot your password!\nPlease enter a password, "COL_TOMATO"case sensitivity"COL_WHITE" is on.", "Continue", "Options"); return 1; } switch (listitem) { case 0: { if (eUser[playerid][e_USER_SQLID] == -1) { SendClientMessage(playerid, COLOR_TOMATO, "This account isn't registered, try 'Forgot Username' or change your name and connect."); Dialog_Show(playerid, OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot password\nForgot username\nClose", "Select", "Back"); return 1; } new string[64 + MAX_SECURITY_QUESTION_SIZE]; format(string, sizeof(string), COL_WHITE "Answer your security question to reset password.\n\n"COL_TOMATO"%s", eUser[playerid][e_USER_SECURITY_QUESTION]); Dialog_Show(playerid, FORGOT_PASSWORD, DIALOG_STYLE_INPUT, "Forgot Password:", string, "Next", "Cancel"); } case 1: { const MASK = (-1 << (32 - 36)); new string[256], ip[18]; GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "SELECT `name`, `lastlogin_timestamp` FROM `users` WHERE ((`longip` & %i) = %i) LIMIT 1", MASK, (IpToLong(ip) & MASK)); new DBResult:result = db_query(db, string); if (db_num_rows(result) == 0) { SendClientMessage(playerid, COLOR_TOMATO, "There are no accounts realted to this ip, this seems to be your first join!"); Dialog_Show(playerid, OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot password\nForgot username\nClose", "Select", "Back"); return 1; } new list[25 * (MAX_PLAYER_NAME + 32)], name[MAX_PLAYER_NAME], lastlogin_timestamp, i, j = ((db_num_rows(result) > 10) ? (10) : (db_num_rows(result))); do { db_get_field_assoc(result, "name", name, MAX_PLAYER_NAME); lastlogin_timestamp = db_get_field_assoc_int(result, "lastlogin_timestamp"); format(list, sizeof(list), "%s"COL_TOMATO"%s "COL_WHITE"|| Last login: %s ago\n", list, name, ReturnTimelapse(lastlogin_timestamp, gettime())); } while (db_next_row(result) && i > j); db_free_result(result); Dialog_Show(playerid, FORGOT_USERNAME, DIALOG_STYLE_LIST, "Your username history...", list, "Ok", ""); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); } case 2: { return Kick(playerid); } } return 1; } Dialog:FORGOT_PASSWORD(playerid, response, listitem, inputtext[]) { if (!response) { Dialog_Show(playerid, OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot password\nForgot username\nClose", "Select", "Back"); return 1; } new string[256], hash[64]; SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], hash, sizeof(hash)); if (strcmp(hash, eUser[playerid][e_USER_SECURITY_ANSWER])) { if (++iPlayerAnswerAttempts[playerid] == dini_Int(DIRECTORY "config.ini", "max_login_attempts")) { new lock_timestamp = gettime() + (dini_Int(DIRECTORY "config.ini", "account_lock_minutes") * 60); new ip[18]; GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "INSERT INTO `temp_blocked_users` VALUES('%s', %i, %i)", ip, lock_timestamp, eUser[playerid][e_USER_SQLID]); db_query(db, string); format(string, sizeof(string), "Sorry!The account has been temporarily locked on your IP. due to %i/%i failed login attempts.", dini_Int(DIRECTORY "config.ini", "max_login_attempts"), dini_Int(DIRECTORY "config.ini", "max_login_attempts")); SendClientMessage(playerid, COLOR_TOMATO, string); format(string, sizeof(string), "If you forgot your password/username, click on 'Options' in login window next time (you may retry in %s).", ReturnTimelapse(gettime(), lock_timestamp)); SendClientMessage(playerid, COLOR_TOMATO, string); return Kick(playerid); } format(string, sizeof(string), COL_WHITE "Answer your security question to reset password.\n\n"COL_TOMATO"%s", eUser[playerid][e_USER_SECURITY_QUESTION]); Dialog_Show(playerid, FORGOT_PASSWORD, DIALOG_STYLE_INPUT, "Forgot Password:", string, "Next", "Cancel"); format(string, sizeof(string), "Incorrect answer!Your tries left: %i/%i attempts.", iPlayerAnswerAttempts[playerid], dini_Int(DIRECTORY "config.ini", "max_login_attempts")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /ucp.", "Confirm", ""); SendClientMessage(playerid, COLOR_GREEN, "Successfully answered your security question!You shall now reset your password."); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); return 1; } Dialog:RESET_PASSWORD(playerid, response, listitem, inputtext[]) { if (!response) { Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /ucp.", "Confirm", ""); return 1; } new string[256]; if (!(dini_Int(DIRECTORY "config.ini", "min_password_length") <= strlen(inputtext) <= dini_Int(DIRECTORY "config.ini", "max_password_length"))) { Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /ucp.", "Confirm", ""); format(string, sizeof(string), "Invalid password length, must be between %i - %i characters.", dini_Int(DIRECTORY "config.ini", "min_password_length"), dini_Int(DIRECTORY "config.ini", "max_password_length")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } if (dini_Bool(DIRECTORY "config.ini", "toggle_secure_password")) { if (!IsPasswordSecure(inputtext)) { Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /ucp.", "Confirm", ""); SendClientMessage(playerid, COLOR_TOMATO, "Password must contain atleast a Highercase, a Lowercase and a Number."); return 1; } } SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_PASSWORD], 64); new name[MAX_PLAYER_NAME], ip[18]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); GetPlayerIp(playerid, ip, 18); format(string, sizeof(string), "UPDATE `users` SET `password` = '%q', `ip` = '%s', `longip` = %i, `lastlogin_timestamp` = %i WHERE `id` = %i", eUser[playerid][e_USER_PASSWORD], ip, IpToLong(ip), gettime(), eUser[playerid][e_USER_SQLID]); db_query(db, string); format(string, sizeof(string), "Successfully logged in with new password!Welcome back to our server %s, we hope you enjoy your stay. [Last login: %s ago]", name, ReturnTimelapse(eUser[playerid][e_USER_LASTLOGIN_TIMESTAMP], gettime())); SendClientMessage(playerid, COLOR_GREEN, string); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); SetPVarInt(playerid, "LoggedIn", 1); CallRemoteFunction("OnPlayerLogin", "i", playerid); OnPlayerRequestClass(playerid, iPlayerClassid[playerid]); return 1; } Dialog:FORGOT_USERNAME(playerid, response, listitem, inputtext[]) { Dialog_Show(playerid, OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot password\nForgot username\nClose", "Select", "Back"); return 1; } public OnPlayerDisconnect(playerid, reason) { if (iPlayerProtection[playerid][0] > 0) { DestroyDynamic3DTextLabel(iPlayerProtection3DText[playerid]); KillTimer(iPlayerProtection[playerid][1]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][0]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][1]); } if (iPlayerOffRadar[playerid][0] > 0) KillTimer(iPlayerOffRadar[playerid][1]); if (GetPVarInt(playerid, "LoggedIn")) { new string[1024], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string, sizeof(string), "UPDATE `users` SET `name` = '%s', `password` = '%q', `salt` = '%q', `sec_question` = '%q', `sec_answer` = '%q', `kills` = %i, `deaths` = %i, `money` = %i, `adminlevel` = %i, `viplevel` = %i WHERE `id` = %i", name, eUser[playerid][e_USER_PASSWORD], eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_SECURITY_QUESTION], eUser[playerid][e_USER_SECURITY_ANSWER], eUser[playerid][e_USER_KILLS], eUser[playerid][e_USER_DEATHS], GetPlayerMoney(playerid), eUser[playerid][e_USER_ADMIN_LEVEL], eUser[playerid][e_USER_VIP_LEVEL], eUser[playerid][e_USER_SQLID]); db_query(db, string); format(string, sizeof(string), "UPDATE `user_skills` SET `WEAPONSKILL_PISTOL` = %i, `WEAPONSKILL_PISTOL_SILENCED` = %i, `WEAPONSKILL_DESERT_EAGLE` = %i, `WEAPONSKILL_SHOTGUN` = %i, `WEAPONSKILL_SAWNOFF_SHOTGUN` = %i, `WEAPONSKILL_SPAS12_SHOTGUN` = %i, `WEAPONSKILL_MICRO_UZI` = %i, `WEAPONSKILL_MP5` = %i, `WEAPONSKILL_AK47` = %i, `WEAPONSKILL_M4` = %i, `WEAPONSKILL_SNIPERRIFLE` = %i WHERE `user_id` = %i", iPlayerSkills[playerid][WEAPONSKILL_PISTOL], iPlayerSkills[playerid][WEAPONSKILL_PISTOL_SILENCED], iPlayerSkills[playerid][WEAPONSKILL_DESERT_EAGLE], iPlayerSkills[playerid][WEAPONSKILL_SHOTGUN], iPlayerSkills[playerid][WEAPONSKILL_SAWNOFF_SHOTGUN], iPlayerSkills[playerid][WEAPONSKILL_SPAS12_SHOTGUN], iPlayerSkills[playerid][WEAPONSKILL_MICRO_UZI], iPlayerSkills[playerid][WEAPONSKILL_MP5], iPlayerSkills[playerid][WEAPONSKILL_AK47], iPlayerSkills[playerid][WEAPONSKILL_M4], iPlayerSkills[playerid][WEAPONSKILL_SNIPERRIFLE], eUser[playerid][e_USER_SQLID]); db_query(db, string); } return 1; } public OnPlayerRequestClass(playerid, classid) { new h, m, s; gettime(h, m, s); #pragma unused s SetPlayerTime(playerid, h, m); SetPlayerWeather(playerid, iWeather); if (bPlayerGambleStarted[playerid]) { bPlayerGambleStarted[playerid] = false; PlayerTextDrawHide(playerid, ptxtGamble[playerid][0]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][1]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][2]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][3]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][4]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][5]); } if (iPlayerProtection[playerid][0] > 0) { DestroyDynamic3DTextLabel(iPlayerProtection3DText[playerid]); KillTimer(iPlayerProtection[playerid][1]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][0]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][1]); } if (iPlayerOffRadar[playerid][0] > 0) KillTimer(iPlayerOffRadar[playerid][1]); if (iPlayerCaptureZone[playerid] != -1) { OnPlayerLeaveDynamicCP(playerid, eCaptureZone[iPlayerCaptureZone[playerid]][e_CAPTURE_ZONE_CPID]); iPlayerCaptureZone[playerid] = -1; } iPlayerClassid[playerid] = classid; if (!GetPVarInt(playerid, "LoggedIn")) { SetPlayerCameraPos(playerid, 693.9114, -494.8807, 22.6305); SetPlayerCameraLookAt(playerid, 693.2760, -494.1037, 22.5604, CAMERA_MOVE); } else { switch (classid) { case 0..14: { ShowNotification(playerid, "~w~You have chossen team ~r~Terrorists~w~. You mission is to eliminate ~b~Cops ~w~and capture all their terroteries!", 0); SetPlayerPos(playerid, 681.7634, -477.5455, 16.3359); SetPlayerFacingAngle(playerid, 179.5926); SetPlayerCameraPos(playerid, 681.3257, -489.8256, 19.6577); SetPlayerCameraLookAt(playerid, 681.3247, -488.8275, 19.5426, CAMERA_MOVE); SetPlayerTeam(playerid, TEAM_TERRORISTS); } default: { ShowNotification(playerid, "~w~You have chossen team ~b~Cops~w~. You mission is to eliminate ~r~Terrorists ~w~and capture all their terroteries!", 0); SetPlayerPos(playerid, 620.1630, -601.8186, 17.2330); SetPlayerFacingAngle(playerid, 270.1233); SetPlayerCameraPos(playerid, 634.4814, -602.4117, 21.7124); SetPlayerCameraLookAt(playerid, 633.4851, -602.4774, 21.5773, CAMERA_MOVE); SetPlayerTeam(playerid, TEAM_COPS); } } } PlayerTextDrawHide(playerid, ptxtHelmet[playerid]); PlayerTextDrawHide(playerid, ptxtOffRadar[playerid][0]); PlayerTextDrawHide(playerid, ptxtOffRadar[playerid][1]); return 1; } public OnPlayerRequestSpawn(playerid) { if (!GetPVarInt(playerid, "LoggedIn")) { GameTextForPlayer(playerid, "~n~~n~~n~~n~~r~Login/Register first, before spawning!", 3000, 3); return 0; } new count[2]; for (new i, j = GetPlayerPoolSize(); i <= j; i++) { if (i != playerid && IsPlayerConnected(i)) { if (GetPlayerTeam(i) == TEAM_COPS) count[0]++; else if (GetPlayerTeam(i) == TEAM_TERRORISTS) count[1]++; } } if ((GetPlayerTeam(playerid) == TEAM_COPS && count[0] > count[1]) || (GetPlayerTeam(playerid) == TEAM_TERRORISTS && count[1] > count[0])) { GameTextForPlayer(playerid, "~n~~n~~n~~n~~r~Team Full!!", 2000, 3); return 0; } SendClientMessage(playerid, COLOR_WHITE, ""); SendClientMessage(playerid, COLOR_WHITE, "/kill - commit sucide"); SendClientMessage(playerid, COLOR_WHITE, "/shop - open shop dialog"); SendClientMessage(playerid, COLOR_WHITE, "/weapons - open weapons shop dialog"); SendClientMessage(playerid, COLOR_WHITE, "/vehicles - open vehicles shop dialog"); SendClientMessage(playerid, COLOR_WHITE, "/helmet - buy a headshot protection helmet"); SendClientMessage(playerid, COLOR_WHITE, "/offradar - go invisible on radar/map for 2 minutes"); SendClientMessage(playerid, COLOR_WHITE, "/gamble - make some money through betting"); SendClientMessage(playerid, COLOR_WHITE, "/stats - player statistics"); SendClientMessage(playerid, COLOR_WHITE, "/skills - player skills statistics"); SendClientMessage(playerid, COLOR_WHITE, "/changeques - change your security question & answer"); SendClientMessage(playerid, COLOR_WHITE, "/changepass - change your account password"); return 1; } forward OnPlayerSpawnProtectonUpdate(playerid); public OnPlayerSpawnProtectonUpdate(playerid) { if (iPlayerProtection[playerid][0] == 0) { DestroyDynamic3DTextLabel(iPlayerProtection3DText[playerid]); KillTimer(iPlayerProtection[playerid][1]); iPlayerProtection[playerid][1] = SetTimerEx("OnPlayerSpawnProtectionEnd", 3000, false, "i", playerid); PlayerTextDrawSetString(playerid, ptxtProtection[playerid][0], "~r~Spawn protection has ended"); PlayerTextDrawHide(playerid, ptxtProtection[playerid][1]); SetPlayerHealth(playerid, 100.0); SetPlayerArmour(playerid, 20.0); SendClientMessage(playerid, COLOR_TOMATO, "Spawn protection has ended!"); iPlayerSpree[playerid] = 0; return; } new string[64]; format(string, sizeof(string), "Spawn protected for 10 seconds...", iPlayerProtection[playerid][0]--); UpdateDynamic3DTextLabelText(iPlayerProtection3DText[playerid], COLOR_TOMATO, string); format(string, sizeof(string), "%is", iPlayerProtection[playerid][0]); PlayerTextDrawSetString(playerid, ptxtProtection[playerid][1], string); } forward OnPlayerSpawnProtectionEnd(playerid); public OnPlayerSpawnProtectionEnd(playerid) { iPlayerProtection[playerid][1] = -1; PlayerTextDrawHide(playerid, ptxtProtection[playerid][0]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][1]); } public OnPlayerSpawn(playerid) { new h, m, s; gettime(h, m, s); #pragma unused s SetPlayerTime(playerid, h, m); SetPlayerWeather(playerid, iWeather); if (bPlayerGambleStarted[playerid]) { bPlayerGambleStarted[playerid] = false; PlayerTextDrawHide(playerid, ptxtGamble[playerid][0]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][1]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][2]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][3]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][4]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][5]); } ShowNotification(playerid, "", 0); if (iPlayerProtection[playerid][0] > 0) { DestroyDynamic3DTextLabel(iPlayerProtection3DText[playerid]); KillTimer(iPlayerProtection[playerid][1]); } iPlayerProtection3DText[playerid] = CreateDynamic3DTextLabel("Spawn protected for 10 seconds...", COLOR_TOMATO, 0.0, 0.0, 0.5, 20.0, playerid, .testlos = 1); iPlayerProtection[playerid][0] = 10; iPlayerProtection[playerid][1] = SetTimerEx("OnPlayerSpawnProtectonUpdate", 1000, true, "i", playerid); PlayerTextDrawSetString(playerid, ptxtProtection[playerid][0], "Anti-Spawnkill Protection"); PlayerTextDrawShow(playerid, ptxtProtection[playerid][0]); PlayerTextDrawSetString(playerid, ptxtProtection[playerid][1], "10s"); PlayerTextDrawShow(playerid, ptxtProtection[playerid][1]); SetPlayerHealth(playerid, FLOAT_INFINITY); PlayerTextDrawShow(playerid, ptxtHelmet[playerid]); PlayerTextDrawShow(playerid, ptxtOffRadar[playerid][0]); PlayerTextDrawShow(playerid, ptxtOffRadar[playerid][1]); RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1); bPlayerHelmet[playerid] = false; PlayerTextDrawSetString(playerid, ptxtHelmet[playerid], "/Helmet: ~r~OFF"); if (iPlayerOffRadar[playerid][0] <= 0) { PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][0], "/Offradar: ~r~OFF"); PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][1], "Invisibility on map for 2 minutes"); } iPlayerHeadshotData[playerid][0] = INVALID_PLAYER_ID; iPlayerHeadshotData[playerid][1] = 0; ResetPlayerWeapons(playerid); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); SetPlayerScore(playerid, floatround((eUser[playerid][e_USER_DEATHS] == 0) ? (0.0) : (floatdiv(eUser[playerid][e_USER_KILLS], eUser[playerid][e_USER_DEATHS])))); GivePlayerMoney(playerid, 100); new r; if (GetPlayerTeam(playerid) == TEAM_COPS) { r = random(sizeof(COPS_SPAWN)); SetPlayerPos(playerid, COPS_SPAWN[r][0], COPS_SPAWN[r][1], COPS_SPAWN[r][2]); SetPlayerFacingAngle(playerid, COPS_SPAWN[r][3]); SetPlayerColor(playerid, TEAM_COLOR_COPS); GivePlayerWeapon(playerid, 29, 200); GivePlayerWeapon(playerid, 24, 100); GivePlayerWeapon(playerid, 4, 1); SendClientMessage(playerid, COLOR_TOMATO, "___________________"); SendClientMessage(playerid, COLOR_TOMATO, ""); SendClientMessage(playerid, TEAM_COLOR_COPS, "TEAM: Cops"); SendClientMessage(playerid, COLOR_TOMATO, "Your mission is to elimiate \"Terrorists\". Secondary objective is to capture all the three territories. When your team owns all 3 territories, you get cash advantages."); SendClientMessage(playerid, COLOR_TOMATO, "For list of commands, type /cmds."); SendClientMessage(playerid, COLOR_TOMATO, ""); SendClientMessage(playerid, COLOR_TOMATO, "You have spawn protection for 10 seconds, if you shoot someone, it will end!"); SendClientMessage(playerid, COLOR_TOMATO, "___________________"); } else { r = random(sizeof(TERRORISTS_SPAWN)); SetPlayerPos(playerid, TERRORISTS_SPAWN[r][0], TERRORISTS_SPAWN[r][1], TERRORISTS_SPAWN[r][2]); SetPlayerFacingAngle(playerid, TERRORISTS_SPAWN[r][3]); SetPlayerColor(playerid, TEAM_COLOR_TERRORISTS); GivePlayerWeapon(playerid, 30, 200); GivePlayerWeapon(playerid, 22, 100); GivePlayerWeapon(playerid, 4, 1); SendClientMessage(playerid, COLOR_TOMATO, "___________________"); SendClientMessage(playerid, COLOR_TOMATO, ""); SendClientMessage(playerid, TEAM_COLOR_TERRORISTS, "TEAM: Terrorists"); SendClientMessage(playerid, COLOR_TOMATO, "Your mission is to elimiate \"Cops\". Secondary objective is to capture all the three territories. When your team owns all 3 territories, you get cash advantages."); SendClientMessage(playerid, COLOR_TOMATO, "For list of commands, type /cmds."); SendClientMessage(playerid, COLOR_TOMATO, ""); SendClientMessage(playerid, COLOR_TOMATO, "You have spawn protection for 10 seconds, if you shoot someone, it will end!"); SendClientMessage(playerid, COLOR_TOMATO, "___________________"); } if (iPlayerOffRadar[playerid][0] > 0) { GameTextForPlayer(playerid, "~w~You are still Off-Radar!", 3000, 3); SetPlayerColor(playerid, SET_ALPHA(((GetPlayerTeam(playerid) == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 0)); } SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, iPlayerSkills[playerid][WEAPONSKILL_PISTOL]); SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, iPlayerSkills[playerid][WEAPONSKILL_PISTOL_SILENCED]); SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, iPlayerSkills[playerid][WEAPONSKILL_DESERT_EAGLE]); SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, iPlayerSkills[playerid][WEAPONSKILL_SHOTGUN]); SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, iPlayerSkills[playerid][WEAPONSKILL_SAWNOFF_SHOTGUN]); SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, iPlayerSkills[playerid][WEAPONSKILL_SPAS12_SHOTGUN]); SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, iPlayerSkills[playerid][WEAPONSKILL_MICRO_UZI]); SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, iPlayerSkills[playerid][WEAPONSKILL_MP5]); SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, iPlayerSkills[playerid][WEAPONSKILL_AK47]); SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, iPlayerSkills[playerid][WEAPONSKILL_M4]); SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, iPlayerSkills[playerid][WEAPONSKILL_SNIPERRIFLE]); for (new i; i < sizeof(eCaptureZone); i++) { GangZoneShowForPlayer(playerid, eCaptureZone[i][e_CAPTURE_ZONE_ID], SET_ALPHA(((eCaptureZone[i][e_CAPTURE_ZONE_OWNER] == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 150)); if (eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] != INVALID_PLAYER_ID) { GangZoneFlashForPlayer(playerid, eCaptureZone[i][e_CAPTURE_ZONE_ID], SET_ALPHA(((GetPlayerTeam(playerid) == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 150)); } } return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { for (new i = 0; i < iStaticPickupCount; i++) { if (pickupid == eStaticPickup[i][e_STATIC_PICKUP_ID]) { switch (eStaticPickup[i][e_STATIC_PICKUP_MODEL]) { case 331, 333..341, 321..326, 342..355, 372, 356..371: { GivePlayerWeapon(playerid, GetModelWeaponID(eStaticPickup[i][e_STATIC_PICKUP_MODEL]), _:eStaticPickup[i][e_STATIC_PICKUP_AMOUNT]); } case 1242: { new Float:value; GetPlayerArmour(playerid, value); SetPlayerArmour(playerid, (((value + eStaticPickup[i][e_STATIC_PICKUP_AMOUNT]) >= 100.0) ? (100.0) : (value + eStaticPickup[i][e_STATIC_PICKUP_AMOUNT]))); } case 1240: { new Float:value; GetPlayerHealth(playerid, value); SetPlayerHealth(playerid, (((value + eStaticPickup[i][e_STATIC_PICKUP_AMOUNT]) >= 100.0) ? (100.0) : (value + eStaticPickup[i][e_STATIC_PICKUP_AMOUNT]))); } case 1212, 1550: { GivePlayerMoney(playerid, floatround(eStaticPickup[i][e_STATIC_PICKUP_AMOUNT])); } } StaticPickup_Destroy(i); } } return 1; } public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) { if (GetPlayerTeam(playerid) != NO_TEAM && GetPlayerTeam(damagedid) != NO_TEAM && GetPlayerTeam(playerid) == GetPlayerTeam(damagedid)) { GameTextForPlayer(playerid, "~r~Same Team!", 5000, 3); } else { if (iPlayerProtection[damagedid][0] > 0) { GameTextForPlayer(playerid, "~r~Player under protection!", 5000, 3); return 1; } if (iPlayerProtection[playerid][0] > 0) { iPlayerProtection[playerid][0] = 0; OnPlayerSpawnProtectonUpdate(playerid); } } return 1; } public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) { if (issuerid != INVALID_PLAYER_ID) { PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0); if (bodypart == 9) { if (weaponid == WEAPON_SILENCED || weaponid == WEAPON_MP5 || weaponid == WEAPON_AK47 || weaponid == WEAPON_M4 || weaponid == WEAPON_RIFLE || weaponid == WEAPON_SNIPER || weaponid == WEAPON_MINIGUN) { if (GetPlayerTeam(playerid) != NO_TEAM && GetPlayerTeam(issuerid) != NO_TEAM && GetPlayerTeam(playerid) != GetPlayerTeam(issuerid)) { if (iPlayerProtection[playerid][0] > 0) { GameTextForPlayer(issuerid, "~r~Player under protection!", 5000, 3); return 1; } if (bPlayerHelmet[playerid]) { return GameTextForPlayer(issuerid, "~n~~n~~n~~n~~n~~r~Player Has Helmet!", 5000, 3); } PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0); PlayerPlaySound(issuerid, 1055, 0.0, 0.0, 0.0); SetPlayerHealth(playerid, 0.0); iPlayerHeadshotData[playerid][0] = issuerid; iPlayerHeadshotData[playerid][1] = weaponid; } } } } return 1; } public OnPlayerText(playerid, text[]) { new string[150], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); if (GetPlayerTeam(playerid) == TEAM_TERRORISTS) { format(string, sizeof(string), "sultan %s[%i]: "COL_WHITE"%s", name, playerid, text); SendClientMessageToAll(TEAM_COLOR_TERRORISTS, string); } else if (GetPlayerTeam(playerid) == TEAM_COPS) { format(string, sizeof(string), "officer %s[%i]: "COL_WHITE"%s", name, playerid, text); SendClientMessageToAll(TEAM_COLOR_COPS, string); } return 0; } public OnPlayerEnterDynamicCP(playerid, checkpointid) { for (new i; i < sizeof(eCaptureZone); i++) { if (eCaptureZone[i][e_CAPTURE_ZONE_CPID] == checkpointid) { new string[150]; if (eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] != INVALID_PLAYER_ID) { if (GetPlayerTeam(playerid) == GetPlayerTeam(eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER])) { if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot capture the zone in a vehicle."); format(string, sizeof(string), "Capturing in %i/"#CAPTURE_TIME"...", eCaptureZone[i][e_CAPTURE_ZONE_TICK]); PlayerTextDrawSetString(playerid, ptxtCapture[playerid], string); PlayerTextDrawShow(playerid, ptxtCapture[playerid]); SetPlayerProgressBarValue(playerid, pbarCapture[playerid], eCaptureZone[i][e_CAPTURE_ZONE_TICK]); ShowPlayerProgressBar(playerid, pbarCapture[playerid]); eCaptureZone[i][e_CAPTURE_ZONE_PLAYERS]++; iPlayerCaptureZone[playerid] = i; SendClientMessage(playerid, COLOR_WHITE, "Stay in the checkpoint to assist your teammate in capturing the zone."); } } else { if (GetPlayerTeam(playerid) != eCaptureZone[i][e_CAPTURE_ZONE_OWNER]) { if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot capture the zone in a vehicle."); format(string, sizeof(string), "The zone is controlled by team %s. Stay in the checkpoint for "#CAPTURE_TIME" seconds to capture the zone.", ((eCaptureZone[i][e_CAPTURE_ZONE_OWNER] == TEAM_COPS) ? ("Cops") : ("Terrorists"))); SendClientMessage(playerid, COLOR_WHITE, string); GangZoneFlashForAll(eCaptureZone[i][e_CAPTURE_ZONE_ID], SET_ALPHA(((GetPlayerTeam(playerid) == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 150)); iPlayerCaptureZone[playerid] = i; eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] = playerid; eCaptureZone[i][e_CAPTURE_ZONE_PLAYERS] = 1; eCaptureZone[i][e_CAPTURE_ZONE_TICK] = 0; KillTimer(eCaptureZone[i][e_CAPTURE_ZONE_TIMER]); eCaptureZone[i][e_CAPTURE_ZONE_TIMER] = SetTimerEx("OnZoneUpdate", 1000, true, "i", i); if (GetPlayerTeam(playerid) == TEAM_COPS) { new copstr[150], Terroriststr[150]; format(copstr, sizeof(copstr), "~y~We have provoked ~r~Terrorists ~y~territory %s", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); format(Terroriststr, sizeof(Terroriststr), "~b~Cops ~y~have provoked our territory %s", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); for (new p, l = GetPlayerPoolSize(); p <= l; p++) { if (GetPlayerTeam(p) == TEAM_COPS) ShowCaptureText(p, 1, copstr, 10000); if (GetPlayerTeam(p) == TEAM_TERRORISTS) ShowCaptureText(p, 0, Terroriststr, 10000); } } else if (GetPlayerTeam(playerid) == TEAM_TERRORISTS) { new copstr[150], Terroriststr[150]; format(copstr, sizeof(copstr), "~r~Terrorists ~y~have provoked our territory %s", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); format(Terroriststr, sizeof(Terroriststr), "~y~We have provoked ~b~Cops ~y~territory %s", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); for (new p, l = GetPlayerPoolSize(); p <= l; p++) { if (GetPlayerTeam(p) == TEAM_COPS) ShowCaptureText(p, 0, copstr, 10000); if (GetPlayerTeam(p) == TEAM_TERRORISTS) ShowCaptureText(p, 1, Terroriststr, 10000); } } PlayerTextDrawSetString(playerid, ptxtCapture[playerid], "Capturing in 1/"#CAPTURE_TIME"..."); PlayerTextDrawShow(playerid, ptxtCapture[playerid]); SetPlayerProgressBarValue(playerid, pbarCapture[playerid], eCaptureZone[i][e_CAPTURE_ZONE_TICK]); ShowPlayerProgressBar(playerid, pbarCapture[playerid]); } else { if (eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] != INVALID_PLAYER_ID) GameTextForPlayer(playerid, "~r~~h~~h~~h~Protect zone from enemies!", 2000, 1); else GameTextForPlayer(playerid, "~r~~h~~h~~h~Zone secure!", 2000, 1); } } break; } } return 1; } forward OnZoneUpdate(zoneid); public OnZoneUpdate(zoneid) { switch(eCaptureZone[zoneid][e_CAPTURE_ZONE_PLAYERS]) { case 1: eCaptureZone[zoneid][e_CAPTURE_ZONE_TICK] += 1; case 2: eCaptureZone[zoneid][e_CAPTURE_ZONE_TICK] += 2; default: eCaptureZone[zoneid][e_CAPTURE_ZONE_TICK] += 3; } new string[150]; format(string, sizeof(string), "Capturing in %i/"#CAPTURE_TIME"...", eCaptureZone[zoneid][e_CAPTURE_ZONE_TICK]); for (new i, j = GetPlayerPoolSize(); i <= j; i++) { if (IsPlayerInDynamicCP(i, eCaptureZone[zoneid][e_CAPTURE_ZONE_CPID]) && !IsPlayerInAnyVehicle(i) && GetPlayerTeam(i) == GetPlayerTeam(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER])) { SetPlayerProgressBarValue(i, pbarCapture[i], eCaptureZone[zoneid][e_CAPTURE_ZONE_TICK]); PlayerTextDrawSetString(i, ptxtCapture[i], string); } } if (eCaptureZone[zoneid][e_CAPTURE_ZONE_TICK] > CAPTURE_TIME) { SendClientMessage(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER], COLOR_GREEN, "You have successfully captured the zone, +$1000."); GivePlayerMoney(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER], 1000); for (new i, j = GetPlayerPoolSize(); i <= j; i++) { if (IsPlayerInDynamicCP(i, eCaptureZone[zoneid][e_CAPTURE_ZONE_CPID])) { PlayerTextDrawHide(i, ptxtCapture[i]); HidePlayerProgressBar(i, pbarCapture[i]); if (i != eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER] && GetPlayerTeam(i) == GetPlayerTeam(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER]) && !IsPlayerInAnyVehicle(i)) { SendClientMessage(i, COLOR_GREEN, "You have assisted your teammate to capture the zone, +$500."); GivePlayerMoney(i, 500); } } } GangZoneStopFlashForAll(eCaptureZone[zoneid][e_CAPTURE_ZONE_ID]); GangZoneShowForAll(eCaptureZone[zoneid][e_CAPTURE_ZONE_ID], SET_ALPHA(((GetPlayerTeam(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER]) == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 150)); KillTimer(eCaptureZone[zoneid][e_CAPTURE_ZONE_TIMER]); if (GetPlayerTeam(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER]) == TEAM_COPS) { new copstr[150], Terroriststr[150]; format(copstr, sizeof(copstr), "~g~We have taken over the territory %s from ~r~Terrorists", eCaptureZone[zoneid][e_CAPTURE_ZONE_NAME]); format(Terroriststr, sizeof(Terroriststr), "~b~Cops ~r~have taken over our territory %s", eCaptureZone[zoneid][e_CAPTURE_ZONE_NAME]); for (new i, j = GetPlayerPoolSize(); i <= j; i++) { if (GetPlayerTeam(i) == TEAM_COPS) ShowCaptureText(i, 0, copstr, 10000); if (GetPlayerTeam(i) == TEAM_TERRORISTS) ShowCaptureText(i, 1, Terroriststr, 10000); } } else if (GetPlayerTeam(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER]) == TEAM_TERRORISTS) { new copstr[150], Terroriststr[150]; format(copstr, sizeof(copstr), "~r~Terrorists ~r~have taken over our territory %s", eCaptureZone[zoneid][e_CAPTURE_ZONE_NAME]); format(Terroriststr, sizeof(Terroriststr), "~g~We have taken over the territory %s from ~b~Cops", eCaptureZone[zoneid][e_CAPTURE_ZONE_NAME]); for (new i, j = GetPlayerPoolSize(); i <= j; i++) { if (GetPlayerTeam(i) == TEAM_COPS) ShowCaptureText(i, 1, copstr, 10000); if (GetPlayerTeam(i) == TEAM_TERRORISTS) ShowCaptureText(i, 0, Terroriststr, 10000); } } eCaptureZone[zoneid][e_CAPTURE_ZONE_OWNER] = GetPlayerTeam(eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER]); eCaptureZone[zoneid][e_CAPTURE_ZONE_ATTACKER] = INVALID_PLAYER_ID; } } public OnPlayerLeaveDynamicCP(playerid, checkpointid) { for (new i; i < sizeof(eCaptureZone); i++) { if (eCaptureZone[i][e_CAPTURE_ZONE_CPID] == checkpointid) { if (eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] != INVALID_PLAYER_ID) { if (GetPlayerTeam(playerid) == GetPlayerTeam(eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER]) && iPlayerCaptureZone[playerid] == i) { iPlayerCaptureZone[playerid] = -1; eCaptureZone[i][e_CAPTURE_ZONE_PLAYERS]--; if (!eCaptureZone[i][e_CAPTURE_ZONE_PLAYERS]) { SendClientMessage(playerid, COLOR_TOMATO, "You failed to capture the zone, there were no teammates left in your checkpoint."); GangZoneStopFlashForAll(eCaptureZone[i][e_CAPTURE_ZONE_ID]); if (GetPlayerTeam(eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER]) == TEAM_COPS) { new copstr[150], Terroriststr[150]; format(copstr, sizeof(copstr), "~r~We failed to take over the territory %s from ~r~Terrorists", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); format(Terroriststr, sizeof(Terroriststr), "~b~Cops ~g~failed to take over our territory %s", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); for (new p, l = GetPlayerPoolSize(); p <= l; p++) { if (GetPlayerTeam(p) == TEAM_COPS) ShowCaptureText(p, 1, copstr, 10000); if (GetPlayerTeam(p) == TEAM_TERRORISTS) ShowCaptureText(p, 0, Terroriststr, 10000); } } else if (GetPlayerTeam(eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER]) == TEAM_TERRORISTS) { new copstr[150], Terroriststr[150]; format(copstr, sizeof(copstr), "~r~Terrorists ~g~failed to take over our territory %s", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); format(Terroriststr, sizeof(Terroriststr), "~r~We failed to take over the territory %s from ~b~Cops", eCaptureZone[i][e_CAPTURE_ZONE_NAME]); for (new p, l = GetPlayerPoolSize(); p <= l; p++) { if (GetPlayerTeam(p) == TEAM_COPS) ShowCaptureText(p, 0, copstr, 10000); if (GetPlayerTeam(p) == TEAM_TERRORISTS) ShowCaptureText(p, 1, Terroriststr, 10000); } } eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] = INVALID_PLAYER_ID; KillTimer(eCaptureZone[i][e_CAPTURE_ZONE_TIMER]); } else if (eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] == playerid) { for (new p, l = GetPlayerPoolSize(); p <= l; p++) { if (GetPlayerTeam(p) == GetPlayerTeam(playerid)) { if (IsPlayerInDynamicCP(p, checkpointid)) { eCaptureZone[i][e_CAPTURE_ZONE_ATTACKER] = p; break; } } } } } PlayerTextDrawHide(playerid, ptxtCapture[playerid]); HidePlayerProgressBar(playerid, pbarCapture[playerid]); break; } } } return 1; } public OnVehicleDeath(vehicleid) { for (new i, j = GetPlayerPoolSize(); i <= j; i++) { if (IsPlayerConnected(i)) { for (new x; x < sizeof(iPlayerVehicleid[]); x++) { if (IsValidVehicle(iPlayerVehicleid[i][x]) && iPlayerVehicleid[i][x] == vehicleid) { DestroyVehicle(iPlayerVehicleid[i][x]); break; } } } } return 1; } CMD:changepass(playerid, params[]) { if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); if (eUser[playerid][e_USER_SQLID] != 1) { SendClientMessage(playerid, COLOR_TOMATO, "Only registered users can use this command."); return 1; } Dialog_Show(playerid, CHANGE_PASSWORD, DIALOG_STYLE_PASSWORD, "Change account password...", COL_WHITE "Insert a new password for your account, Passwords are "COL_YELLOW"case sensitive"COL_WHITE".", "Confirm", "Cancel"); SendClientMessage(playerid, COLOR_WHITE, "Enter your new password."); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); return 1; } Dialog:CHANGE_PASSWORD(playerid, response, listitem, inputtext[]) { if (!response) return 1; if (!(dini_Int(DIRECTORY "config.ini", "min_password_length") <= strlen(inputtext) <= dini_Int(DIRECTORY "config.ini", "max_password_length"))) { Dialog_Show(playerid, CHANGE_PASSWORD, DIALOG_STYLE_PASSWORD, "Change account password...", COL_WHITE "Insert a new password for your account, Passwords are "COL_YELLOW"case sensitive"COL_WHITE".", "Confirm", "Cancel"); new string[150]; format(string, sizeof(string), "Invalid password length, must be between %i - %i characters.", dini_Int(DIRECTORY "config.ini", "min_password_length"), dini_Int(DIRECTORY "config.ini", "max_password_length")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } if (dini_Bool(DIRECTORY "config.ini", "toggle_secure_password")) { if (!IsPasswordSecure(inputtext)) { Dialog_Show(playerid, CHANGE_PASSWORD, DIALOG_STYLE_INPUT, "Change account password...", COL_WHITE "Insert a new password for your account, Passwords are "COL_YELLOW"case sensitive"COL_WHITE".", "Confirm", "Cancel"); SendClientMessage(playerid, COLOR_TOMATO, "Password must contain atleast a Highercase, a Lowercase and a Number."); return 1; } } SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_PASSWORD], 64); new string[256]; for (new i, j = strlen(inputtext); i < j; i++) { inputtext[i] = '*'; } format(string, sizeof(string), "Successfully changed your password. [P: %s]", inputtext); SendClientMessage(playerid, COLOR_GREEN, string); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); return 1; } CMD:changeques(playerid, params[]) { if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); if (eUser[playerid][e_USER_SQLID] != 1) { SendClientMessage(playerid, COLOR_TOMATO, "Only registered users can use this command."); return 1; } new line[MAX_SECURITY_QUESTION_SIZE], info[MAX_SECURITY_QUESTIONS * MAX_SECURITY_QUESTION_SIZE], File:h, count; h = fopen(DIRECTORY "questions.ini", io_read); while (fread(h, line)) { strcat(info, line); strcat(info, "\n"); if (++count >= MAX_SECURITY_QUESTIONS) break; } fclose(h); Dialog_Show(playerid, CHANGE_SEC_QUESTION, DIALOG_STYLE_LIST, "Change account security question... [Step: 1/2]", info, "Continue", "Cancel"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 1/2] Select a security question. This will help you retrieve your password in case you forget it any time soon!"); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); return 1; } Dialog:CHANGE_SEC_QUESTION(playerid, response, listitem, inputext[]) { if (!response) return 1; SetPVarString(playerid, "Question", inputext); new string[256]; format(string, sizeof(string), COL_YELLOW "%s\n"COL_WHITE"Insert your answer below in the box. (don't worry about CAPS, answers are NOT case sensitive).", inputext); Dialog_Show(playerid, CHANGE_SEC_ANSWER, DIALOG_STYLE_INPUT, "Change account security question... [Step: 2/2]", string, "Confirm", "Back"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 2/2] Write the answer to your secuirty question."); PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0); return 1; } Dialog:CHANGE_SEC_ANSWER(playerid, response, listitem, inputtext[]) { if (!response) { new line[MAX_SECURITY_QUESTION_SIZE], info[MAX_SECURITY_QUESTIONS * MAX_SECURITY_QUESTION_SIZE], File:h, count; h = fopen(DIRECTORY "questions.ini", io_read); while (fread(h, line)) { strcat(info, line); strcat(info, "\n"); if (++count >= MAX_SECURITY_QUESTIONS) break; } fclose(h); Dialog_Show(playerid, CHANGE_SEC_QUESTION, DIALOG_STYLE_LIST, "Change account security question... [Step: 1/2]", info, "Continue", "Cancel"); SendClientMessage(playerid, COLOR_WHITE, "[Step: 1/2] Select a security question. This will help you retrieve your password in case you forget it any time soon!"); return 1; } new string[512], question[MAX_SECURITY_QUESTION_SIZE]; GetPVarString(playerid, "Question", question, MAX_SECURITY_QUESTION_SIZE); if (strlen(inputtext) < dini_Int(DIRECTORY "config.ini", "min_password_length") || inputtext[0] == ' ') { format(string, sizeof(string), COL_YELLOW "%s\n"COL_WHITE"Insert your answer below in the box. (don't worry about CAPS, answers are NOT case sensitive).", question); Dialog_Show(playerid, CHANGE_SEC_ANSWER, DIALOG_STYLE_INPUT, "Change account security question... [Step: 2/2]", string, "Confirm", "Back"); format(string, sizeof(string), "Security answer cannot be an less than %i characters.", dini_Int(DIRECTORY "config.ini", "min_password_length")); SendClientMessage(playerid, COLOR_TOMATO, string); return 1; } format(eUser[playerid][e_USER_SECURITY_QUESTION], MAX_SECURITY_QUESTION_SIZE, question); DeletePVar(playerid, "Question"); for (new i, j = strlen(inputtext); i < j; i++) { inputtext[i] = tolower(inputtext[i]); } SHA256_PassHash(inputtext, eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_SECURITY_ANSWER], 64); format(string, sizeof(string), "Successfully changed your security answer and question [Q: %s].", eUser[playerid][e_USER_SECURITY_QUESTION]); SendClientMessage(playerid, COLOR_GREEN, string); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); return 1; } CMD:stats(playerid, params[]) { new targetid, bool:showtip; if (sscanf(params, "u", targetid)) { targetid = playerid; showtip = true; } if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_TOMATO, "The player is no more connected."); new name[MAX_PLAYER_NAME]; GetPlayerName(targetid, name, MAX_PLAYER_NAME); new string[256]; SendClientMessage(playerid, COLOR_GREEN, ""); format(string, sizeof(string), "%s[%i]'s stats: (AccountId: %i)", name, targetid, eUser[targetid][e_USER_SQLID]); SendClientMessage(playerid, COLOR_GREEN, string); new Float:ratio = ((eUser[targetid][e_USER_DEATHS] == 0) ? (0.0) : (floatdiv(eUser[targetid][e_USER_KILLS], eUser[targetid][e_USER_DEATHS]))); static levelname[6][25]; if (!levelname[0][0]) { levelname[0] = "Player"; levelname[1] = "Operator"; levelname[2] = "Moderator"; levelname[3] = "Administrator"; levelname[4] = "Manager"; levelname[5] = "Owner/RCON"; } format(string, sizeof(string), "Money: $%i || Kills: %i || Deaths: %i || Ratio: %0.2f || Admin Level: %i - %s || Vip Level: %i || Registered: %s ago || Last Seen: %s ago", GetPlayerMoney(targetid), eUser[targetid][e_USER_KILLS], eUser[targetid][e_USER_DEATHS], ratio, eUser[targetid][e_USER_ADMIN_LEVEL], levelname[((eUser[targetid][e_USER_ADMIN_LEVEL] > 5) ? (5) : (eUser[targetid][e_USER_ADMIN_LEVEL]))], eUser[targetid][e_USER_VIP_LEVEL], ReturnTimelapse(eUser[playerid][e_USER_REGISTER_TIMESTAMP], gettime()), ReturnTimelapse(eUser[playerid][e_USER_LASTLOGIN_TIMESTAMP], gettime())); SendClientMessage(playerid, COLOR_GREEN, string); if (showtip) SendClientMessage(playerid, COLOR_DEFAULT, "Tip: You can also view other players stats by /stats [player]"); return 1; } CMD:skills(playerid, params[]) { new targetid, bool:showtip; if (sscanf(params, "u", targetid)) { targetid = playerid; showtip = true; } if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_TOMATO, "The player is no more connected."); new name[MAX_PLAYER_NAME]; GetPlayerName(targetid, name, MAX_PLAYER_NAME); new string[150]; SendClientMessage(playerid, COLOR_GREEN, ""); format(string, sizeof(string), "%s[%i]'s skills:", name, targetid); SendClientMessage(playerid, COLOR_GREEN, string); format(string, sizeof(string), "9mm: %i/1000 || Silenced 9mm: %i/1000 || Desert Eagle: %i/1000 || Shotgun: %i/1000 || Sawnoff Shotgun: %i/1000 || Spas12 Shotgun: %i/1000", iPlayerSkills[targetid][WEAPONSKILL_PISTOL], iPlayerSkills[targetid][WEAPONSKILL_PISTOL_SILENCED], iPlayerSkills[targetid][WEAPONSKILL_DESERT_EAGLE], iPlayerSkills[targetid][WEAPONSKILL_SHOTGUN], iPlayerSkills[targetid][WEAPONSKILL_SAWNOFF_SHOTGUN], iPlayerSkills[targetid][WEAPONSKILL_SPAS12_SHOTGUN]); SendClientMessage(playerid, COLOR_GREEN, string); format(string, sizeof(string), "Micro-UZI: %i/1000 || MP5: %i/1000 || Ak47: %i/1000 || M4: %i/1000 || Sniper Rifle: %i/1000", iPlayerSkills[targetid][WEAPONSKILL_MICRO_UZI], iPlayerSkills[targetid][WEAPONSKILL_MP5], iPlayerSkills[targetid][WEAPONSKILL_AK47], iPlayerSkills[targetid][WEAPONSKILL_M4], iPlayerSkills[targetid][WEAPONSKILL_SNIPERRIFLE]); SendClientMessage(playerid, COLOR_GREEN, string); if (showtip) SendClientMessage(playerid, COLOR_DEFAULT, "Tip: You can also view other players skills by /skills [player]"); return 1; } public OnPlayerDeath(playerid, killerid, reason) { if (bPlayerGambleStarted[playerid]) { bPlayerGambleStarted[playerid] = false; PlayerTextDrawHide(playerid, ptxtGamble[playerid][0]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][1]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][2]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][3]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][4]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][5]); } if (iPlayerProtection[playerid][0] > 0) { DestroyDynamic3DTextLabel(iPlayerProtection3DText[playerid]); KillTimer(iPlayerProtection[playerid][1]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][0]); PlayerTextDrawHide(playerid, ptxtProtection[playerid][1]); } if (iPlayerHeadshotData[playerid][0] != INVALID_PLAYER_ID) { killerid = iPlayerHeadshotData[playerid][0]; reason = iPlayerHeadshotData[playerid][1]; } if (iPlayerCaptureZone[playerid] != -1) { OnPlayerLeaveDynamicCP(playerid, eCaptureZone[iPlayerCaptureZone[playerid]][e_CAPTURE_ZONE_CPID]); iPlayerCaptureZone[playerid] = -1; } eUser[playerid][e_USER_DEATHS]++; SetPlayerScore(playerid, floatround((eUser[playerid][e_USER_DEATHS] == 0) ? (0.0) : (floatdiv(eUser[playerid][e_USER_KILLS], eUser[playerid][e_USER_DEATHS])))); new const Float:DIF[] = { 1.2, 1.3, 1.5, 1.7, 2.0, 2.1, 2.4, 2.5, 2.7, 3.0 }; new weapon, ammo, Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for (new i; i < 13; i++) { GetPlayerWeaponData(playerid, i, weapon, ammo); switch (weapon) { case 1..37: { if (weapon != 0 && ammo != 0) StaticPickup_Create((x + DIF[random(sizeof(DIF))]), (y + DIF[random(sizeof(DIF))]), z, GetWeaponModelID(weapon), Float:ammo, GetPlayerVirtualWorld(playerid), (2 * 60 * 1000)); } } } if (killerid != INVALID_PLAYER_ID) { ShowDeathText(playerid, killerid, 7000, ((iPlayerHeadshotData[playerid][0] == INVALID_PLAYER_ID) ? (false) : (true))); new money, string[150]; if (GetPlayerMoney(playerid) > 500) { new const Float:MONEYDIF[] = { 1.7, 1.9, 2.0, 2.3, 2.5, 2.7, 3.0 }; money = floatround(float(GetPlayerMoney(playerid)) / MONEYDIF[random(sizeof(MONEYDIF))]); StaticPickup_Create((x + DIF[random(sizeof(DIF))]), (y + DIF[random(sizeof(DIF))]), z, (money < 10000) ? (1212) : (1550), Float:money, GetPlayerVirtualWorld(playerid), (10 * 60 * 1000)); GivePlayerMoney(playerid, -money); format(string, sizeof(string), "You lost $%i for dying!You maybe lucky if someone didn't picked your money yet!", money); SendClientMessage(playerid, COLOR_TOMATO, string); } switch (random(10)) { case 0: StaticPickup_Create((x + DIF[random(sizeof(DIF))]), (y + DIF[random(sizeof(DIF))]), z, 1212, 50.0, GetPlayerVirtualWorld(playerid), (1 * 60 * 1000)); case 1: StaticPickup_Create((x + DIF[random(sizeof(DIF))]), (y + DIF[random(sizeof(DIF))]), z, 1240, 50.0, GetPlayerVirtualWorld(playerid), (1 * 60 * 1000)); } eUser[killerid][e_USER_KILLS]++; SetPlayerScore(killerid, floatround((eUser[killerid][e_USER_DEATHS] == 0) ? (0.0) : (floatdiv(eUser[killerid][e_USER_KILLS], eUser[killerid][e_USER_DEATHS])))); money = (random(700 - 500) + 500); GivePlayerMoney(killerid, money); new name[MAX_PLAYER_NAME], weapon_name[35]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); switch (reason) { case 22: { if (iPlayerSkills[killerid][WEAPONSKILL_PISTOL] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_PISTOL] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_PISTOL, iPlayerSkills[killerid][WEAPONSKILL_PISTOL]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_PISTOL]); SendClientMessage(killerid, COLOR_GREEN, string); } case 23: { if (iPlayerSkills[killerid][WEAPONSKILL_PISTOL_SILENCED] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_PISTOL_SILENCED] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_PISTOL_SILENCED, iPlayerSkills[killerid][WEAPONSKILL_PISTOL_SILENCED]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_PISTOL_SILENCED]); SendClientMessage(killerid, COLOR_GREEN, string); } case 24: { if (iPlayerSkills[killerid][WEAPONSKILL_DESERT_EAGLE] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_DESERT_EAGLE] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_DESERT_EAGLE, iPlayerSkills[killerid][WEAPONSKILL_DESERT_EAGLE]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_DESERT_EAGLE]); SendClientMessage(killerid, COLOR_GREEN, string); } case 25: { if (iPlayerSkills[killerid][WEAPONSKILL_SHOTGUN] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_SHOTGUN] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_SHOTGUN, iPlayerSkills[killerid][WEAPONSKILL_SHOTGUN]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_SHOTGUN]); SendClientMessage(killerid, COLOR_GREEN, string); } case 26: { if (iPlayerSkills[killerid][WEAPONSKILL_SAWNOFF_SHOTGUN] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_SAWNOFF_SHOTGUN] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_SAWNOFF_SHOTGUN, iPlayerSkills[killerid][WEAPONSKILL_SAWNOFF_SHOTGUN]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_SAWNOFF_SHOTGUN]); SendClientMessage(playerid, COLOR_GREEN, string); } case 27: { if (iPlayerSkills[killerid][WEAPONSKILL_SPAS12_SHOTGUN] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_SPAS12_SHOTGUN] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_SPAS12_SHOTGUN, iPlayerSkills[killerid][WEAPONSKILL_SPAS12_SHOTGUN]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_SPAS12_SHOTGUN]); SendClientMessage(killerid, COLOR_GREEN, string); } case 28, 32: { if (iPlayerSkills[killerid][WEAPONSKILL_MICRO_UZI] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_MICRO_UZI] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_MICRO_UZI, iPlayerSkills[killerid][WEAPONSKILL_MICRO_UZI]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_MICRO_UZI]); SendClientMessage(killerid, COLOR_GREEN, string); } case 29: { if (iPlayerSkills[killerid][WEAPONSKILL_MP5] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_MP5] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_MP5, iPlayerSkills[killerid][WEAPONSKILL_MP5]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_MP5]); SendClientMessage(killerid, COLOR_GREEN, string); } case 30: { if (iPlayerSkills[killerid][WEAPONSKILL_AK47] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_AK47] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_AK47, iPlayerSkills[killerid][WEAPONSKILL_AK47]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_AK47]); SendClientMessage(killerid, COLOR_GREEN, string); } case 31: { if (iPlayerSkills[killerid][WEAPONSKILL_M4] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_M4] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_M4, iPlayerSkills[killerid][WEAPONSKILL_M4]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_M4]); SendClientMessage(killerid, COLOR_GREEN, string); } case 34: { if (iPlayerSkills[killerid][WEAPONSKILL_SNIPERRIFLE] != 1000) { iPlayerSkills[killerid][WEAPONSKILL_SNIPERRIFLE] += 50; SetPlayerSkillLevel(killerid, WEAPONSKILL_SNIPERRIFLE, iPlayerSkills[killerid][WEAPONSKILL_SNIPERRIFLE]); } GetWeaponName(reason, weapon_name, sizeof(weapon_name)); format(string, sizeof(string), "Good job! You killed %s[%i] and gained $%i. Your weapon skill for %s is now %i/1000.", name, playerid, money, weapon_name, iPlayerSkills[killerid][WEAPONSKILL_SNIPERRIFLE]); SendClientMessage(killerid, COLOR_GREEN, string); } } iPlayerSpree[killerid]++; GetPlayerName(killerid, name, MAX_PLAYER_NAME); string[0] = EOS; switch (iPlayerSpree[killerid]) { case 5: format(string, sizeof(string), "%s[%i] is on a killing spree of 5 kills!", name, killerid); case 10: format(string, sizeof(string), "%s[%i] is on insane killing spree 10 kills!", name, killerid); case 15: format(string, sizeof(string), "%s[%i] is godlike with a killing spree 15 kills!", name, killerid); case 20: format(string, sizeof(string), "%s[%i] is godlike with a killing spree 20 kills!", name, killerid); case 25: format(string, sizeof(string), "%s[%i] is PRO with a killing spree 25 kills!", name, killerid); case 30: format(string, sizeof(string), "%s[%i] is incredible with a killing spree 30 kills!", name, killerid); case 35: format(string, sizeof(string), "%s[%i] is wicked sick with a killing spree 35 kills!", name, killerid); case 40: format(string, sizeof(string), "%s[%i] is damn good with a killing spree 40 kills!", name, killerid); case 50: format(string, sizeof(string), "%s[%i] is god with a killing spree 50 kills!", name, killerid); default: { if (iPlayerSpree[killerid] > 50) { if ((iPlayerSpree[killerid] % 5) == 0) { format(string, sizeof(string), "%s[%i] is hacking! He/She's a killing spree %i kills!", name, killerid, iPlayerSpree[killerid]); } } } } if (string[0]) SendClientMessageToAll(COLOR_DEFAULT, string); } iPlayerSpree[playerid] = 0; iPlayerHeadshotData[playerid][0] = INVALID_PLAYER_ID; return 1; } CMD:kill(playerid) { if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); SetPlayerHealth(playerid, 0.0); return 1; } CMD:shop(playerid) { if (!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are not spawned or under spawn protection."); if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are in a vehicle."); if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); Dialog_Show(playerid, SHOP, DIALOG_STYLE_LIST, "Select a shop type you want to open...", "Weapons shop\nVehicles shop", "Open", "Cancel"); return 1; } Dialog:SHOP(playerid, response, listitem, inputtext[]) { if (!response) return 1; if (listitem == 0) { SendClientMessage(playerid, COLOR_DEFAULT, "Tip: You can also open this shop directly by /weapons."); cmd_weapons(playerid); } else if (listitem == 1) { SendClientMessage(playerid, COLOR_DEFAULT, "Tip: You can also open this shop directly by /vehicles."); cmd_vehicles(playerid); } return 1; } CMD:vehicles(playerid) { if (!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are not spawned or under spawn protection."); if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are in a vehicle."); if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); new string[sizeof(VEHICLE_SHOP) * 50]; for (new i; i < sizeof(VEHICLE_SHOP); i++) format(string, sizeof(string), "%s%i\t%s~n~~r~-$%i\n", string, VEHICLE_SHOP[i][e_VEHICLE_SHOP_MODEL], VEHICLE_SHOP[i][e_VEHICLE_SHOP_NAME], VEHICLE_SHOP[i][e_VEHICLE_SHOP_PRICE]); for (new i; i < sizeof(VEHICLE_SHOP); i++) Dialog_SetModelRot(playerid, i, 0.0, 0.0, -50.0, 1.0); Dialog_Show(playerid, VEHICLES, DIALOG_STYLE_PREVMODEL, "Select a vehicle you want to buy:", string, "Buy", "Cancel"); return 1; } Dialog:VEHICLES(playerid, response, listitem, inputtext[]) { if (!response) return 1; new string[150]; if (GetPlayerMoney(playerid) < VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_PRICE]) { format(string, sizeof(string), "You need atleast $%i to buy a %s.", VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_PRICE], VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_NAME]); return SendClientMessage(playerid, COLOR_TOMATO, string); } new Float:x, Float:y, Float:z, Float:ang; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, ang); x += (5.0 * floatsin(-ang, degrees)); y += (5.0 * floatcos(-ang, degrees)); new idx = -1; for (new i; i < sizeof(iPlayerVehicleid[]); i++) { if (!IsValidVehicle(iPlayerVehicleid[playerid][i])) { idx = i; break; } } if (idx == -1) { SetTimerEx("OnVehicleTimeout", (30 * 1000), false, "i", iPlayerVehicleid[playerid][0]); idx = 0; } iPlayerVehicleid[playerid][idx] = AddStaticVehicle(VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_MODEL], x, y, z, ang, random(10), random(10)); GivePlayerMoney(playerid, -VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_PRICE]); format(string, sizeof(string), "You have bought a %s for $%i.", VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_NAME], VEHICLE_SHOP[listitem][e_VEHICLE_SHOP_PRICE]); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } forward OnVehicleTimeout(vehicleid); public OnVehicleTimeout(vehicleid) { DestroyVehicle(vehicleid); } CMD:weapons(playerid) { if (!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are not spawned or under spawn protection."); if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are in a vehicle."); if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); new string[sizeof(WEAPON_SHOP) * 50]; for (new i; i < sizeof(WEAPON_SHOP); i++) format(string, sizeof(string), "%s%i\t%s~n~~r~-$%i\n", string, WEAPON_SHOP[i][e_WEAPON_SHOP_MODEL], WEAPON_SHOP[i][e_WEAPON_SHOP_NAME], WEAPON_SHOP[i][e_WEAPON_SHOP_PRICE]); Dialog_Show(playerid, WEAPONS, DIALOG_STYLE_PREVMODEL, "Select a weapon you want to buy:", string, "Buy", "Cancel"); for (new i; i < sizeof(WEAPON_SHOP); i++) Dialog_SetModelRot(playerid, i, 0.0, 0.0, -50.0, 1.5); return 1; } Dialog:WEAPONS(playerid, response, listitem, inputtext[]) { if (!response) return 1; new string[150]; if (GetPlayerMoney(playerid) < WEAPON_SHOP[listitem][e_WEAPON_SHOP_PRICE]) { format(string, sizeof(string), "You need atleast $%i to buy a %s.", WEAPON_SHOP[listitem][e_WEAPON_SHOP_PRICE], WEAPON_SHOP[listitem][e_WEAPON_SHOP_NAME]); return SendClientMessage(playerid, COLOR_TOMATO, string); } GivePlayerWeapon(playerid, GetModelWeaponID(WEAPON_SHOP[listitem][e_WEAPON_SHOP_MODEL]), WEAPON_SHOP[listitem][e_WEAPON_SHOP_AMMO]); GivePlayerMoney(playerid, -WEAPON_SHOP[listitem][e_WEAPON_SHOP_PRICE]); format(string, sizeof(string), "You have bought a %s with %i ammo for $%i.", WEAPON_SHOP[listitem][e_WEAPON_SHOP_NAME], WEAPON_SHOP[listitem][e_WEAPON_SHOP_AMMO], WEAPON_SHOP[listitem][e_WEAPON_SHOP_PRICE]); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } CMD:helmet(playerid) { if (!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are not spawned or under spawn protection."); if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are in a vehicle."); if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); if (bPlayerHelmet[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You already have a protection helmet and wearing it!"); new string[sizeof(HELMETS) * 7]; for (new i; i < sizeof(HELMETS); i++) format(string, sizeof(string), "%s%i\n", string, HELMETS[i]); Dialog_Show(playerid, HELMET, DIALOG_STYLE_PREVMODEL, "Select a helmet you would like to wear!", string, "-$3150", "Cacnel"); for (new i; i < sizeof(HELMETS); i++) Dialog_SetModelRot(playerid, i, 0.0, 0.0, -50.0, 1.0); return 1; } Dialog:HELMET(playerid, response, listitem, inputext[]) { if (!response) return 1; if (GetPlayerMoney(playerid) < 3150) return SendClientMessage(playerid, COLOR_TOMATO, "You need atleast $3150 to buy a protection helmet."); GivePlayerMoney(playerid, -3150); SendClientMessage(playerid, COLOR_GREEN, "You have bought a protection helmet for $3150. You should no longer worry about headshots fam!"); SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1, HELMETS[listitem], 2, 0.173000, 0.024999, -0.003000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000); //skin 102 bPlayerHelmet[playerid] = true; PlayerTextDrawSetString(playerid, ptxtHelmet[playerid], "/Helmet: ~g~ON"); return 1; } CMD:offradar(playerid) { if (!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use this command when you are not spawned or under spawn protection."); if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); if (iPlayerOffRadar[playerid][0] > 0) return SendClientMessage(playerid, COLOR_TOMATO, "You already off the radar till this time!"); Dialog_Show(playerid, OFF_RADAR, DIALOG_STYLE_MSGBOX, "Go Off-Radar?", COL_WHITE "Would you like to go off the radar(inivisible on map) for 2 minutes at cost "COL_TOMATO"$3999"COL_WHITE"?", "-$3999", "Cacnel"); return 1; } Dialog:OFF_RADAR(playerid, response, listitem, inputext[]) { if (!response) return 1; if (GetPlayerMoney(playerid) < 3999) return SendClientMessage(playerid, COLOR_TOMATO, "You need atleast $3999 to go off-radar."); GivePlayerMoney(playerid, -3999); SendClientMessage(playerid, COLOR_GREEN, "You are now off the radar, no one can see you on minimap for 2 minutes from now. (money deducted: -$3999)"); GameTextForPlayer(playerid, "~w~You are now Off-Radar!", 3000, 3); SetPlayerColor(playerid, SET_ALPHA(((GetPlayerTeam(playerid) == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 0)); iPlayerOffRadar[playerid][0] = (2 * 60); iPlayerOffRadar[playerid][1] = SetTimerEx("OnPlayerOffRadarUpdate", 1000, true, "i", playerid); PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][0], "/Offradar: ~g~ON"); PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][1], "You will be visible back in ~g~1m 59s"); return 1; } forward OnPlayerOffRadarUpdate(playerid); public OnPlayerOffRadarUpdate(playerid) { if (iPlayerOffRadar[playerid][0] == 0) { GameTextForPlayer(playerid, "~w~You are now On-Radar!", 3000, 3); SetPlayerColor(playerid, SET_ALPHA(((GetPlayerTeam(playerid) == TEAM_COPS) ? (TEAM_COLOR_COPS) : (TEAM_COLOR_TERRORISTS)), 255)); KillTimer(iPlayerOffRadar[playerid][1]); iPlayerOffRadar[playerid][1] = -1; PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][0], "/Offradar: ~r~OFF"); PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][1], "Invisibility on map for 2 minutes"); return; } iPlayerOffRadar[playerid][0]--; new string[64]; format(string, sizeof(string), "You will be visible back in ~g~%im %02is", (iPlayerOffRadar[playerid][0] / 60), (iPlayerOffRadar[playerid][0] % 60)); PlayerTextDrawSetString(playerid, ptxtOffRadar[playerid][1], string); } CMD:cmds(playerid, params[]) { if (bPlayerGambleStarted[playerid]) return SendClientMessage(playerid, COLOR_TOMATO, "You cannot use commands while gambling."); if (!strcmp(params, "hide", true)) { ShowNotification(playerid, "", 0); return 1; } new string[1024] = "~y~/kill ~w~- commit sucide~n~\ ~y~/shop ~w~- open shop dialog~n~\ ~y~/weapons ~w~- open weapons shop dialog~n~\ ~y~/vehicles ~w~- open vehicles shop dialog~n~\ ~y~/helmet ~w~- buy a headshot protection helmet~n~\ ~y~/offradar ~w~- go invisible on radar/map for 2 minutes~n~"; strcat(string, "~y~/gamble ~w~- make some money through betting~n~\ ~y~/stats ~w~- player statistics~n~\ ~y~/skills ~w~- player skills statistics~n~\ ~y~/changeques ~w~- change your security question & answer~n~\ ~y~/changepass ~w~- change your account password~n~~n~\ Type \"/cmds hide\" to hide this box."); ShowNotification(playerid, string, 0); return 1; } CMD:gamble(playerid, params[]) { if (!bPlayerGambleStarted[playerid]) { ShowNotification(playerid, "~w~Welcome to mini-gambling arena!~n~~n~You can win alot of money at different stages but loose as well, all depends on luck!~n~~n~To start gambling, place a bet by typing ~y~/gamble [bet]~w~.~n~~n~To cancel, type \"/gamble exit\".", 0); bPlayerGambleStarted[playerid] = true; iPlayerGambleBet[playerid] = 0; return 1; } if (!strcmp(params, "exit", true)) { ShowNotification(playerid, "Gambling has been closed.", 3000); bPlayerGambleStarted[playerid] = false; PlayerTextDrawHide(playerid, ptxtGamble[playerid][0]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][1]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][2]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][3]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][4]); PlayerTextDrawHide(playerid, ptxtGamble[playerid][5]); return 1; } if (iPlayerGambleBet[playerid] < 10) { if (!sscanf(params, "i", iPlayerGambleBet[playerid])) { if (iPlayerGambleBet[playerid] < 10) { SendClientMessage(playerid, COLOR_TOMATO, "Minimum bet for gambling is $10."); return 1; } else if (iPlayerGambleBet[playerid] > 1000) { SendClientMessage(playerid, COLOR_TOMATO, "Maximum bet for gambling is $1000."); return 1; } else if (GetPlayerMoney(playerid) < iPlayerGambleBet[playerid]) { SendClientMessage(playerid, COLOR_TOMATO, "You don't have that much money with you to bet."); return 1; } } else return 1; } if (random(2) == 0) { iPlayerGambleRightCard[playerid] = random(3); new r = random(2); if (iPlayerGambleRightCard[playerid] == 0) { format(sPlayerGambleCards[playerid][0], sizeof(sPlayerGambleCards[][]), RED_CARD); format(sPlayerGambleCards[playerid][1], sizeof(sPlayerGambleCards[][]), ((r == 0) ? (BLACK_CARD) : (OTHER_CARD))); format(sPlayerGambleCards[playerid][2], sizeof(sPlayerGambleCards[][]), ((r == 1) ? (BLACK_CARD) : (OTHER_CARD))); } else if (iPlayerGambleRightCard[playerid] == 1) { format(sPlayerGambleCards[playerid][1], sizeof(sPlayerGambleCards[][]), RED_CARD); format(sPlayerGambleCards[playerid][2], sizeof(sPlayerGambleCards[][]), ((r == 0) ? (BLACK_CARD) : (OTHER_CARD))); format(sPlayerGambleCards[playerid][0], sizeof(sPlayerGambleCards[][]), ((r == 1) ? (BLACK_CARD) : (OTHER_CARD))); } else if (iPlayerGambleRightCard[playerid] == 2) { format(sPlayerGambleCards[playerid][2], sizeof(sPlayerGambleCards[][]), RED_CARD); format(sPlayerGambleCards[playerid][0], sizeof(sPlayerGambleCards[][]), ((r == 0) ? (BLACK_CARD) : (OTHER_CARD))); format(sPlayerGambleCards[playerid][1], sizeof(sPlayerGambleCards[][]), ((r == 1) ? (BLACK_CARD) : (OTHER_CARD))); } new string[512]; format(string, sizeof(string), "~w~The game is simple and easy, you have to choose which card is of color \"RED\". Click on the card you want to choose.~n~~n~Bet Money: ~y~$%i~n~~n~~w~If you ~g~Won~w~, you'll get 2x of your bet money.~n~If you ~r~Loose~w~, all your money will be gone!", iPlayerGambleBet[playerid]); ShowNotification(playerid, string, 0); } else { iPlayerGambleRightCard[playerid] = random(3); new r = random(2); if (iPlayerGambleRightCard[playerid] == 0) { format(sPlayerGambleCards[playerid][0], sizeof(sPlayerGambleCards[][]), BLACK_CARD); format(sPlayerGambleCards[playerid][1], sizeof(sPlayerGambleCards[][]), ((r == 0) ? (RED_CARD) : (OTHER_CARD))); format(sPlayerGambleCards[playerid][2], sizeof(sPlayerGambleCards[][]), ((r == 1) ? (RED_CARD) : (OTHER_CARD))); } else if (iPlayerGambleRightCard[playerid] == 1) { format(sPlayerGambleCards[playerid][1], sizeof(sPlayerGambleCards[][]), BLACK_CARD); format(sPlayerGambleCards[playerid][2], sizeof(sPlayerGambleCards[][]), ((r == 0) ? (RED_CARD) : (OTHER_CARD))); format(sPlayerGambleCards[playerid][0], sizeof(sPlayerGambleCards[][]), ((r == 1) ? (RED_CARD) : (OTHER_CARD))); } else if (iPlayerGambleRightCard[playerid] == 2) { format(sPlayerGambleCards[playerid][2], sizeof(sPlayerGambleCards[][]), BLACK_CARD); format(sPlayerGambleCards[playerid][0], sizeof(sPlayerGambleCards[][]), ((r == 0) ? (RED_CARD) : (OTHER_CARD))); format(sPlayerGambleCards[playerid][1], sizeof(sPlayerGambleCards[][]), ((r == 1) ? (RED_CARD) : (OTHER_CARD))); } new string[512]; format(string, sizeof(string), "~w~The game is simple and easy, you have to choose which card is of color \"BLACK\". Click on the card you want to choose.~n~~n~Bet Money: ~y~$%i~n~~n~~w~If you ~g~Won~w~, you'll get 2x of your bet money.~n~If you ~r~Loose~w~, all your money will be gone!", iPlayerGambleBet[playerid]); ShowNotification(playerid, string, 0); } PlayerTextDrawColor(playerid, ptxtGamble[playerid][0], 0x000000FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][0]); PlayerTextDrawSetString(playerid, ptxtGamble[playerid][1], CARD); PlayerTextDrawShow(playerid, ptxtGamble[playerid][1]); PlayerTextDrawColor(playerid, ptxtGamble[playerid][2], 0x000000FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][2]); PlayerTextDrawSetString(playerid, ptxtGamble[playerid][3], CARD); PlayerTextDrawShow(playerid, ptxtGamble[playerid][3]); PlayerTextDrawColor(playerid, ptxtGamble[playerid][4], 0x000000FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][4]); PlayerTextDrawSetString(playerid, ptxtGamble[playerid][5], CARD); PlayerTextDrawShow(playerid, ptxtGamble[playerid][5]); SelectTextDraw(playerid, 0xFF0000BB); return 1; } public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) { if (bPlayerGambleStarted[playerid]) { new card; if (playertextid == ptxtGamble[playerid][1]) { card = 0; PlayerTextDrawColor(playerid, ptxtGamble[playerid][0], 0xFF0000FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][0]); } else if (playertextid == ptxtGamble[playerid][3]) { card = 1; PlayerTextDrawColor(playerid, ptxtGamble[playerid][2], 0xFF0000FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][2]); } else if (playertextid == ptxtGamble[playerid][5]) { card = 2; PlayerTextDrawColor(playerid, ptxtGamble[playerid][4], 0xFF0000FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][4]); } else return 1; if (iPlayerGambleRightCard[playerid] == 0) { PlayerTextDrawColor(playerid, ptxtGamble[playerid][0], 0x00FF00FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][0]); } else if (iPlayerGambleRightCard[playerid] == 1) { PlayerTextDrawColor(playerid, ptxtGamble[playerid][2], 0x00FF00FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][2]); } else { PlayerTextDrawColor(playerid, ptxtGamble[playerid][4], 0x00FF00FF); PlayerTextDrawShow(playerid, ptxtGamble[playerid][4]); } if (card == iPlayerGambleRightCard[playerid]) { GivePlayerMoney(playerid, (iPlayerGambleBet[playerid] * 2)); new string[150]; format(string, sizeof(string), "~w~Great job! You won ~g~$%i ~w~(your bet was ~g~$%i~w~).~n~~n~Type \"/gamble exit\" to quit playing or \"/gamble [bet]\" to play again!", (iPlayerGambleBet[playerid] * 2), iPlayerGambleBet[playerid]); ShowNotification(playerid, string, 0); } else { GivePlayerMoney(playerid, -iPlayerGambleBet[playerid]); new string[150]; format(string, sizeof(string), "Sorry! You lost this time (money lost: ~r~$%i~w~).~n~~n~Type \"/gamble exit\" to quit playing or \"/gamble [bet]\" to play again!", iPlayerGambleBet[playerid]); ShowNotification(playerid, string, 0); } iPlayerGambleBet[playerid] = 0; PlayerTextDrawSetString(playerid, ptxtGamble[playerid][1], sPlayerGambleCards[playerid][0]); PlayerTextDrawShow(playerid, ptxtGamble[playerid][1]); PlayerTextDrawSetString(playerid, ptxtGamble[playerid][3], sPlayerGambleCards[playerid][1]); PlayerTextDrawShow(playerid, ptxtGamble[playerid][3]); PlayerTextDrawSetString(playerid, ptxtGamble[playerid][5], sPlayerGambleCards[playerid][2]); PlayerTextDrawShow(playerid, ptxtGamble[playerid][5]); CancelSelectTextDraw(playerid); } return 1; } public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if (!success) { SendClientMessage(playerid, COLOR_TOMATO, "Command not found! Type /cmds for list!"); } return 1; }
PAWN
5
nathanramli/SA-MP
gamemodes/CopsAndTerrorists.pwn
[ "Apache-2.0" ]
c cdotusub.f c c The program is a fortran wrapper for cdotu. c Witten by Keita Teranishi. 2/11/1998 c subroutine cdotusub(n,x,incx,y,incy,dotu) c external cdotu complex cdotu,dotu integer n,incx,incy complex x(*),y(*) c dotu=cdotu(n,x,incx,y,incy) return end
FORTRAN
3
dnoan/OpenBLAS
lapack-netlib/CBLAS/src/cdotusub.f
[ "BSD-3-Clause" ]
test: [ -z "`gofmt -s -w -l -e .`" ] go vet ginkgo -p -r --randomizeAllSpecs --failOnPending --randomizeSuites --race .PHONY: test
Makefile
3
pkoushik/ARO-RP
vendor/github.com/onsi/gomega/Makefile
[ "Apache-2.0" ]
t=:b b=:a%:b a=t t=b b=a%b a=t t=b b=a%b a=t t=b b=a%b a=t t=b b=a%b a=t t=b b=a%b a=t t=b b=a%b a=t t=b b=a%b a=t goto2+(b<1) :o=a<2goto:done++ t=b b=a%b a=t a(0) b(0) b(1) = a(0) % b(0) a(1) = b(0) b(2) = b(0) % b(1) a(2) = b(1) a b c=a%b d=b%c a=c b=d if a>b then a%=b else b%=a end c=a>b a+=(a%b-a)*c b+=(b%a-b)*c /--------//--------//--------//--------//--------//--------//--------/ public static int GetGCDByModulus(int value1, int value2) { while (value1 != 0 && value2 != 0) { if (value1 > value2) value1 %= value2; else value2 %= value1; } return Math.Max(value1, value2); } public static bool Coprime(int value1, int value2) { return GetGCDByModulus(value1, value2) == 1; } while b ≠ 0 t := b b := a mod b a := t return a t=b b=a%b a=t
LOLCODE
3
Dude112113/Yolol
YololEmulator/Scripts/coprimes.lol
[ "MIT" ]
;----------------- Include Algorithms Library -------------------------------- __includes [ "A-star.nls" "LayoutSpace.nls"] ;--------------- Customizable Reports ------------------- ; These reports must be customized in order to solve different problems using the ; same A* function. ; Rules are represented by using pairs [ "representation" cost f] ; in such a way that f allows to transform states (it is the transition function), ; cost is the cost of applying the transition on a state, ; and "representation" is a string to identify the rule. We will use tasks in ; order to store the transition functions. to-report applicable-transitions report (list (list "*3" 1 ([ x -> x * 3 ])) (list "+7" 1 ([ x -> x + 7 ])) (list "-2" 1 ([ x -> x - 2 ])) ) end ; valid? is a boolean report to say which states are valid to-report valid? [x] report (x > 0) end ; children-states is a state report that returns the children for the current state. ; It will return a list of pairs [ns tran], where ns is the content of the children-state, ; and tran is the applicable transition to get it. ; It maps the applicable transitions on the current content, and then filters those ; states that are valid. to-report AI:children-states report filter [ s -> valid? (first s) ] (map [ t -> (list (run-result (last t) content) t) ] applicable-transitions) end ; final-state? is a state report that identifies the final states for the problem. ; It usually will be a property on the content of the state (for example, if it is ; equal to the Final State). It allows the use of parameters because maybe the ; verification of reaching the goal depends on some extra information from the problem. to-report AI:final-state? [params] report ( content = params) end ; Searcher report to compute the heuristic for this searcher to-report AI:heuristic [#Goal] let d abs (([content] of current-state) - #Goal) report ifelse-value (d > 1) [log d 3][d] end to-report AI:equal? [a b] report a = b end ;------------------------------------------------------------------------------------------ ; Auxiliary procedure the highlight the path when it is found. It makes use of reduce procedure with ; highlight report to highlight-path [path] foreach path [ t -> ask t [ set color red set thickness .4 ] ] end ; Auxiliary procedure to test the A* algorithm between two random states of the network to test ca ; We compute the path with A* no-display let path (A* Initial Final True True) layout-radial AI:states AI:transitions AI:state 0 style display ; if any, we highlight it if path != false [ ;repeat 1000 [layout-spring states links 1 3 .3] highlight-path path show map [ t -> first [rule] of t ] path ] print (word (max [who] of turtles - count AI:states) " searchers used") print (word (count AI:states) " states created") end @#$#@#$#@ GRAPHICS-WINDOW 210 10 647 448 -1 -1 13.0 1 10 1 1 1 0 0 0 1 -16 16 -16 16 0 0 1 ticks 30.0 BUTTON 131 76 194 109 NIL test NIL 1 T OBSERVER NIL NIL NIL NIL 1 SLIDER 28 10 200 43 Initial Initial 0 100 2.0 1 1 NIL HORIZONTAL SLIDER 28 44 200 77 Final Final 0 100 91.0 1 1 NIL HORIZONTAL @#$#@#$#@ @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 circle false 0 Circle -7500403 true true 0 0 300 @#$#@#$#@ NetLogo 6.1.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@
NetLogo
5
fsancho/IA
03. Informed Search/A-star Problem Solver - Numerical Puzzle.nlogo
[ "MIT" ]
17379 131.829 16693 129.201 16116 126.949 15713 125.352 11895 109.064 10409 102.025 10252 101.252 9853 99.2623 9748 98.732 9492 97.4269 9190 95.8645 8912 94.4034 8895 94.3133 8491 92.1466 8372 91.4986 8252 90.8405 7450 86.3134 7360 85.7904 7273 85.2819 7080 84.1427 7063 84.0417 6567 81.037 6462 80.3866 6291 79.3158 6211 78.8099 5671 75.306 5373 73.3008 5220 72.2496 5167 71.8818 5007 70.7602 3963 62.9524 3895 62.4099 3796 61.6117 3481 59 3200 56.5685 2845 53.3385 2774 52.6688 2641 51.3907 2566 50.6557 2511 50.1099 2479 49.7896 2127 46.1194 1989 44.5982 1989 44.5982 1933 43.9659 1801 42.4382 1590 39.8748 1385 37.2156 1370 37.0135 1316 36.2767 1205 34.7131 1194 34.5543 1153 33.9559 1150 33.9116 1031 32.1092 1018 31.9061 950 30.8221 931 30.5123 898 29.9666 865 29.4109 822 28.6705 803 28.3373 700 26.4575 624 24.98 559 23.6432 541 23.2594 523 22.8692 495 22.2486 456 21.3542 414 20.347 386 19.6469 375 19.3649 348 18.6548 344 18.5472 327 18.0831 288 16.9706 272 16.4924 263 16.2173 253 15.906 251 15.843 248 15.748 224 14.9666 222 14.8997 213 14.5945 201 14.1774 184 13.5647 176 13.2665 166 12.8841 163 12.7671 144 12 143 11.9583 123 11.0905 116 10.7703 95 9.74679 80 8.94427 79 8.88819 79 8.88819 64 8 62 7.87401 56 7.48331 54 7.34847 47 6.85565 45 6.7082 45 6.7082 44 6.63325 43 6.55744 43 6.55744 37 6.08276 32 5.65685 31 5.56776 29 5.38516 25 5 22 4.69042 15 3.87298 10 3.16228 10 3.16228 6 2.44949 6 2.44949 5 2.23607 4 2 4 2 4 2 3 1.73205 3 1.73205 3 1.73205 3 1.73205 2 1.41421 2 1.41421 2 1.41421 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1root:EMpNB8Zp56:0:0:Super-User,,,,,,,:/:/bin/sh 1 2roottcsh:*:0:0:Super-User 1.41421 3sysadm:*:0:0:System 1.73205 4diag:*:0:996:Hardware 2 5daemon:*:1:1:daemons:/:/bin/sh 2.23607 6bin:*:2:2:System 2.44949 7nuucp:BJnuQbAo:6:10:UUCP.Admin:/usr/spool/uucppublic:/usr/lib/uucp/uucico 2.64575 8uucp:*:3:5:UUCP.Admin:/usr/lib/uucp: 2.82843 9sys:*:4:0:System 3 10adm:*:5:3:Accounting 3.16228 11lp:*:9:9:Print 3.31662 12auditor:*:11:0:Audit 3.4641 13dbadmin:*:12:0:Security 3.60555 14bootes:dcon:50:1:Tom 3.74166 15cdjuke:dcon:51:1:Tom 3.87298 16rfindd:*:66:1:Rfind 4 17EZsetup:*:992:998:System 4.12311 18demos:*:993:997:Demonstration 4.24264 19tutor:*:994:997:Tutorial 4.3589 20tour:*:995:997:IRIS 4.47214 21guest:nfP4/Wpvio/Rw:998:998:Guest 4.58258 224Dgifts:0nWRTZsOMt.:999:998:4Dgifts 14.9666 23nobody:*:60001:60001:SVR4 4.79583 24noaccess:*:60002:60002:uid 4.89898 25nobody:*:-2:-2:original 5 26rje:*:8:8:RJE 5.09902 27changes:*:11:11:system 5.19615 28dist:sorry:9999:4:file 5.2915 29man:*:99:995:On-line 5.38516 30phoneca:*:991:991:phone 5.47723 1r 1 2r 1.41421 3s 1.73205 4d 2 5d 2.23607 6b 2.44949 7n 2.64575 8u 2.82843 9s 3 10 3.16228 11 3.31662 12 3.4641 13 3.60555 14 3.74166 15 3.87298 16 4 17 4.12311 18 4.24264 19 4.3589 20 4.47214 21 4.58258 22 4.69042 23 4.79583 24 4.89898 25 5 26 5.09902 27 5.19615 28 5.2915 29 5.38516 30 5.47723
Logos
0
Crestwave/goawk
testdata/output/t.f.x
[ "MIT" ]
import ntype from require "moonscript.types" class Transformer new: (@transformers) => @seen_nodes = setmetatable {}, __mode: "k" transform_once: (scope, node, ...) => return node if @seen_nodes[node] @seen_nodes[node] = true transformer = @transformers[ntype node] if transformer transformer(scope, node, ...) or node else node transform: (scope, node, ...) => return node if @seen_nodes[node] @seen_nodes[node] = true while true transformer = @transformers[ntype node] res = if transformer transformer(scope, node, ...) or node else node return node if res == node node = res node bind: (scope) => (...) -> @transform scope, ... __call: (...) => @transform ... can_transform: (node) => @transformers[ntype node] != nil { :Transformer }
MoonScript
4
Shados/moonscript
moonscript/transform/transformer.moon
[ "MIT", "Unlicense" ]
module.exports = cool: "stuff" answer: 42 external: require "./cup2.coffee" again: require "./cup2"
CoffeeScript
1
1shenxi/webpack
examples/coffee-script/cup1.coffee
[ "MIT" ]
When working with Gremlin, there may be issues that arise. This section hopes to articulate common problems users have an how to resolve them. h2. Nearly everything is an iterator The expression @g.V[0]@ seems like it is returning the first vertex in the graph. However, this statement is in fact creating an iterator/iterable (i.e. a "Pipe":http://pipes.tinkerpop.com) that will return the first vertex in the graph when @next()@ is called on it. Thus, use @g.V[0].next()@ to return the first vertex in the graph. Better yet, just use @g.V.next()@. In general, when using the "Gremlin console":https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-from-the-Command-Line, it is not necessary to call @next()@ as the console will automatically iterate it and @==>@ print the objects of the iterator. However, when using Gremlin in, for example, "Java":https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Java or "Groovy":https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Groovy, be sure to iterate the pipe. Note that the [[Gremlin methods]] provide various shorthand mechanisms for this. For example, @iterate()@ will "@while(hasNext())@" and tends to be use consistently. h2. When the Gremlin Groovy console is stuck, use clear Many times you will misplace a @(@ or a @{@ and your console terminal will be "stuck." To get out of this situation, just type @clear@ to reset the parser. ```text gremlin> if(true) { gremlin> 1+2 gremlin> { gremlin> } gremlin> 1 groovysh_parse: 24: Ambiguous expression could be a parameterless ... 1 error gremlin> 1 groovysh_parse: 24: Ambiguous expression could be a parameterless ... 1 error gremlin> clear gremlin> 1 ==>1 ```
Textile
4
echinopsii/net.echinopsii.3rdparty.gremlin
doc/Troubleshooting.textile
[ "BSD-3-Clause" ]
{ lib, stdenv, fetchFromGitHub, libX11, libXxf86vm, libXext, libXrandr }: stdenv.mkDerivation rec { pname = "xcalib"; version = "0.10"; src = fetchFromGitHub { owner = "OpenICC"; repo = "xcalib"; rev = version; sha256 = "05fzdjmhiafgi2jf0k41i3nm0837a78sb6yv59cwc23nla8g0bhr"; }; buildInputs = [ libX11 libXxf86vm libXext libXrandr ]; installPhase = '' mkdir -p $out/bin cp xcalib $out/bin/ ''; meta = with lib; { inherit (src.meta) homepage; description = "A tiny monitor calibration loader for X and MS-Windows"; license = licenses.gpl2; maintainers = []; platforms = platforms.linux; }; }
Nix
3
siddhantk232/nixpkgs
pkgs/tools/X11/xcalib/default.nix
[ "MIT" ]
i 00001 17 24 02000 00 037 0003 i 00002 00 010 2012 00 016 2013 i 00003 00 012 2014 00 27 00005 i 00004 06 33 12345 00 22 00000 i 00005 02 33 76543 00 22 00000 d 02012 4154 0000 0000 0000 d 02013 4114 0000 0000 0000 d 02014 4110 0000 0000 0000
Octave
1
besm6/mesm6
test/divide/divide.oct
[ "MIT" ]
DROP SCHEMA PUBLIC CASCADE; create table ACCOUNT ( ID char(8) PRIMARY KEY, BALANCE NUMERIC(28,10) ); insert into ACCOUNT(ID, BALANCE) values ('a0000001', 1000); insert into ACCOUNT(ID, BALANCE) values ('a0000002', 2000);
SQL
3
DBatOWL/tutorials
jta/src/main/resources/account.sql
[ "MIT" ]
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; using System.Collections.Generic; namespace Microsoft.CodeAnalysis.CSharp { internal sealed class ExpressionVariableBinder : LocalScopeBinder { internal override SyntaxNode ScopeDesignator { get; } internal ExpressionVariableBinder(SyntaxNode scopeDesignator, Binder next) : base(next) { this.ScopeDesignator = scopeDesignator; } protected override ImmutableArray<LocalSymbol> BuildLocals() { var builder = ArrayBuilder<LocalSymbol>.GetInstance(); ExpressionVariableFinder.FindExpressionVariables(this, builder, (CSharpSyntaxNode)ScopeDesignator, GetBinder((CSharpSyntaxNode)ScopeDesignator)); return builder.ToImmutableAndFree(); } internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator) { if (ScopeDesignator == scopeDesignator) { return this.Locals; } throw ExceptionUtilities.Unreachable; } internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator) { throw ExceptionUtilities.Unreachable; } } }
C#
3
ffMathy/roslyn
src/Compilers/CSharp/Portable/Binder/ExpressionVariableBinder.cs
[ "MIT" ]
--# -path=.:../finnish/stemmed:../finnish:../api:../translator:alltenses concrete NDTransFin of NDTrans = NDLiftFin ,ExtensionsFin [CN,NP,AdA,AdV,CompoundCN,AdAdV,UttAdV,ApposNP] ,DictionaryFin - [Pol,Tense] ,ChunkFin ,DocumentationFin - [Pol,Tense] ** { flags literal=Symb ; lincat TransUnit = {s : Str} ; lin SFullstop p = {s = p.s ++ "."} ; SQuestmark p = {s = p.s ++ "?"} ; SExclmark p = {s = p.s ++ "!"} ; SUnmarked p = {s = p.s} ; }
Grammatical Framework
4
daherb/gf-rgl
src/experimental/NDTransFin.gf
[ "BSD-3-Clause" ]
// run-pass struct MyStruct { field: usize } struct Nested { nested: MyStruct } struct Mix2 { nested: ((usize,),) } const STRUCT: MyStruct = MyStruct { field: 42 }; const TUP: (usize,) = (43,); const NESTED_S: Nested = Nested { nested: MyStruct { field: 5 } }; const NESTED_T: ((usize,),) = ((4,),); const MIX_1: ((Nested,),) = ((Nested { nested: MyStruct { field: 3 } },),); const MIX_2: Mix2 = Mix2 { nested: ((2,),) }; const INSTANT_1: usize = (MyStruct { field: 1 }).field; const INSTANT_2: usize = (0,).0; fn main() { let a = [0; STRUCT.field]; let b = [0; TUP.0]; let c = [0; NESTED_S.nested.field]; let d = [0; (NESTED_T.0).0]; let e = [0; (MIX_1.0).0.nested.field]; let f = [0; (MIX_2.nested.0).0]; let g = [0; INSTANT_1]; let h = [0; INSTANT_2]; assert_eq!(a.len(), 42); assert_eq!(b.len(), 43); assert_eq!(c.len(), 5); assert_eq!(d.len(), 4); assert_eq!(e.len(), 3); assert_eq!(f.len(), 2); assert_eq!(g.len(), 1); assert_eq!(h.len(), 0); }
Rust
4
Eric-Arellano/rust
src/test/ui/issues/issue-19244.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
// Copyright 2006-2015 Las Venturas Playground. All rights reserved. // Use of this source code is governed by the GPLv2 license, a copy of which can // be found in the LICENSE file. #define NicknameGeneratorNameSets 23 /** * An array of the first names which will be used by the nickname generator. Considering the maximum * length of a nickname is 24 characters, we'll limit this to ten characters per first name. This * array is defined outside of the NicknameGenerator class as we don't need this to show up in docs. */ new g_nicknameGeneratorFirstNames[NicknameGeneratorNameSets][11] = { "Carl", // CJ "Sean", // Sweet "Kendl", // Yo Yo "Melvin", // Big Smoke "Big", // Big Smoke "Lance", // Ryder "Ryder", // Ryder "Jeffrey", // OG Loc "OG", // OG Loc "Barry", // Big Bear "Big", // Big Bear "Madd", // Madd Dogg "Cesar", // Cesar Vialpando "Frank", // Frank Tenpenny "Eddie", // Eddie Pulaski "T_Bone", // T-Bone Mendez "Mike", // Mike Toreno "Su_Xi", // Su Xi Mu "Ran_Fa", // Ran Fa Li "Kent", // Kent Paul "Ken", // Ken Rosenberg "Salvatore", // Salvatore Leone "Maria" // Maria Latore }; /** * The last names which add up to the earlier defined first names. Again, these are limited to ten * characters in length, considering that will help us to nicely stay within the limits. */ new g_nicknameGeneratorLastNames[NicknameGeneratorNameSets][11] = { "Johnson", // CJ "Johnson", // Sweet "", // Yo Yo "Harris", // Big Smoke "Smoke", // Big Smoke "Wilson", // Ryder "", // Ryder "Cross", // OG Loc "Loc", // OG Loc, "Thorne", // Big Bear "Bear", // Big Bear "Dogg", // Mad Dogg "Vialpando", // Cesar Vialpando "Tenpenny", // Frank Tenpenny "Pulaski", // Eddie Pulaski "Mendez", // T-Bone Mendez "Toreno", // Mike Toreno "Mu", // Su Xi Mu "Li", // Ran Fa Li "Paul", // Kent Paul "Rosenberg", // Ken Rosenberg "Leone", // Salvatore Leone "Latore" // Maria Latore }; /** * When a player chooses to play as a guest, which usually will be the case because they're using * a nickname that has been registered by another player, we'll assign a random nickname to them. * Previously this would be something like "LVP_123", but it's obviously much nicer to generate a * nickname using a first and last name, into something readible. * * @author Russell Krupke <russell@sa-mp.nl> */ class NicknameGenerator { // How much cells of entropy should be used for random names? const RandomSeedEntropy = 8; /** * Generate a nickname for the given player. We'll use their nickname and IP address as the seed * so we can ensure that they'll have the same nickname during future playing sessions. * * @param playerId Id of the player to generate a pseudo-random nickname for. * @param nickname Array to store the generated nickname in. * @param nicknameLength Maximum length of this buffer. * @return integer Length of the generated nickname. */ public generateForPlayerId(playerId, nickname[], nicknameLength) { new seedBuffer[16 + MAX_PLAYER_NAME + 1]; // maximum length of IP + nickname, plus one new currentNickname[MAX_PLAYER_NAME]; GetPlayerName(playerId, currentNickname, sizeof(currentNickname)); format(seedBuffer, sizeof(seedBuffer), "%s", Player(playerId)->ipAddressString()); strcat(seedBuffer, currentNickname, sizeof(seedBuffer)); return this->generate(seedBuffer, nickname, nicknameLength); } /** * The ugly guts for the nickname generator. Based on the given seed, it will select a random * first and last name, put them together and return them through the nickname parameter. * * Despite Las Venturas Playground being a deathmatch server, the names are probably much more * aimed towards role play, as it's hard to generate good DM names. They're the first and last * names of characters which appear in Grand Theft Auto: San Andreas. * * @param seed Seed to use when generating the nickname. * @param nickname Array to store the generated nickname in. * @param nicknameLength Maximum length of this buffer. * @return integer Length of the generated nickname. */ public generate(seed[], nickname[], nicknameLength) { new hash = adler32(seed), firstNameIndex = hash % NicknameGeneratorNameSets, lastNameIndex = (hash * hash) % NicknameGeneratorNameSets; format(nickname, nicknameLength, "%s", g_nicknameGeneratorFirstNames[firstNameIndex]); if (g_nicknameGeneratorLastNames[lastNameIndex][0] != 0) { new additionalLength = strlen(g_nicknameGeneratorLastNames[lastNameIndex]) + 1; if ((strlen(nickname) + additionalLength) < nicknameLength) { strcat(nickname, "_", nicknameLength); strcat(nickname, g_nicknameGeneratorLastNames[lastNameIndex], nicknameLength); } } return strlen(nickname); } };
PAWN
5
EPIC-striker/playground
pawn/Features/Account/NicknameGenerator.pwn
[ "MIT" ]
#!/usr/bin/env node /** * Usage: * node scripts/test-preview <pr-number> <pr-last-sha> <min-pwa-score> * * Checks whether a PR will (eventually) have a (public) preview, waits for the preview to be * available, and runs PWA tests against the preview. * * For PRs that are expected to have a preview, this script will fail if the preview is still not * available after a pre-defined waiting period or if the PWA tests fail. */ // Imports const {spawn} = require('child_process'); const {get: httpsGet} = require('https'); const {relative} = require('path'); // Input const [prNumber, prLastSha, minPwaScore] = validateArgs(process.argv.slice(2)); // Variables const aioBuildsDomain = 'ngbuilds.io'; const previewCheckInterval = 30000; const previewCheckAttempts = 10; const shortSha = prLastSha && prLastSha.slice(0, 7); const previewabilityCheckUrl = `https://${aioBuildsDomain}/can-have-public-preview/${prNumber}`; const previewUrl = `https://pr${prNumber}-${shortSha}.${aioBuildsDomain}/`; // Check whether the PR can have a (public) preview. get(previewabilityCheckUrl). then(response => JSON.parse(response)). then(({canHavePublicPreview, reason}) => { // Nothing to do, if this PR can have no (public) preview. if (canHavePublicPreview === false) { reportNoPreview(reason); return; } // There should be a preview. Wait for it to be available. return poll(previewCheckInterval, previewCheckAttempts, () => get(previewUrl)). // The preview is still not available after the specified waiting period. catch(() => { const totalSecs = Math.round((previewCheckInterval * previewCheckAttempts) / 1000); throw new Error(`Preview still not available after ${totalSecs}s.`); }). // The preview is now available. Run the tests. then(() => yarnRun('smoke-tests', previewUrl)). then(() => yarnRun('test-pwa-score', previewUrl, minPwaScore)); }). catch(onError); // Helpers function get(url) { console.log(`GET ${url}`); return new Promise((resolve, reject) => { const onResponse = res => { const statusCode = res.statusCode || -1; const isSuccess = (200 <= statusCode) && (statusCode < 400); let responseText = ''; res. on('error', reject). on('data', d => responseText += d). on('end', () => isSuccess ? resolve(responseText) : reject(`Request to '${url}' failed (status: ${statusCode}): ${responseText}`)); }; httpsGet(url, onResponse). on('error', reject); }); } function onError(err) { console.error(err); process.exit(1); } function poll(interval, attempts, checkCondition) { return new Promise((resolve, reject) => { if (!attempts) return reject(); checkCondition(). then(() => resolve()). catch(() => wait(interval). then(() => poll(interval, attempts - 1, checkCondition)). then(resolve, reject)); }); } function reportNoPreview(reason) { console.log(`No (public) preview available. (Reason: ${reason})`); } function validateArgs(args) { if (args.length !== 3) { const relativeScriptPath = relative('.', __filename.replace(/\.js$/, '')); const usageCmd = `node ${relativeScriptPath} <pr-number> <pr-last-sha> <min-pwa-score>`; return onError( `Invalid number of arguments (expected 3, found ${args.length}).\n` + `Usage: ${usageCmd}`); } return args; } function wait(delay) { console.log(`Waiting ${delay}ms...`); return new Promise(resolve => setTimeout(resolve, delay)); } function yarnRun(script, ...args) { return new Promise((resolve, reject) => { const spawnOptions = {cwd: __dirname, stdio: 'inherit'}; spawn('yarn', [script, ...args], spawnOptions). on('error', reject). on('exit', code => (code === 0 ? resolve : reject)()); }); }
JavaScript
5
coreyscherbing/angular
aio/scripts/test-preview.js
[ "MIT" ]
expression: 42 constant_value: KtLiteralConstantValue(constantValueKind=Int, value=42) constant: 42
Text
1
margarita-nedzelska-sonarsource/kotlin
analysis/analysis-api/testData/components/compileTimeConstantEvaluator/propertyInit_Int.txt
[ "ECL-2.0", "Apache-2.0" ]
# Lint as: python3 # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for modify_model_interface_lib.py.""" import os import numpy as np import tensorflow as tf from tensorflow.lite.tools.optimize.python import modify_model_interface_lib from tensorflow.python.framework import test_util from tensorflow.python.platform import test def build_tflite_model_with_full_integer_quantization( supported_ops=tf.lite.OpsSet.TFLITE_BUILTINS_INT8): # Define TF model input_size = 3 model = tf.keras.Sequential([ tf.keras.layers.InputLayer(input_shape=(input_size,), dtype=tf.float32), tf.keras.layers.Dense(units=5, activation=tf.nn.relu), tf.keras.layers.Dense(units=2, activation=tf.nn.softmax) ]) # Convert TF Model to a Quantized TFLite Model converter = tf.lite.TFLiteConverter.from_keras_model(model) converter.optimizations = [tf.lite.Optimize.DEFAULT] def representative_dataset_gen(): for i in range(10): yield [np.array([i] * input_size, dtype=np.float32)] converter.representative_dataset = representative_dataset_gen converter.target_spec.supported_ops = [supported_ops] tflite_model = converter.convert() return tflite_model class ModifyModelInterfaceTest(test_util.TensorFlowTestCase): def testInt8Interface(self): # 1. SETUP # Define the temporary directory and files temp_dir = self.get_temp_dir() initial_file = os.path.join(temp_dir, 'initial_model.tflite') final_file = os.path.join(temp_dir, 'final_model.tflite') # Define initial model initial_model = build_tflite_model_with_full_integer_quantization() with open(initial_file, 'wb') as model_file: model_file.write(initial_model) # 2. INVOKE # Invoke the modify_model_interface function modify_model_interface_lib.modify_model_interface(initial_file, final_file, tf.int8, tf.int8) # 3. VALIDATE # Load TFLite model and allocate tensors. initial_interpreter = tf.lite.Interpreter(model_path=initial_file) initial_interpreter.allocate_tensors() final_interpreter = tf.lite.Interpreter(model_path=final_file) final_interpreter.allocate_tensors() # Get input and output types. initial_input_dtype = initial_interpreter.get_input_details()[0]['dtype'] initial_output_dtype = initial_interpreter.get_output_details()[0]['dtype'] final_input_dtype = final_interpreter.get_input_details()[0]['dtype'] final_output_dtype = final_interpreter.get_output_details()[0]['dtype'] # Validate the model interfaces self.assertEqual(initial_input_dtype, np.float32) self.assertEqual(initial_output_dtype, np.float32) self.assertEqual(final_input_dtype, np.int8) self.assertEqual(final_output_dtype, np.int8) def testInt16Interface(self): # 1. SETUP # Define the temporary directory and files temp_dir = self.get_temp_dir() initial_file = os.path.join(temp_dir, 'initial_model.tflite') final_file = os.path.join(temp_dir, 'final_model.tflite') # Define initial model initial_model = build_tflite_model_with_full_integer_quantization( supported_ops=tf.lite.OpsSet .EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8) with open(initial_file, 'wb') as model_file: model_file.write(initial_model) # 2. INVOKE # Invoke the modify_model_interface function modify_model_interface_lib.modify_model_interface(initial_file, final_file, tf.int16, tf.int16) # 3. VALIDATE # Load TFLite model and allocate tensors. initial_interpreter = tf.lite.Interpreter(model_path=initial_file) initial_interpreter.allocate_tensors() final_interpreter = tf.lite.Interpreter(model_path=final_file) final_interpreter.allocate_tensors() # Get input and output types. initial_input_dtype = initial_interpreter.get_input_details()[0]['dtype'] initial_output_dtype = initial_interpreter.get_output_details()[0]['dtype'] final_input_dtype = final_interpreter.get_input_details()[0]['dtype'] final_output_dtype = final_interpreter.get_output_details()[0]['dtype'] # Validate the model interfaces self.assertEqual(initial_input_dtype, np.float32) self.assertEqual(initial_output_dtype, np.float32) self.assertEqual(final_input_dtype, np.int16) self.assertEqual(final_output_dtype, np.int16) def testUInt8Interface(self): # 1. SETUP # Define the temporary directory and files temp_dir = self.get_temp_dir() initial_file = os.path.join(temp_dir, 'initial_model.tflite') final_file = os.path.join(temp_dir, 'final_model.tflite') # Define initial model initial_model = build_tflite_model_with_full_integer_quantization() with open(initial_file, 'wb') as model_file: model_file.write(initial_model) # 2. INVOKE # Invoke the modify_model_interface function modify_model_interface_lib.modify_model_interface(initial_file, final_file, tf.uint8, tf.uint8) # 3. VALIDATE # Load TFLite model and allocate tensors. initial_interpreter = tf.lite.Interpreter(model_path=initial_file) initial_interpreter.allocate_tensors() final_interpreter = tf.lite.Interpreter(model_path=final_file) final_interpreter.allocate_tensors() # Get input and output types. initial_input_dtype = initial_interpreter.get_input_details()[0]['dtype'] initial_output_dtype = initial_interpreter.get_output_details()[0]['dtype'] final_input_dtype = final_interpreter.get_input_details()[0]['dtype'] final_output_dtype = final_interpreter.get_output_details()[0]['dtype'] # Validate the model interfaces self.assertEqual(initial_input_dtype, np.float32) self.assertEqual(initial_output_dtype, np.float32) self.assertEqual(final_input_dtype, np.uint8) self.assertEqual(final_output_dtype, np.uint8) if __name__ == '__main__': test.main()
Python
5
EricRemmerswaal/tensorflow
tensorflow/lite/tools/optimize/python/modify_model_interface_lib_test.py
[ "Apache-2.0" ]
// I'm a comment! /* * Adds the given numbers together. */ /*! * Adds the given numbers together. */ asdasdasdad(df, ad=23) add(a, b = a) a + b green(#0c0) add(10, 5) // => 15 add(10) add(a, b) &asdasd (arguments) @sdfsdf .signatures background-color #e0e8e0 border 1px solid grayLighter box-shadow 0 0 3px grayLightest border-radius 3px padding 3px 5px "adsads" margin-left 0 list-style none .signature list-style none display: inline margin-left 0 > li display inline is not .signature-values list-style none display inline margin-left 0 &:before content '→' margin 0 5px > li !important unless
Stylus
1
websharks/ace-builds
demo/kitchen-sink/docs/stylus.styl
[ "BSD-3-Clause" ]
;;; ;;; Common methods implementations, default behaviour. ;;; (in-package #:pgloader.sources) (defmethod data-is-preformatted-p ((copy copy)) "By default, data is not preformatted." nil) (defmethod preprocess-row ((copy copy)) "The default preprocessing of raw data is to do nothing." nil) (defmethod copy-column-list ((copy copy)) "Default column list is an empty list." nil) (defmethod cleanup ((copy db-copy) (catalog catalog) &key materialize-views) "In case anything wrong happens at `prepare-pgsql-database' step, this function will be called to clean-up the mess left behind, if any." (declare (ignorable materialize-views)) t) (defmethod instanciate-table-copy-object ((copy db-copy) (table table)) "Create an new instance for copying TABLE data." (let* ((fields (table-field-list table)) (columns (table-column-list table)) (transforms (mapcar #'column-transform columns))) (make-instance (class-of copy) :source-db (clone-connection (source-db copy)) :target-db (clone-connection (target-db copy)) :source table :target table :fields fields :columns columns :transforms transforms)))
Common Lisp
4
micaelle/pgloader
src/sources/common/methods.lisp
[ "PostgreSQL" ]
tests/cases/compiler/index.tsx(3,1): error TS6133: 'React' is declared but its value is never read. ==== tests/cases/compiler/index.tsx (1 errors) ==== /// <reference path="/.lib/react16.d.ts" /> import React from "react"; ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS6133: 'React' is declared but its value is never read. function Bar() { return <div />; } export function Foo() { return <Bar />; }
Text
4
monciego/TypeScript
tests/baselines/reference/reactImportUnusedInNewJSXEmit(jsx=react-jsxdev).errors.txt
[ "Apache-2.0" ]
title: Introduction Video Thumbnail.jpg type: image/jpeg tags: picture
Unity3D Asset
0
8d1h/TiddlyWiki5
editions/tw5.com/tiddlers/images/Introduction Video Thumbnail.jpg.meta
[ "BSD-3-Clause" ]
SELECT addMonths(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 1, 'Asia/Kolkata'); SELECT addMonths(toDateTime('2017-11-05 10:37:47', 'Asia/Kolkata'), 1); SELECT addMonths(toTimeZone(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata'), 1); SELECT addMonths(toDateTime('2017-11-05 08:07:47'), 1); SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), 1); SELECT addMonths(toDateTime('2017-11-05 08:07:47'), materialize(1)); SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), materialize(1)); SELECT addMonths(toDateTime('2017-11-05 08:07:47'), -1); SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), -1); SELECT addMonths(toDateTime('2017-11-05 08:07:47'), materialize(-1)); SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), materialize(-1)); SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Europe/Moscow'); SELECT toUnixTimestamp(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Europe/Moscow'); SELECT toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'); SELECT toTimeZone(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata'); SELECT toString(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow')); SELECT toString(toTimeZone(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata')); SELECT toString(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata');
SQL
3
pdv-ru/ClickHouse
tests/queries/0_stateless/00515_enhanced_time_zones.sql
[ "Apache-2.0" ]
from typing import Any, Dict, List, Set, Tuple from .coverage_record import CoverageRecord from .llvm_coverage_segment import LlvmCoverageSegment, parse_segments class LlvmCoverageParser: """ Accepts a parsed json produced by llvm-cov export -- typically, representing a single C++ test and produces a list of CoverageRecord(s). """ def __init__(self, llvm_coverage: Dict[str, Any]) -> None: self._llvm_coverage = llvm_coverage @staticmethod def _skip_coverage(path: str) -> bool: """ Returns True if file path should not be processed. This is repo-specific and only makes sense for the current state of ovrsource. """ if "/third-party/" in path: return True return False @staticmethod def _collect_coverage( segments: List[LlvmCoverageSegment], ) -> Tuple[List[int], List[int]]: """ Stateful parsing of coverage segments. """ covered_lines: Set[int] = set() uncovered_lines: Set[int] = set() prev_segment = LlvmCoverageSegment(1, 0, 0, 0, 0, None) for segment in segments: covered_range, uncovered_range = segment.get_coverage(prev_segment) covered_lines.update(covered_range) uncovered_lines.update(uncovered_range) prev_segment = segment uncovered_lines.difference_update(covered_lines) return sorted(covered_lines), sorted(uncovered_lines) def parse(self, repo_name: str) -> List[CoverageRecord]: # The JSON format is described in the LLVM source code # https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-cov/CoverageExporterJson.cpp records: List[CoverageRecord] = [] for export_unit in self._llvm_coverage["data"]: for file_info in export_unit["files"]: filepath = file_info["filename"] if self._skip_coverage(filepath): continue if filepath is None: continue segments = file_info["segments"] covered_lines, uncovered_lines = self._collect_coverage( parse_segments(segments) ) records.append(CoverageRecord(filepath, covered_lines, uncovered_lines)) return records
Python
5
Hacky-DH/pytorch
tools/code_coverage/package/tool/parser/llvm_coverage_parser.py
[ "Intel" ]
-- -- $Id$ -- -- Narya library - tools for developing networked games -- Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -- http://www.threerings.net/code/narya/ -- -- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA macroScript TRAnimationExporter category:"File" \ buttonText:"Export Animation as XML..." toolTip:"Export Animation as XML" ( -- Writes a point3-valued attribute to the file fn writePoint3Attr attr p outFile = ( format "%=\"%, %, %\"" attr p.x p.y p.z to:outFile ) -- Writes a quat-valued attribute to the file fn writeQuatAttr attr q outFile = ( format "%=\"%, %, %, %\"" attr q.x q.y q.z q.w to:outFile ) -- Writes a single node transform fn writeTransform node outFile = ( format " <transform name=\"%\"" node.name to:outFile xform = node.transform if node.parent != undefined do ( xform = xform * (inverse node.parent.transform) ) writePoint3Attr " translation" xform.translationPart outFile writeQuatAttr " rotation" (inverse xform.rotationPart) outFile writePoint3Attr " scale" xform.scalePart outFile format "/>\n" to:outFile ) -- Writes a single animation frame fn writeFrame nodes outFile = ( format " <frame>\n" to:outFile for node in nodes do in coordsys world ( writeTransform node outFile ) format " </frame>\n\n" to:outFile ) -- Writes animation to the named file fn writeAnimation fileName = ( outFile = createfile fileName format "<?xml version=\"1.0\" standalone=\"yes\"?>\n\n" to:outFile format "<animation frameRate=\"%\">\n\n" frameRate to:outFile objs = objects as array sels = selection as array if sels.count > 0 do ( objs = sels ) for t = animationRange.start to animationRange.end do at time t ( writeFrame objs outFile ) if sels.count > 0 do ( select sels ) format "</animation>\n" to:outFile close outFile ) -- -- Main entry point -- -- Get the target filename persistent global xmlAnimFileName local fileName if (xmlAnimFileName == undefined) then ( fileName = maxFilePath + (getFilenameFile maxFileName) + ".mxml" ) else ( fileName = xmlAnimFileName ) fileName = getSaveFileName caption:"Select File to Export" \ filename:fileName types:"XML Animations (*.MXML)|*.mxml|All|*.*" if fileName != undefined do ( xmlAnimFileName = fileName writeAnimation fileName ) )
MAXScript
5
mimeyy/dylansbang
jme/src/main/ms/TRAnimationExporter.mcr
[ "BSD-2-Clause" ]
@import Foundation; extern NSErrorDomain const BadErrorDomain; typedef enum __attribute__((ns_error_domain(BadErrorDomain), swift_name("BadError"))) BadError: NSInteger { BadBig, BadSmall, } BadError;
C
4
lwhsu/swift
test/SILGen/Inputs/external-associated-type-conformance.h
[ "Apache-2.0" ]
{{ Motor_Minder_Test.spin Tom Doyle 6 March 2007 Motor_Minder monitors the speed and revolution count of a motor using a shaft encoder. It was tested with the Melexis 90217 Hall-Effect Sensor (Parallax 605-00005) and a single magnet mounted (Parallax 605-00006) on the shaft. It should work with any type of sensor that puts out one pulse per revolution. The object runs in a new cog updating varibles in the calling cogs address space. It has been tested with one motor. To clear the revolution counter memory call the start procedure again. }} CON _CLKMODE = XTAL1 + PLL16X ' 80 Mhz clock _XINFREQ = 5_000_000 Encoder1pin = 7 ' shaft encoder - Propeller pin F1 = 1.0 ' floating point 1 F60000 = 60_000.0 ' floating point 60,000 OBJ mm : "Motor_Minder" lcd : "serial_lcd" num : "simple_numbers" F : "FloatMath" FS : "FloatString" VAR long period, revCount ' motor period and revCount updated by Motor_Minder.spin long Fwidth, Frpm ' floating point variables for display PUB Init if lcd.start(0, 9600, 4) lcd.putc(lcd#LcdOn1) ' no cursor lcd.cls ' setup screen lcd.backlight(1) lcd.str(string("Encoder")) if mm.start(Encoder1pin, @period, @revCount) > 0 repeat lcd.gotoxy(0,0) FS.setPrecision(4) Fwidth := F.FFloat(period) Fwidth := F.FDiv(F1, Fwidth) Frpm := F.FMul(Fwidth, F60000) lcd.str(FS.FloatToString(Frpm)) lcd.str(string(" RPM ")) lcd.gotoxy(0,1) lcd.str(num.dec(revCount))
Propeller Spin
5
deets/propeller
libraries/community/p1/All/Motor Minder/Motor_Minder_Test.spin
[ "MIT" ]
//Ports define($MAC1 98:03:9b:33:fe:e2) define($MAC2 98:03:9b:33:fe:db) define($NET1 10.220.0.0/16) define($NET2 10.221.0.0/16) define($IP1 10.220.0.1) define($IP2 10.221.0.1) define($PORT1 0) define($PORT2 1) //Parameters define($rxverbose 99) define($txverbose 99) define($bout 32) define($ignore 0) //TSCClock allows fast user-level timing TSCClock(NOWAIT true); //JiffieClock use a counter for jiffies instead of reading the time (much like Linux) JiffieClock(MINPRECISION 1000); //ARPDispatcher separate ARP queries, ARP responses, and other IP packets elementclass ARPDispatcher { input[0]-> iparp :: CTXDispatcher( 12/0800, 12/0806, -) iparp[0] -> [0]output iparp[1] -> arptype ::CTXDispatcher(20/0001, 20/0002, -) iparp[2] -> [3]output arptype[0] -> [1]output arptype[1] -> [2]output arptype[2] -> [3]output } tab :: ARPTable /** * Receiver encapsulate everything to handle one port (CTXManager, ARP management, IP checker, ... * */ elementclass Receiver { $port, $mac, $ip, $range | input[0] -> arpq :: ARPQuerier($ip, $mac, TABLE tab) -> etherOUT :: Null f :: FromDPDKDevice($port, VERBOSE $rxverbose, PROMISC false, RSS_AGGREGATE 1, THREADOFFSET 0, MAXTHREADS 1) -> fc :: CTXManager(BUILDER 1, AGGCACHE false, CACHESIZE 65536, VERBOSE 1, EARLYDROP true) -> arpr :: ARPDispatcher() arpr[0] -> FlowStrip(14) -> receivercheck :: CheckIPHeader(CHECKSUM false) -> inc :: CTXDispatcher(9/01 0, 9/06 0, -) inc[0] //TCP or ICMP -> [0]output; inc[1] -> IPPrint("UNKNOWN IP") -> Unstrip(14) -> Discard arpr[1] -> Print("RX ARP Request $mac", -1) -> arpRespIN :: ARPResponder($range $mac) -> Print("TX ARP Responding", -1) -> etherOUT; arpRespIN[1] -> Print("ARP Packet not for $mac", -1) -> Discard arpr[2] -> Print("RX ARP Response $mac", -1) -> [1]arpq; arpr[3] -> Print("Unknown packet type IN???",-1) -> Discard(); etherOUT -> t :: ToDPDKDevice($port,BLOCKING true,BURST $bout, ALLOC true, VERBOSE $txverbose, TCO true) } r1 :: Receiver($PORT1,$MAC1,$IP1,$IP1); r2 :: Receiver($PORT2,$MAC2,$IP2,$IP2); //Idle -> host :: Null; r1 //Elements on the forward path -> r2; r2 //Elements on the return path -> r1;
Click
4
regufo/fastclick
conf/middleclick/middlebox-ip-empty.click
[ "BSD-3-Clause-Clear" ]
0.0 0.0 4.0e-4 5.0260194e-2 8.0e-4 0.10048864 1.1999999e-3 0.1506536 1.6e-3 0.20072344 1.9999999e-3 0.25066644 2.3999999e-3 0.30045116 2.8e-3 0.35004613 3.2e-3 0.39941996 3.6e-3 0.44854155 3.9999997e-3 0.49737975 4.3999995e-3 0.54590386 4.7999993e-3 0.5940831 5.199999e-3 0.6418871 5.599999e-3 0.68928576 5.9999987e-3 0.736249 6.3999984e-3 0.7827472 6.799998e-3 0.82875097 7.199998e-3 0.87423134 7.599998e-3 0.9191595 7.999998e-3 0.96350706 8.399998e-3 1.0072463 8.799998e-3 1.0503491 9.199998e-3 1.0927886 9.599999e-3 1.1345378 9.999999e-3 1.1755705 1.0399999e-2 1.2158606 1.0799999e-2 1.2553827 1.12e-2 1.294112 1.16e-2 1.3320237 1.2e-2 1.3690943 1.24e-2 1.4053 1.2800001e-2 1.4406182 1.3200001e-2 1.4750264 1.3600001e-2 1.5085028 1.4000001e-2 1.5410266 1.4400002e-2 1.572577 1.4800002e-2 1.6031342 1.5200002e-2 1.6326787 1.5600002e-2 1.661192 1.6000003e-2 1.6886561 1.6400002e-2 1.7150536 1.6800001e-2 1.7403677 1.72e-2 1.7645825 1.76e-2 1.7876829 1.8e-2 1.8096541 1.8399999e-2 1.8304824 1.8799998e-2 1.8501544 1.9199997e-2 1.8686578 1.9599997e-2 1.885981 1.9999996e-2 1.902113 2.0399995e-2 1.9170434 2.0799994e-2 1.9307631 2.1199994e-2 1.9432633 2.1599993e-2 1.9545361 2.1999992e-2 1.9645743 2.2399992e-2 1.9733717 2.2799991e-2 1.9809227 2.319999e-2 1.9872226 2.359999e-2 1.9922671 2.3999989e-2 1.9960533 2.4399988e-2 1.9985789 2.4799988e-2 1.999842 2.5199987e-2 1.999842 2.5599986e-2 1.998579 2.5999986e-2 1.9960536 2.6399985e-2 1.9922674 2.6799984e-2 1.9872228 2.7199984e-2 1.980923 2.7599983e-2 1.9733722 2.7999982e-2 1.9645749 2.8399982e-2 1.9545367 2.879998e-2 1.943264 2.919998e-2 1.930764 2.959998e-2 1.9170443 2.9999979e-2 1.9021138 3.0399978e-2 1.8859819 3.0799977e-2 1.8686588 3.1199977e-2 1.8501555 3.1599976e-2 1.8304834 3.1999975e-2 1.8096554 3.2399975e-2 1.7876841 3.2799974e-2 1.7645838 3.3199973e-2 1.7403691 3.3599973e-2 1.715055 3.3999972e-2 1.6886578 3.439997e-2 1.6611936 3.479997e-2 1.6326804 3.519997e-2 1.6031361 3.559997e-2 1.5725791 3.599997e-2 1.541029 3.6399968e-2 1.5085055 3.6799967e-2 1.4750288 3.7199967e-2 1.4406208 3.7599966e-2 1.4053029 3.7999965e-2 1.3690974 3.8399965e-2 1.3320271 3.8799964e-2 1.2941151 3.9199963e-2 1.2553861 3.9599963e-2 1.2158642 3.999996e-2 1.1755743 4.039996e-2 1.1345419 4.079996e-2 1.0927929 4.119996e-2 1.0503532 4.159996e-2 1.0072505 4.199996e-2 0.9635117 4.2399958e-2 0.9191643 4.2799957e-2 0.87423635 4.3199956e-2 0.82875574 4.3599956e-2 0.7827521 4.3999955e-2 0.7362541 4.4399954e-2 0.68929106 4.4799954e-2 0.6418926 4.5199953e-2 0.5940888 4.5599952e-2 0.5459092 4.599995e-2 0.49738535 4.639995e-2 0.4485473 4.679995e-2 0.39942592 4.719995e-2 0.3500523 4.759995e-2 0.30045706 4.799995e-2 0.25067255 4.8399948e-2 0.2007297 4.8799947e-2 0.15066005 4.9199946e-2 0.100495264 4.9599946e-2 5.0266996e-2 4.9999945e-2 6.500875e-6 5.0399944e-2 -5.025352e-2 5.0799944e-2 -0.1004818 5.1199943e-2 -0.15064661 5.1599942e-2 -0.20071629 5.199994e-2 -0.25065964 5.239994e-2 -0.30044422 5.279994e-2 -0.350039 5.319994e-2 -0.39941272 5.359994e-2 -0.44853416 5.3999938e-2 -0.4973723 5.4399937e-2 -0.5458967 5.4799937e-2 -0.5940759 5.5199936e-2 -0.64187986 5.5599935e-2 -0.6892784 5.5999935e-2 -0.7362416 5.6399934e-2 -0.7827402 5.6799933e-2 -0.82874393 5.7199933e-2 -0.87422425 5.7599932e-2 -0.9191523 5.799993e-2 -0.9634999 5.839993e-2 -1.0072393 5.879993e-2 -1.0503422 5.919993e-2 -1.0927815 5.959993e-2 -1.1345308 5.9999928e-2 -1.1755633 6.0399927e-2 -1.2158535 6.0799927e-2 -1.255376 6.1199926e-2 -1.2941052 6.1599925e-2 -1.332017 6.1999924e-2 -1.3690875 6.2399924e-2 -1.4052932 6.279992e-2 -1.4406117 6.319992e-2 -1.4750199 6.359992e-2 -1.5084965 6.399992e-2 -1.5410206 6.439992e-2 -1.5725712 6.479992e-2 -1.6031283 6.519992e-2 -1.6326729 6.559992e-2 -1.6611863 6.599992e-2 -1.6886505 6.639992e-2 -1.7150481 6.679992e-2 -1.7403624 6.7199916e-2 -1.7645775 6.7599915e-2 -1.7876781 6.7999914e-2 -1.8096495 6.839991e-2 -1.8304783 6.879991e-2 -1.8501506 6.919991e-2 -1.8686541 6.959991e-2 -1.8859775 6.999991e-2 -1.9021097 7.039991e-2 -1.9170405 7.079991e-2 -1.9307604 7.119991e-2 -1.9432608 7.159991e-2 -1.9545338 7.199991e-2 -1.9645723 7.239991e-2 -1.97337 7.2799906e-2 -1.9809214 7.3199905e-2 -1.9872214 7.3599905e-2 -1.9922662 7.3999904e-2 -1.9960527 7.43999e-2 -1.9985785 7.47999e-2 -1.9998419 7.51999e-2 -1.9998423 7.55999e-2 -1.9985794 7.59999e-2 -1.9960542 7.63999e-2 -1.9922683 7.67999e-2 -1.9872241 7.71999e-2 -1.9809245 7.75999e-2 -1.9733739 7.79999e-2 -1.9645768 7.83999e-2 -1.9545388 7.8799896e-2 -1.9432664 7.9199895e-2 -1.9307666 7.9599895e-2 -1.9170473 7.9999894e-2 -1.902117 8.039989e-2 -1.8859855 8.079989e-2 -1.8686627 8.119989e-2 -1.8501595 8.159989e-2 -1.8304875 8.199989e-2 -1.8096596 8.239989e-2 -1.7876887 8.279989e-2 -1.7645887 8.319989e-2 -1.7403742 8.359989e-2 -1.7150604 8.399989e-2 -1.6886632 8.439989e-2 -1.6611996 8.4799886e-2 -1.6326867 8.5199885e-2 -1.6031425 8.5599884e-2 -1.5725858 8.599988e-2 -1.5410352 8.639988e-2 -1.5085119 8.679988e-2 -1.4750358 8.719988e-2 -1.4406279 8.759988e-2 -1.4053102 8.799988e-2 -1.3691049 8.839988e-2 -1.3320347 8.879988e-2 -1.2941233 8.919988e-2 -1.2553945 8.959988e-2 -1.2158726 8.999988e-2 -1.175583 9.0399876e-2 -1.13455 9.0799876e-2 -1.0928011 9.1199875e-2 -1.050362 9.1599874e-2 -1.0072595 9.199987e-2 -0.96352077 9.239987e-2 -0.9191735 9.279987e-2 -0.87424564 9.319987e-2 -0.8287656 9.359987e-2 -0.78276205 9.399987e-2 -0.73626417 9.439987e-2 -0.6893012 9.479987e-2 -0.64190197 9.519987e-2 -0.59409815 9.559987e-2 -0.5459192 9.599987e-2 -0.49739534 9.6399866e-2 -0.44855735 9.6799865e-2 -0.39943603 9.7199865e-2 -0.35006243 9.7599864e-2 -0.30046773 9.799986e-2 -0.25068325 9.839986e-2 -0.20074043 9.879986e-2 -0.15067083 9.919986e-2 -0.10050509 9.959986e-2 -5.027683e-2 9.999986e-2 -1.6816446e-5 0.10039986 5.024321e-2 0.10079986 0.100471504 0.10119986 0.15063633 0.10159986 0.20070602 0.10199986 0.25064895 0.102399856 0.30043355 0.102799855 0.3500284 0.103199854 0.39940214 0.103599854 0.44852456 0.10399985 0.49736276 0.10439985 0.5458868 0.10479985 0.5940661 0.10519985 0.6418701 0.10559985 0.6892687 0.10599985 0.736232 0.10639985 0.7827302 0.10679985 0.8287341 0.10719985 0.87421453 0.10759985 0.9191428 0.10799985 0.9634913 0.108399846 1.0072304 0.108799845 1.0503334 0.109199844 1.092773 0.10959984 1.1345222 0.10999984 1.175555 0.11039984 1.2158452 0.11079984 1.2553675 0.11119984 1.294097 0.11159984 1.332009 0.11199984 1.3690796 0.11239984 1.4052863 0.11279984 1.4406046 0.11319984 1.475013 0.11359984 1.5084898 0.113999836 1.5410138 0.114399835 1.5725645 0.114799835 1.6031219 0.115199834 1.6326667 0.11559983 1.6611804 0.11599983 1.6886448 0.11639983 1.7150426 0.11679983 1.7403576 0.11719983 1.7645729 0.11759983 1.7876737 0.11799983 1.8096453 0.11839983 1.8304739 0.11879983 1.8501464 0.11919983 1.8686503 0.11959983 1.8859739 0.119999826 1.9021064 0.120399825 1.9170374 0.120799825 1.9307575 0.121199824 1.9432585 0.12159982 1.9545318 0.12199982 1.9645705 0.12239982 1.9733684 0.12279982 1.9809198 0.12319982 1.9872202 0.12359982 1.9922652 0.12399982 1.996052 0.12439982 1.9985781 0.12479982 1.9998418 0.12519982 1.9998424 0.12559983 1.9985797 0.12599984 1.9960546 0.12639984 1.9922688 0.12679985 1.9872246 0.12719986 1.9809252 0.12759987 1.9733747 0.12799987 1.9645776 0.12839988 1.9545392 0.12879989 1.9432665 0.12919989 1.9307665 0.1295999 1.9170468 0.1299999 1.9021163 0.13039991 1.8859843 0.13079992 1.868661 0.13119993 1.8501575 0.13159993 1.8304853 0.13199994 1.8096569 0.13239995 1.7876855 0.13279995 1.7645848 0.13319996 1.7403696 0.13359997 1.7150551 0.13399997 1.6886573 0.13439998 1.6611929 0.13479999 1.6326791 0.1352 1.6031342 0.1356 1.5725766 0.136 1.5410256 0.13640001 1.5085014 0.13680002 1.4750243 0.13720003 1.4406155 0.13760003 1.4052968 0.13800004 1.3690904 0.13840005 1.3320193 0.13880005 1.2941068 0.13920006 1.2553754 0.13960007 1.2158525 0.14000008 1.1755617 0.14040008 1.1345282 0.14080009 1.0927782 0.1412001 1.0503379 0.1416001 1.0072342 0.14200011 0.9634943 0.14240012 0.9191458 0.14280012 0.87421674 0.14320013 0.8287355 0.14360014 0.78273076 0.14400014 0.7362316 0.14440015 0.68926746 0.14480016 0.64186794 0.14520016 0.5940629 0.14560017 0.54588276 0.14600018 0.49735776 0.14640018 0.4485186 0.14680019 0.39939615 0.1472002 0.35002142 0.1476002 0.30042562 0.14800021 0.25064003 0.14840022 0.20069614 0.14880022 0.15062548 0.14920023 0.10045967 0.14960024 5.0230417e-2 0.15000024 -3.2472628e-5 0.15040025 -5.0293438e-2 0.15080026 -0.10052263 0.15120026 -0.15068834 0.15160027 -0.20075886 0.15200028 -0.25070256 0.15240029 -0.30048794 0.15280029 -0.3500835 0.1532003 -0.39945793 0.1536003 -0.44858003 0.15400031 -0.49741882 0.15440032 -0.5459434 0.15480033 -0.5941231 0.15520033 -0.6419276 0.15560034 -0.68932664 0.15600035 -0.7362902 0.15640035 -0.78278875 0.15680036 -0.8287928 0.15720037 -0.8742734 0.15760037 -0.9192018 0.15800038 -0.96354955 0.15840039 -1.0072887 0.1588004 -1.0503916 0.1592004 -1.092831 0.1596004 -1.1345801 0.16000041 -1.1756126 0.16040042 -1.2159026 0.16080043 -1.2554245 0.16120043 -1.2941549 0.16160044 -1.3320663 0.16200045 -1.3691365 0.16240045 -1.4053416 0.16280046 -1.4406593 0.16320047 -1.4750669 0.16360047 -1.5085428 0.16400048 -1.5410659 0.16440049 -1.5726155 0.1648005 -1.6031718 0.1652005 -1.6327156 0.16560051 -1.661228 0.16600052 -1.688691 0.16640052 -1.7150875 0.16680053 -1.7404007 0.16720054 -1.7646145 0.16760054 -1.7877138 0.16800055 -1.8096838 0.16840056 -1.8305107 0.16880056 -1.8501815 0.16920057 -1.8686836 0.16960058 -1.8860053 0.17000058 -1.9021357 0.17040059 -1.9170648 0.1708006 -1.9307829 0.1712006 -1.9432814 0.17160061 -1.9545525 0.17200062 -1.9645894 0.17240062 -1.973385 0.17280063 -1.980934 0.17320064 -1.9872319 0.17360064 -1.9922745 0.17400065 -1.9960587 0.17440066 -1.9985821 0.17480066 -1.9998431 0.17520067 -1.999841 0.17560068 -1.9985757 0.17600068 -1.996048 0.17640069 -1.9922595 0.1768007 -1.9872127 0.1772007 -1.9809105 0.17760071 -1.9733572 0.17800072 -1.9645574 0.17840073 -1.9545168 0.17880073 -1.9432416 0.17920074 -1.9307389 0.17960075 -1.9170167 0.18000075 -1.9020836 0.18040076 -1.8859491 0.18080077 -1.8686235 0.18120077 -1.8501174 0.18160078 -1.8304428 0.18200079 -1.8096119 0.1824008 -1.7876381 0.1828008 -1.7645352 0.1832008 -1.7403166 0.18360081 -1.7149998 0.18400082 -1.6885997 0.18440083 -1.661133 0.18480083 -1.6326171 0.18520084 -1.6030699 0.18560085 -1.5725102 0.18600085 -1.5409572 0.18640086 -1.5084308 0.18680087 -1.4749517 0.18720087 -1.440541 0.18760088 -1.4052204 0.18800089 -1.3690121 0.1884009 -1.3319391 0.1888009 -1.2940248 0.18920091 -1.2552933 0.18960091 -1.2157687 0.19000092 -1.1754762 0.19040093 -1.1344413 0.19080094 -1.0926898 0.19120094 -1.0502481 0.19160095 -1.007143 0.19200096 -0.9634018 0.19240096 -0.91905206 0.19280097 -0.8741218 0.19320098 -0.8286394 0.19360098 -0.7826336 0.19400099 -0.73613167 0.194401 -0.68916655 0.194801 -0.64176613 0.19520101 -0.59396034 0.19560102 -0.54577935 0.19600102 -0.49725366 0.19640103 -0.44841388 0.19680104 -0.39929086 0.19720104 -0.34991562 0.19760105 -0.30031937 0.19800106 -0.2505334 0.19840106 -0.20058921 0.19880107 -0.15051831 0.19920108 -0.10035235 0.19960108 -5.0122987e-2 0.20000109 1.3802848e-4 0.2004011 5.0398957e-2 0.2008011 0.100628056 0.20120111 0.1507936 0.20160112 0.20086388 0.20200112 0.2508073 0.20240113 0.30059227 0.20280114 0.35018742 0.20320114 0.39956135 0.20360115 0.4486829 0.20400116 0.49752104 0.20440117 0.54604495 0.20480117 0.59422576 0.20520118 0.6420294 0.20560119 0.6894275 0.20600119 0.7363901 0.2064012 0.78288764 0.2068012 0.8288906 0.20720121 0.8743701 0.20760122 0.9192972 0.20800123 0.9636437 0.20840123 1.0073816 0.20880124 1.050483 0.20920125 1.092921 0.20960125 1.1346686 0.21000126 1.1756996 0.21040127 1.2159879 0.21080127 1.2555081 0.21120128 1.2942353 0.21160129 1.3321451 0.2120013 1.3692133 0.2124013 1.4054167 0.2128013 1.4407325 0.21320131 1.4751382 0.21360132 1.5086122 0.21400133 1.5411332 0.21440133 1.5726807 0.21480134 1.603235 0.21520135 1.6327765 0.21560135 1.6612867 0.21600136 1.6887486 0.21640137 1.7151428 0.21680138 1.7404536 0.21720138 1.7646651 0.21760139 1.7877619 0.2180014 1.8097295 0.2184014 1.830554 0.21880141 1.8502222 0.21920142 1.8687218 0.21960142 1.886041 0.22000143 1.902169 0.22040144 1.9170954 0.22080144 1.9308109 0.22120145 1.9433068 0.22160146 1.9545753 0.22200146 1.9646091 0.22240147 1.9734021 0.22280148 1.9809486 0.22320148 1.9872438 0.22360149 1.9922837 0.2240015 1.9960653 0.2244015 1.998586 0.22480151 1.9998444 0.22520152 1.9998397 0.22560152 1.9985718 0.22600153 1.9960413 0.22640154 1.9922502 0.22680154 1.9872005 0.22720155 1.9808956 0.22760156 1.9733397 0.22800156 1.9645373 0.22840157 1.954494 0.22880158 1.9432161 0.22920159 1.9307109 0.22960159 1.9169861 0.2300016 1.9020505 0.2304016 1.8859134 0.23080161 1.8685851 0.23120162 1.8500766 0.23160163 1.8303995 0.23200163 1.8095663 0.23240164 1.7875899 0.23280165 1.7644845 0.23320165 1.7402647 0.23360166 1.7149456 0.23400167 1.6885431 0.23440167 1.6610742 0.23480168 1.6325561 0.23520169 1.6030068 0.2356017 1.5724449 0.2360017 1.5408899 0.2364017 1.5083616 0.23680171 1.4748805 0.23720172 1.4404678 0.23760173 1.4051453 0.23800173 1.3689338 0.23840174 1.331859 0.23880175 1.2939429 0.23920175 1.2552096 0.23960176 1.2156833 0.24000177 1.1753893 0.24040177 1.1343528 0.24080178 1.0925997 0.24120179 1.0501566 0.2416018 1.0070502 0.2420018 0.9633076 0.24240181 0.9189566 0.24280182 0.8740251 0.24320182 0.8285416 0.24360183 0.7825347 0.24400184 0.73603356 0.24440184 0.6890675 0.24480185 0.6416662 0.24520186 0.59385955 0.24560186 0.54567784 0.24600187 0.49715143 0.24640188 0.448311 0.24680188 0.39918742 0.24720189 0.3498117 0.2476019 0.300215 0.2480019 0.25042868 0.24840191 0.20048419 0.24880192 0.15041116 0.24920192 0.10024502 0.24960193 5.001556e-2 0.25000194 -2.4549168e-4 0.25040194 -5.0506387e-2 0.25080195 -0.10073538 0.25120196 -0.15090075 0.25160196 -0.2009708 0.25200197 -0.25091392 0.25240198 -0.30069852 0.25280198 -0.35029322 0.253202 -0.39966664 0.253602 -0.44878763 0.254002 -0.49762514 0.254402 -0.5461483 0.25480202 -0.59432656 0.25520203 -0.64212936 0.25560203 -0.6895266 0.25600204 -0.7364883 0.25640205 -0.7829848 0.25680205 -0.8289867 0.25720206 -0.874465 0.25760207 -0.919391 0.25800207 -0.9637362 0.25840208 -1.0074726 0.2588021 -1.0505729 0.2592021 -1.0930094 0.2596021 -1.1347555 0.2600021 -1.175785 0.2604021 -1.2160717 0.26080212 -1.2555903 0.26120213 -1.2943158 0.26160213 -1.3322238 0.26200214 -1.3692902 0.26240215 -1.4054918 0.26280215 -1.4408057 0.26320216 -1.4752095 0.26360217 -1.5086814 0.26400217 -1.5412004 0.26440218 -1.5727459 0.2648022 -1.6032981 0.2652022 -1.6328397 0.2656022 -1.6613476 0.2660022 -1.6888062 0.2664022 -1.715198 0.26680222 -1.7405065 0.26720223 -1.7647157 0.26760224 -1.7878101 0.26800224 -1.8097752 0.26840225 -1.8305973 0.26880226 -1.8502631 0.26920226 -1.8687601 0.26960227 -1.8860768 0.27000228 -1.9022021 0.27040228 -1.917126 0.2708023 -1.930839 0.2712023 -1.9433322 0.2716023 -1.9545981 0.2720023 -1.9646293 0.27240232 -1.9734195 0.27280232 -1.9809633 0.27320233 -1.9872558 0.27360234 -1.9922931 0.27400234 -1.996072 0.27440235 -1.9985901 0.27480236 -1.9998459 0.27520236 -1.9998384 0.27560237 -1.9985676 0.27600238 -1.9960346 0.27640238 -1.9922408 0.2768024 -1.9871886 0.2772024 -1.9808811 0.2776024 -1.9733225 0.2780024 -1.9645175 0.27840242 -1.9544716 0.27880242 -1.9431912 0.27920243 -1.9306833 0.27960244 -1.916956 0.28000244 -1.9020178 0.28040245 -1.8858782 0.28080246 -1.8685476 0.28120247 -1.8500365 0.28160247 -1.830357 0.28200248 -1.8095212 0.2824025 -1.7875426 0.2828025 -1.7644348 0.2832025 -1.7402126 0.2836025 -1.7148912 0.2840025 -1.6884866 0.28440252 -1.6610154 0.28480253 -1.6324952 0.28520253 -1.6029437 0.28560254 -1.5723797 0.28600255 -1.5408226 0.28640255 -1.5082922 0.28680256 -1.4748092 0.28720257 -1.4403919 0.28760257 -1.4050674 0.28800258 -1.3688555 0.2884026 -1.3317788 0.2888026 -1.293861 0.2892026 -1.2551259 0.2896026 -1.215598 0.2900026 -1.1753024 0.29040262 -1.1342642 0.29080263 -1.0925097 0.29120263 -1.0500652 0.29160264 -1.0069573 0.29200265 -0.96321344 0.29240265 -0.91886115 0.29280266 -0.8739285 0.29320267 -0.82844377 0.29360268 -0.78243583 0.29400268 -0.7359336 0.2944027 -0.6889666 0.2948027 -0.64156437 0.2952027 -0.5937569 0.2956027 -0.5455744 0.29600272 -0.49704733 0.29640272 -0.44820628 0.29680273 -0.39908212 0.29720274 -0.34970587 0.29760274 -0.30010876 0.29800275 -0.25032207 0.29840276 -0.20037727 0.29880276 -0.1503059 0.29920277 -0.100139596 0.29960278 -4.9910035e-2 0.30000278 3.5104755e-4 0.3004028 5.061191e-2 0.3008028 0.10084081 0.3012028 0.151006 0.3016028 0.20107582 0.30200282 0.25101864 0.30240282 0.3008029 0.30280283 0.35039714 0.30320284 0.39977008 0.30360284 0.44889048 0.30400285 0.49772736 0.30440286 0.54624987 0.30480286 0.59442735 0.30520287 0.6422293 0.30560288 0.6896257 0.3060029 0.7365864 0.3064029 0.7830819 0.3068029 0.8290828 0.3072029 0.87455994 0.3076029 0.9194847 0.30800292 0.9638287 0.30840293 1.0075638 0.30880293 1.0506626 0.30920294 1.093101 0.30960295 1.1348456 0.31000295 1.1758734 0.31040296 1.2161585 0.31080297 1.2556754 0.31120297 1.2943991 0.31160298 1.3323053 0.312003 1.36937 0.312403 1.4055697 0.312803 1.4408816 0.313203 1.4752833 0.313603 1.5087532 0.31400302 1.5412701 0.31440303 1.5728135 0.31480303 1.6033634 0.31520304 1.6329006 0.31560305 1.6614064 0.31600305 1.6888628 0.31640306 1.7152524 0.31680307 1.7405585 0.31720307 1.7647653 0.31760308 1.7878574 0.3180031 1.8098202 0.3184031 1.8306398 0.3188031 1.8503032 0.3192031 1.8687978 0.31960312 1.886112 0.32000312 1.9022348 0.32040313 1.9171561 0.32080314 1.9308665 0.32120314 1.9433572 0.32160315 1.9546204 0.32200316 1.9646491 0.32240316 1.9734367 0.32280317 1.9809779 0.32320318 1.9872677 0.32360318 1.9923024 0.3240032 1.9960786 0.3244032 1.998594 0.3248032 1.9998472 0.3252032 1.9998369 0.32560322 1.9985636 0.32600322 1.996028 0.32640323 1.9922315 0.32680324 1.9871767 0.32720324 1.9808666 0.32760325 1.9733053 0.32800326 1.9644977 0.32840326 1.9544492 0.32880327 1.9431661 0.32920328 1.9306557 0.32960328 1.9169259 0.3300033 1.9019852 0.3304033 1.8858432 0.3308033 1.8685085 0.3312033 1.8499949 0.33160332 1.8303128 0.33200333 1.8094747 0.33240333 1.7874936 0.33280334 1.7643833 0.33320335 1.7401587 0.33360335 1.7148349 0.33400336 1.6884279 0.33440337 1.6609545 0.33480337 1.632432 0.33520338 1.6028782 0.3356034 1.5723121 0.3360034 1.5407529 0.3364034 1.5082204 0.3368034 1.4747353 0.3372034 1.4403187 0.33760342 1.4049923 0.33800343 1.3687785 0.33840343 1.3317001 0.33880344 1.2937804 0.33920345 1.2550437 0.33960345 1.2155142 0.34000346 1.1752169 0.34040347 1.1341773 0.34080347 1.0924213 0.34120348 1.0499753 0.3416035 1.0068661 0.3420035 0.96312094 0.3424035 0.9187674 0.3428035 0.87383354 0.3432035 0.8283477 0.34360352 0.7823387 0.34400353 0.7358355 0.34440354 0.6888675 0.34480354 0.6414644 0.34520355 0.5936561 0.34560356 0.54547286 0.34600356 0.49694508 0.34640357 0.4481034 0.34680358 0.39897868 0.34720358 0.34960195 0.3476036 0.3000044 0.3480036 0.25021735 0.3484036 0.20027225 0.3488036 0.15020065 0.34920362 0.10003417 0.34960362 4.9804512e-2 0.35000363 -4.566034e-4 0.35040364 -5.0717432e-2 0.35080364 -0.100946225 0.35120365 -0.15111126 0.35160366 -0.20118085 0.35200366 -0.25112334 0.35240367 -0.30090722 0.35280368 -0.35050482 0.35320368 -0.39987722 0.3536037 -0.44899708 0.3540037 -0.4978333 0.3544037 -0.54635507 0.3548037 -0.5945318 0.35520372 -0.6423329 0.35560372 -0.6897283 0.35600373 -0.7366881 0.35640374 -0.78318256 0.35680375 -0.82918227 0.35720375 -0.8746583 0.35760376 -0.91958183 0.35800377 -0.9639245 0.35840377 -1.0076584 0.35880378 -1.0507557 0.3592038 -1.0931894 0.3596038 -1.1349325 0.3600038 -1.1759588 0.3604038 -1.2162423 0.3608038 -1.2557576 0.36120382 -1.2944796 0.36160383 -1.3323841 0.36200383 -1.369447 0.36240384 -1.4056448 0.36280385 -1.4409548 0.36320385 -1.4753546 0.36360386 -1.5088226 0.36400387 -1.5413374 0.36440387 -1.5728787 0.36480388 -1.6034266 0.3652039 -1.6329616 0.3656039 -1.6614652 0.3660039 -1.6889193 0.3664039 -1.7153066 0.3668039 -1.7406105 0.36720392 -1.764815 0.36760393 -1.7879047 0.36800393 -1.8098651 0.36840394 -1.8306823 0.36880395 -1.8503432 0.36920395 -1.8688353 0.36960396 -1.886147 0.37000397 -1.9022673 0.37040398 -1.9171861 0.37080398 -1.9308939 0.371204 -1.9433821 0.371604 -1.9546428 0.372004 -1.9646688 0.372404 -1.9734539 0.37280402 -1.9809924 0.37320402 -1.9872797 0.37360403 -1.9923117 0.37400404 -1.9960853 0.37440404 -1.998598 0.37480405 -1.9998485 0.37520406 -1.9998356 0.37560406 -1.9985595 0.37600407 -1.996021 0.37640408 -1.9922218 0.37680408 -1.9871643 0.3772041 -1.9808515 0.3776041 -1.9732876 0.3780041 -1.9644772 0.3784041 -1.9544259 0.37880412 -1.9431403 0.37920412 -1.9306272 0.37960413 -1.9168947 0.38000414 -1.9019513 0.38040414 -1.8858067 0.38080415 -1.8684709 0.38120416 -1.8499548 0.38160416 -1.8302703 0.38200417 -1.8094296 0.38240418 -1.7874461 0.3828042 -1.7643336 0.3832042 -1.7401067 0.3836042 -1.7147806 0.3840042 -1.6883714 0.3844042 -1.6608957 0.38480422 -1.632371 0.38520423 -1.6028152 0.38560423 -1.5722469 0.38600424 -1.5406855 0.38640425 -1.508151 0.38680425 -1.474664 0.38720426 -1.4402454 0.38760427 -1.4049171 0.38800427 -1.3687015 0.38840428 -1.3316213 0.3888043 -1.2937 0.3892043 -1.2549615 0.3896043 -1.2154304 0.3900043 -1.1751316 0.3904043 -1.1340904 0.39080432 -1.092333 0.39120433 -1.0498855 0.39160433 -1.0067749 0.39200434 -0.96302843 0.39240435 -0.91867363 0.39280435 -0.8737386 0.39320436 -0.8282516 0.39360437 -0.7822415 0.39400437 -0.7357373 0.39440438 -0.6887684 0.3948044 -0.6413644 0.3952044 -0.59355533 0.3956044 -0.54537135 0.3960044 -0.49684283 0.39640442 -0.44800055 0.39680442 -0.3988715 0.39720443 -0.34949428 0.39760444 -0.29989627 0.39800444 -0.25010884 0.39840445 -0.20016342 0.39880446 -0.15009159 0.39920446 -9.992494e-2 0.39960447 -4.9695175e-2 0.40000448 5.659739e-4 0.40040448 5.0826766e-2 0.4008045 0.10105546 0.4012045 0.15122032 0.4016045 0.20128965 0.4020045 0.25123185 0.40240452 0.30101538 0.40280452 0.35060874 0.40320453 0.39998066 0.40360454 0.44909993 0.40400454 0.49793553 0.40440455 0.54645663 0.40480456 0.59463257 0.40520456 0.64243287 0.40560457 0.68982744 0.40600458 0.73678625 0.40640458 0.78327966 0.4068046 0.82927835 0.4072046 0.87475324 0.4076046 0.9196756 0.4080046 0.96401703 0.40840462 1.0077496 0.40880463 1.0508455 0.40920463 1.0932778 0.40960464 1.1350194 0.41000465 1.1760442 0.41040465 1.2163261 0.41080466 1.2558397 0.41120467 1.2945601 0.41160467 1.3324628 0.41200468 1.3695239 0.4124047 1.4057199 0.4128047 1.441028 0.4132047 1.4754258 0.4136047 1.5088918 0.4140047 1.5414046 0.41440472 1.5729439 0.41480473 1.6034896 0.41520473 1.6330225 0.41560474 1.6615239 0.41600475 1.6889758 0.41640475 1.7153609 0.41680476 1.7406625 0.41720477 1.7648647 0.41760477 1.787952 0.41800478 1.80991 0.4184048 1.8307248 0.4188048 1.8503847 0.4192048 1.8688743 0.4196048 1.8861834 0.4200048 1.9023011 0.42040482 1.9172173 0.42080483 1.9309224 0.42120484 1.9434079 0.42160484 1.9546659 0.42200485 1.9646893 0.42240486 1.9734716 0.42280486 1.9810075 0.42320487 1.9872919 0.42360488 1.9923213 0.42400488 1.9960921 0.4244049 1.9986022 0.4248049 1.9998498 0.4252049 1.9998342 0.4256049 1.9985555 0.42600492 1.9960144 0.42640492 1.9922125 0.42680493 1.9871523 0.42720494 1.9808369 0.42760494 1.9732703 0.42800495 1.9644574 0.42840496 1.9544035 0.42880496 1.9431152 0.42920497 1.9305997 0.42960498 1.9168645 0.43000498 1.9019186 0.430405 1.8857715 0.430805 1.8684332 0.431205 1.8499147 0.431605 1.8302277 0.43200502 1.8093847 0.43240502 1.7873988 0.43280503 1.7642839 0.43320504 1.7400546 0.43360505 1.7147262 0.43400505 1.6883148 0.43440506 1.6608369 0.43480507 1.6323099 0.43520507 1.602752 0.43560508 1.5721817 0.4360051 1.5406183 0.4364051 1.5080818 0.4368051 1.4745927 0.4372051 1.4401722 0.4376051 1.404842 0.43800512 1.3686246 0.43840513 1.3315425 0.43880513 1.2936195 0.43920514 1.2548794 0.43960515 1.2153466 0.44000515 1.1750461 0.44040516 1.1340003 0.44080517 1.0922413 0.44120517 1.0497924 0.44160518 1.0066804 0.4420052 0.9629326 0.4424052 0.9185765 0.4428052 0.8736402 0.4432052 0.82815206 0.4436052 0.78214085 0.44400522 0.73563564 0.44440523 0.6886657 0.44480523 0.6412608 0.44520524 0.5934509 0.44560525 0.5452661 0.44600525 0.4967369 0.44640526 0.44789395 0.44680527 0.39876807 0.44720528 0.34939033 0.44760528 0.2997919 0.4480053 0.2500041 0.4484053 0.2000584 0.4488053 0.14998633 0.4492053 9.981951e-2 0.44960532 4.9589653e-2 0.45000532 -6.715298e-4 0.45040533 -5.093229e-2 0.45080534 -0.10116088 0.45120534 -0.15132557 0.45160535 -0.20139468 0.45200536 -0.25133657 0.45240536 -0.30111971 0.45280537 -0.35071266 0.45320538 -0.40008408 0.45360538 -0.4492028 0.4540054 -0.49803776 0.4544054 -0.54655814 0.4548054 -0.5947333 0.4552054 -0.6425328 0.45560542 -0.6899265 0.45600542 -0.73688436 0.45640543 -0.7833768 0.45680544 -0.8293744 0.45720544 -0.8748481 0.45760545 -0.9197693 0.45800546 -0.9641095 0.45840546 -1.0078408 0.45880547 -1.0509354 0.45920548 -1.0933661 0.4596055 -1.1351063 0.4600055 -1.1761296 0.4604055 -1.2164099 0.4608055 -1.2559218 0.4612055 -1.2946405 0.46160552 -1.3325415 0.46200553 -1.3696008 0.46240553 -1.4057977 0.46280554 -1.4411038 0.46320555 -1.4754996 0.46360555 -1.5089636 0.46400556 -1.5414743 0.46440557 -1.5730115 0.46480557 -1.603555 0.46520558 -1.6330856 0.4656056 -1.6615847 0.4660056 -1.6890345 0.4664056 -1.7154171 0.4668056 -1.7407163 0.4672056 -1.7649161 0.46760562 -1.7880011 0.46800563 -1.8099566 0.46840563 -1.8307688 0.46880564 -1.8504248 0.46920565 -1.8689119 0.46960565 -1.8862185 0.47000566 -1.9023337 0.47040567 -1.9172473 0.47080567 -1.9309499 0.47120568 -1.9434329 0.4716057 -1.9546883 0.4720057 -1.964709 0.4724057 -1.9734887 0.4728057 -1.9810219 0.47320572 -1.9873039 0.47360572 -1.9923304 0.47400573 -1.9960986 0.47440574 -1.9986061 0.47480574 -1.9998511 0.47520575 -1.9998329 0.47560576 -1.9985515 0.47600576 -1.9960077 0.47640577 -1.9922032 0.47680578 -1.9871403 0.47720578 -1.9808223 0.4776058 -1.9732531 0.4780058 -1.9644376 0.4784058 -1.9543811 0.4788058 -1.9430903 0.47920582 -1.930572 0.47960582 -1.9168345 0.48000583 -1.9018861 0.48040584 -1.8857363 0.48080584 -1.8683956 0.48120585 -1.8498746 0.48160586 -1.8301852 0.48200586 -1.8093398 0.48240587 -1.7873515 0.48280588 -1.7642342 0.48320588 -1.7400026 0.4836059 -1.714672 0.4840059 -1.6882582 0.4844059 -1.6607759 0.4848059 -1.6322467 0.48520592 -1.6026865 0.48560593 -1.572114 0.48600593 -1.5405486 0.48640594 -1.5080099 0.48680595 -1.4745188 0.48720595 -1.4400963 0.48760596 -1.4047642 0.48800597 -1.3685448 0.48840597 -1.331461 0.48880598 -1.2935361 0.489206 -1.2547941 0.489606 -1.2152597 0.490006 -1.1749576 0.490406 -1.1339134 0.490806 -1.0921528 0.49120602 -1.0497025 0.49160603 -1.0065892 0.49200603 -0.96284 0.49240604 -0.9184827 0.49280605 -0.8735452 0.49320605 -0.828056 0.49360606 -0.7820437 0.49400607 -0.73553747 0.49440607 -0.6885666 0.49480608 -0.64116085 0.4952061 -0.5933501 0.4956061 -0.5451645 0.4960061 -0.49663466 0.4964061 -0.44779107 0.49680611 -0.39866465 0.49720612 -0.3492864 0.49760613 -0.29968753 0.49800614 -0.24989937 0.49840614 -0.19995338 0.49880615 -0.14988106 0.49920616 -9.971409e-2 0.49960616 -4.948413e-2 0.50000614 7.7327096e-4 0.50040615 5.1033996e-2 0.50080615 0.10126249 0.50120616 0.15142702 0.50160617 0.2014959 0.5020062 0.25143752 0.5024062 0.3012203 0.5028062 0.35081282 0.5032062 0.40018377 0.5036062 0.44930193 0.5040062 0.4981363 0.5044062 0.546656 0.5048062 0.59483045 0.5052062 0.6426292 0.50560623 0.690022 0.50600624 0.73698246 0.50640625 0.7834739 0.50680625 0.82947046 0.50720626 0.8749431 0.50760627 0.91986305 0.5080063 0.964202 0.5084063 1.0079318 0.5088063 1.0510252 0.5092063 1.0934545 0.5096063 1.1351901 0.5100063 1.1762149 0.5104063 1.2164906 0.5108063 1.256004 0.5112063 1.2947181 0.51160634 1.3326203 0.51200634 1.3696749 0.51240635 1.4058701 0.51280636 1.4411718 0.51320636 1.4755684 0.51360637 1.5090278 0.5140064 1.5415392 0.5144064 1.573072 0.5148064 1.6036158 0.5152064 1.6331422 0.5156064 1.6616414 0.5160064 1.6890868 0.5164064 1.7154695 0.5168064 1.7407683 0.51720643 1.764964 0.51760644 1.7880483 0.51800644 1.8099998 0.51840645 1.8308114 0.51880646 1.8504634 0.51920646 1.8689494 0.5196065 1.8862523 0.5200065 1.9023663 0.5204065 1.9172763 0.5208065 1.9309775 0.5212065 1.9434569 0.5216065 1.9547106 0.5220065 1.964728 0.5224065 1.9735059 0.5228065 1.981036 0.52320653 1.9873157 0.52360654 1.9923394 0.52400655 1.9961053 0.52440655 1.9986099 0.52480656 1.9998523 0.52520657 1.9998316 0.5256066 1.9985474 0.5260066 1.9960012 0.5264066 1.9921939 0.5268066 1.9871289 0.5272066 1.9808078 0.5276066 1.9732366 0.5280066 1.9644177 0.5284066 1.9543595 0.5288066 1.9430653 0.52920663 1.9305454 0.52960664 1.9168043 0.53000665 1.9018546 0.53040665 1.8857012 0.53080666 1.8683592 0.53120667 1.8498344 0.5316067 1.8301442 0.5320067 1.8092948 0.5324067 1.7873058 0.5328067 1.7641845 0.5332067 1.7399524 0.5336067 1.7146176 0.5340067 1.6882037 0.5344067 1.6607193 0.5348067 1.6321901 0.53520674 1.6026257 0.53560674 1.5720536 0.53600675 1.5404836 0.53640676 1.5079455 0.53680676 1.4744501 0.53720677 1.4400283 0.5376068 1.4046918 0.5380068 1.3684734 0.5384068 1.331385 0.5388068 1.2934556 0.5392068 1.254715 0.5396068 1.2151759 0.5400068 1.1748753 0.5404068 1.1338264 0.54080683 1.0920676 0.54120684 1.0496128 0.54160684 1.0065013 0.54200685 0.9627475 0.54240686 0.91839236 0.54280686 0.8734503 0.5432069 0.82796335 0.5436069 0.78194654 0.5440069 0.7354429 0.5444069 0.6884675 0.5448069 0.64106447 0.5452069 0.59324926 0.5456069 0.54506665 0.5460069 0.4965324 0.5464069 0.44769192 0.54680693 0.3985612 0.54720694 0.3491862 0.54760695 0.29958317 0.54800695 0.24979843 0.54840696 0.19984834 0.54880697 0.1497796 0.549207 9.960867e-2 0.549607 4.938242e-2 0.550007 -8.826415e-4 0.550407 -5.113952e-2 0.550807 -0.10137172 0.551207 -0.15153226 0.551607 -0.20160471 0.552007 -0.25154224 0.552407 -0.30132842 0.55280703 -0.35091674 0.55320704 -0.40029094 0.55360705 -0.44940478 0.55400705 -0.49824223 0.55440706 -0.5467576 0.55480707 -0.5949349 0.5552071 -0.64272916 0.5556071 -0.69012463 0.5560071 -0.73707706 0.5564071 -0.783571 0.5568071 -0.829563 0.5572071 -0.87503797 0.5576071 -0.91995335 0.5580071 -0.96429443 0.5584071 -1.0080198 0.55880713 -1.0511149 0.55920714 -1.0935397 0.55960715 -1.1352801 0.56000715 -1.1762972 0.56040716 -1.2165774 0.56080717 -1.2560891 0.5612072 -1.2948015 0.5616072 -1.3327018 0.5620072 -1.3697547 0.5624072 -1.4059478 0.5628072 -1.4412476 0.5632072 -1.4756422 0.5636072 -1.5090996 0.5640072 -1.5416088 0.5644072 -1.5731394 0.56480724 -1.6036812 0.56520724 -1.6332053 0.56560725 -1.6617023 0.56600726 -1.6891454 0.56640726 -1.7155256 0.56680727 -1.7408185 0.5672073 -1.7650154 0.5676073 -1.7880939 0.5680073 -1.8100463 0.5684073 -1.8308523 0.5688073 -1.8505049 0.5692073 -1.8689857 0.5696073 -1.8862886 0.5700073 -1.9023976 0.57040733 -1.9173074 0.57080734 -1.9310039 0.57120734 -1.9434828 0.57160735 -1.9547322 0.57200736 -1.9647485 0.57240736 -1.9735223 0.5728074 -1.981051 0.5732074 -1.9873271 0.5736074 -1.9923489 0.5740074 -1.9961116 0.5744074 -1.998614 0.5748074 -1.9998536 0.5752074 -1.9998301 0.5756074 -1.9985436 0.5760074 -1.9959943 0.57640743 -1.9921849 0.57680744 -1.9871165 0.57720745 -1.9807937 0.57760745 -1.9732187 0.57800746 -1.9643986 0.57840747 -1.9543363 0.5788075 -1.9430412 0.5792075 -1.930517 0.5796075 -1.9167752 0.5800075 -1.9018208 0.5804075 -1.8856673 0.5808075 -1.8683202 0.5812075 -1.8497958 0.5816075 -1.8301 0.5820075 -1.8092514 0.58240753 -1.7872567 0.58280754 -1.764133 0.58320755 -1.7398984 0.58360755 -1.7145612 0.58400756 -1.688145 0.58440757 -1.6606584 0.5848076 -1.6321269 0.5852076 -1.6025603 0.5856076 -1.5719858 0.5860076 -1.5404139 0.5864076 -1.5078738 0.5868076 -1.4743762 0.5872076 -1.4399525 0.5876076 -1.404614 0.5880076 -1.3683937 0.58840764 -1.3313034 0.58880764 -1.293378 0.58920765 -1.2546297 0.58960766 -1.215095 0.59000766 -1.1747867 0.59040767 -1.1337426 0.5908077 -1.091976 0.5912077 -1.0495261 0.5916077 -1.0064068 0.5920077 -0.96265835 0.5924077 -0.9182952 0.5928077 -0.8733587 0.5932077 -0.8278638 0.5936077 -0.7818529 0.59400773 -0.73534113 0.59440774 -0.688372 0.59480774 -0.6409609 0.59520775 -0.5931521 0.59560776 -0.5449614 0.59600776 -0.49643385 0.5964078 -0.4475853 0.5968078 -0.3984615 0.5972078 -0.34907854 0.5976078 -0.29948258 0.5980078 -0.24968992 0.5984078 -0.19974712 0.5988078 -0.14967054 0.5992078 -9.950705e-2 0.5996078 -4.927308e-2 0.60000783 9.843827e-4 0.60040784 5.1248852e-2 0.60080785 0.10147333 0.60120785 0.15164132 0.60160786 0.20170593 0.60200787 0.25165072 0.6024079 0.301429 0.6028079 0.35102442 0.6032079 0.4003906 0.6036079 0.44951135 0.6040079 0.49834076 0.6044079 0.5468628 0.6048079 0.5950393 0.6052079 0.6428327 0.6056079 0.69022727 0.60600793 0.73717874 0.60640794 0.7836717 0.60680795 0.82966256 0.60720795 0.8751363 0.60760796 0.9200505 0.60800797 0.9643903 0.608408 1.0081142 0.608808 1.051208 0.609208 1.0936313 0.609608 1.1353701 0.610008 1.1763856 0.610408 1.2166643 0.610808 1.2561682 0.611208 1.2948848 0.611608 1.3327776 0.61200804 1.3698343 0.61240804 1.4060202 0.61280805 1.4413234 0.61320806 1.4757109 0.61360806 1.5091714 0.61400807 1.5416737 0.6144081 1.573207 0.6148081 1.6037419 0.6152081 1.6332685 0.6156081 1.6617589 0.6160081 1.689204 0.6164081 1.715578 0.6168081 1.7408723 0.6172081 1.7650633 0.61760813 1.7881429 0.61800814 1.8100896 0.61840814 1.8308963 0.61880815 1.8505435 0.61920816 1.8690246 0.61960816 1.8863225 0.6200082 1.9024315 0.6204082 1.9173363 0.6208082 1.9310324 0.6212082 1.9435067 0.6216082 1.9547553 0.6220082 1.9647675 0.6224082 1.9735401 0.6228082 1.9810649 0.6232082 1.9873394 0.62360823 1.9923579 0.62400824 1.9961184 0.62440825 1.9986178 0.62480825 1.9998549 0.62520826 1.9998288 0.62560827 1.9985394 0.6260083 1.9959879 0.6264083 1.9921752 0.6268083 1.987104 0.6272083 1.9807786 0.6276083 1.9732009 0.6280083 1.9643781 0.6284083 1.954313 0.6288083 1.9430152 0.6292083 1.9304883 0.62960833 1.916744 0.63000834 1.9017869 0.63040835 1.8856308 0.63080835 1.8682812 0.63120836 1.8497542 0.63160837 1.830056 0.6320084 1.8092048 0.6324084 1.7872076 0.6328084 1.764085 0.6332084 1.7398446 0.6336084 1.7145089 0.6340084 1.6880864 0.6344084 1.6606016 0.6348084 1.6320637 0.6352084 1.6024994 0.63560843 1.5719182 0.63600844 1.540349 0.63640845 1.5078019 0.63680845 1.4743074 0.63720846 1.4398766 0.63760847 1.4045415 0.6380085 1.3683138 0.6384085 1.3312274 0.6388085 1.2932945 0.6392085 1.2545506 0.6396085 1.2150081 0.6400085 1.1747044 0.6404085 1.1336524 0.6408085 1.0918908 0.6412085 1.049433 0.64160854 1.0063188 0.64200854 0.9625625 0.64240855 0.9182048 0.64280856 0.8732604 0.64320856 0.8277712 0.64360857 0.7817522 0.6440086 0.73524654 0.6444086 0.6882693 0.6448086 0.6408645 0.6452086 0.5930477 0.6456086 0.5448635 0.6460086 0.4963279 0.6464086 0.44748616 0.6468086 0.39835432 0.64720863 0.34897834 0.64760864 0.29937443 0.64800864 0.24958897 0.64840865 0.19963829 0.64880866 0.14956148 0.64920866 9.9397816e-2 0.6496087 4.9163744e-2 0.6500087 -1.0937531e-3 0.6504087 -5.135819e-2 0.6508087 -0.10158256 0.6512087 -0.15175039 0.6516087 -0.20181474 0.6520087 -0.25175923 0.6524087 -0.30153713 0.6528087 -0.3511321 0.65320873 -0.40049776 0.65360874 -0.44961792 0.65400875 -0.49844667 0.65440875 -0.546968 0.65480876 -0.59513646 0.65520877 -0.6429363 0.6556088 -0.69032276 0.6560088 -0.7372804 0.6564088 -0.78376526 0.6568088 -0.82976204 0.6572088 -0.8752278 0.6576088 -0.9201476 0.6580088 -0.9644794 0.6584088 -1.0082086 0.6588088 -1.0512946 0.65920883 -1.0937228 0.65960884 -1.1354539 0.66000885 -1.1764741 0.66040885 -1.216745 0.66080886 -1.2562534 0.66120887 -1.2949624 0.6616089 -1.3328592 0.6620089 -1.3699085 0.6624089 -1.406098 0.6628089 -1.4413939 0.6632089 -1.4757847 0.6636089 -1.5092381 0.6640089 -1.5417433 0.6644089 -1.5732698 0.6648089 -1.6038073 0.66520894 -1.6333271 0.66560894 -1.6618198 0.66600895 -1.6892585 0.66640896 -1.7156342 0.66680896 -1.7409223 0.66720897 -1.7651147 0.667609 -1.7881885 0.668009 -1.8101362 0.668409 -1.8309373 0.668809 -1.850585 0.669209 -1.8690609 0.669609 -1.8863589 0.670009 -1.9024628 0.670409 -1.9173675 0.67080903 -1.9310609 0.67120904 -1.9435326 0.67160904 -1.9547784 0.67200905 -1.964788 0.67240906 -1.9735578 0.67280906 -1.9810799 0.6732091 -1.9873518 0.6736091 -1.9923674 0.6740091 -1.9961252 0.6744091 -1.9986218 0.6748091 -1.9998562 0.6752091 -1.9998274 0.6756091 -1.9985352 0.6760091 -1.995981 0.6764091 -1.9921656 0.67680913 -1.9870925 0.67720914 -1.9807634 0.67760915 -1.9731842 0.67800915 -1.9643575 0.67840916 -1.9542915 0.67880917 -1.9429893 0.6792092 -1.9304618 0.6796092 -1.9167128 0.6800092 -1.9017553 0.6804092 -1.8855944 0.6808092 -1.8682449 0.6812092 -1.8497126 0.6816092 -1.830015 0.6820092 -1.8091582 0.6824092 -1.787162 0.68280923 -1.7640334 0.68320924 -1.7397944 0.68360925 -1.7144526 0.68400925 -1.6880318 0.68440926 -1.6605407 0.68480927 -1.632005 0.6852093 -1.6024339 0.6856093 -1.5718554 0.6860093 -1.5402793 0.6864093 -1.507735 0.6868093 -1.4742335 0.6872093 -1.439806 0.6876093 -1.4044636 0.6880093 -1.3682396 0.6884093 -1.3311459 0.68880934 -1.293217 0.68920934 -1.2544653 0.68960935 -1.2149273 0.69000936 -1.1746159 0.69040936 -1.1335686 0.69080937 -1.0917991 0.6912094 -1.0493463 0.6916094 -1.0062243 0.6920094 -0.9624666 0.6924094 -0.9181076 0.6928094 -0.873162 0.6932094 -0.82767165 0.6936094 -0.78165156 0.6940094 -0.7351448 0.69440943 -0.6881666 0.69480944 -0.6407609 0.69520944 -0.5929432 0.69560945 -0.5447583 0.69600946 -0.49622196 0.69640946 -0.44737956 0.6968095 -0.39824715 0.6972095 -0.34887066 0.6976095 -0.2992663 0.6980095 -0.24948046 0.6984095 -0.19952947 0.6988095 -0.14946003 0.6992095 -9.9288575e-2 0.6996095 -4.9062036e-2 0.7000095 1.2031237e-3 0.70040953 5.1459894e-2 0.70080954 0.10169179 0.70120955 0.15185183 0.70160955 0.20192356 0.70200956 0.25186017 0.70240957 0.30164525 0.7028096 0.35123226 0.7032096 0.4006049 0.7036096 0.44971707 0.7040096 0.4985526 0.7044096 0.54706585 0.7048096 0.59524083 0.7052096 0.6430326 0.7056096 0.69042546 0.7060096 0.73737496 0.70640963 0.78386587 0.70680964 0.8298546 0.70720965 0.87532616 0.70760965 0.9202379 0.70800966 0.96457523 0.70840967 1.0082965 0.7088097 1.0513875 0.7092097 1.093808 0.7096097 1.135544 0.7100097 1.1765563 0.7104097 1.2168318 0.7108097 1.2563325 0.7112097 1.2950457 0.7116097 1.3329351 0.7120097 1.3699881 0.71240973 1.4061702 0.71280974 1.4414697 0.71320975 1.4758533 0.71360976 1.5093099 0.71400976 1.541813 0.71440977 1.5733373 0.7148098 1.6038727 0.7152098 1.6333903 0.7156098 1.6618806 0.7160098 1.689317 0.7164098 1.7156904 0.7168098 1.7409762 0.7172098 1.765166 0.7176098 1.7882375 0.7180098 1.8101827 0.71840984 1.8309813 0.71880984 1.8506265 0.71920985 1.8690997 0.71960986 1.8863952 0.72000986 1.9024966 0.72040987 1.9173986 0.7208099 1.9310874 0.7212099 1.9435583 0.7216099 1.9547999 0.7220099 1.9648083 0.7224099 1.9735743 0.7228099 1.981095 0.7232099 1.9873631 0.7236099 1.9923769 0.72400993 1.9961315 0.72440994 1.9986259 0.72480994 1.9998574 0.72520995 1.999826 0.72560996 1.9985313 0.72600996 1.9959741 0.72641 1.9921566 0.72681 1.9870801 0.72721 1.9807494 0.72761 1.9731665 0.72801 1.9643384 0.72841 1.9542682 0.72881 1.9429651 0.72921 1.9304332 0.72961 1.9166838 0.73001003 1.9017215 0.73041004 1.8855605 0.73081005 1.8682058 0.73121005 1.8496739 0.73161006 1.8299707 0.73201007 1.8091148 0.7324101 1.7871128 0.7328101 1.7639855 0.7332101 1.7397404 0.7336101 1.7144002 0.7340101 1.6879731 0.7344101 1.660484 0.7348101 1.6319417 0.7352101 1.6023731 0.7356101 1.5717877 0.73601013 1.5402094 0.73641014 1.5076631 0.73681015 1.4741596 0.73721015 1.43973 0.73761016 1.4043858 0.73801017 1.3681599 0.7384102 1.3310642 0.7388102 1.2931335 0.7392102 1.2543802 0.7396102 1.2148404 0.7400102 1.1745274 0.7404102 1.1334785 0.7408102 1.0917075 0.7412102 1.0492532 0.7416102 1.0061299 0.74201024 0.9623774 0.74241024 0.9180105 0.74281025 0.8730704 0.74321026 0.82757205 0.74361026 0.7815579 0.74401027 0.7350431 0.7444103 0.6880711 0.7448103 0.6406573 0.7452103 0.59284604 0.7456103 0.54465306 0.7460103 0.49612337 0.7464103 0.44727296 0.7468103 0.39814743 0.7472103 0.34876296 0.74761033 0.2991657 0.74801034 0.24937195 0.74841034 0.19942823 0.74881035 0.14935096 0.74921036 9.9186964e-2 0.74961036 4.89527e-2 0.7500104 -1.3048649e-3 0.7504104 -5.156923e-2 0.7508104 -0.10179339 0.7512104 -0.15196088 0.7516104 -0.20202479 0.7520104 -0.25196865 0.7524104 -0.30174583 0.7528104 -0.3513399 0.7532104 -0.4007046 0.75361043 -0.44982365 0.75401044 -0.49865112 0.75441045 -0.54717106 0.75481045 -0.595338 0.75521046 -0.6431362 0.75561047 -0.69052094 0.7560105 -0.73747665 0.7564105 -0.78395945 0.7568105 -0.82995415 0.7572105 -0.87541765 0.7576105 -0.92033505 0.7580105 -0.964671 0.7584105 -1.008391 0.7588105 -1.0514807 0.7592105 -1.0938996 0.75961053 -1.1356341 0.76001054 -1.1766448 0.76041055 -1.2169186 0.76081055 -1.2564176 0.76121056 -1.2951291 0.76161057 -1.3330166 0.7620106 -1.3700678 0.7624106 -1.4062481 0.7628106 -1.4415455 0.7632106 -1.4759271 0.7636106 -1.5093817 0.7640106 -1.5418777 0.7644106 -1.5734049 0.7648106 -1.6039335 0.7652106 -1.6334534 0.76561064 -1.6619372 0.76601064 -1.6893755 0.76641065 -1.7157427 0.76681066 -1.74103 0.76721066 -1.765214 0.76761067 -1.7882864 0.7680107 -1.810226 0.7684107 -1.8310252 0.7688107 -1.850665 0.7692107 -1.8691386 0.7696107 -1.886429 0.7700107 -1.9025303 0.7704107 -1.9174275 0.7708107 -1.9311159 0.77121073 -1.9435823 0.77161074 -1.954823 0.77201074 -1.9648273 0.77241075 -1.973592 0.77281076 -1.9811089 0.77321076 -1.9873754 0.7736108 -1.9923857 0.7740108 -1.9961383 0.7744108 -1.9986296 0.7748108 -1.9998587 0.7752108 -1.9998245 0.7756108 -1.9985272 0.7760108 -1.9959676 0.7764108 -1.9921468 0.7768108 -1.9870685 0.77721083 -1.9807342 0.77761084 -1.9731498 0.77801085 -1.9643178 0.77841085 -1.9542465 0.77881086 -1.9429393 0.77921087 -1.9304066 0.7796109 -1.9166526 0.7800109 -1.9016876 0.7804109 -1.885524 0.7808109 -1.8681668 0.7812109 -1.8496323 0.7816109 -1.8299266 0.7820109 -1.8090682 0.7824109 -1.7870637 0.7828109 -1.763934 0.78321093 -1.7396865 0.78361094 -1.7143439 0.78401095 -1.6879145 0.78441095 -1.660423 0.78481096 -1.6318785 0.78521097 -1.6023077 0.785611 -1.5717201 0.786011 -1.5401446 0.786411 -1.5075914 0.786811 -1.4740908 0.787211 -1.4396541 0.787611 -1.4043133 0.788011 -1.3680801 0.788411 -1.3309883 0.788811 -1.29305 0.78921103 -1.254301 0.78961104 -1.2147536 0.79001105 -1.174445 0.79041106 -1.1333884 0.79081106 -1.0916222 0.79121107 -1.0491601 0.7916111 -1.0060419 0.7920111 -0.9622815 0.7924111 -0.91792005 0.7928111 -0.872972 0.7932111 -0.8274794 0.7936111 -0.78145725 0.7940111 -0.73494846 0.7944111 -0.6879684 0.7948111 -0.6405609 0.79521114 -0.5927416 0.79561114 -0.5445552 0.79601115 -0.49601743 0.79641116 -0.4471738 0.79681116 -0.39804026 0.79721117 -0.3486628 0.7976112 -0.29905757 0.7980112 -0.24927099 0.7984112 -0.1993194 0.7988112 -0.14924951 0.7992112 -9.9077724e-2 0.7996112 -4.8850987e-2 0.8000112 1.4142354e-3 0.8004112 5.1670935e-2 0.80081123 0.10190263 0.80121124 0.15206233 0.80161124 0.2021336 0.80201125 0.25207716 0.80241126 0.30185392 0.80281126 0.35144758 0.8032113 0.40081176 0.8036113 0.44993022 0.8040113 0.49875703 0.8044113 0.5472762 0.8048113 0.5954424 0.8052113 0.64323974 0.8056113 0.6906236 0.8060113 0.73757833 0.8064113 0.7840601 0.80681133 0.8300536 0.80721134 0.87551594 0.80761135 0.92043215 0.80801135 0.9647601 0.80841136 1.0084854 0.80881137 1.0515672 0.8092114 1.0939912 0.8096114 1.1357177 0.8100114 1.1767333 0.8104114 1.2169993 0.8108114 1.2565027 0.8112114 1.2952065 0.8116114 1.3330982 0.8120114 1.370142 0.8124114 1.4063258 0.81281143 1.441616 0.81321144 1.476001 0.81361145 1.5094484 0.81401145 1.5419475 0.81441146 1.5734677 0.81481147 1.6039988 0.8152115 1.6335121 0.8156115 1.661998 0.8160115 1.68943 0.8164115 1.7157989 0.8168115 1.74108 0.8172115 1.7652653 0.8176115 1.788332 0.8180115 1.8102725 0.8184115 1.8310661 0.81881154 1.8507065 0.81921154 1.8691748 0.81961155 1.8864653 0.82001156 1.9025617 0.82041156 1.9174587 0.82081157 1.9311423 0.8212116 1.9436082 0.8216116 1.9548445 0.8220116 1.9648478 0.8224116 1.9736085 0.8228116 1.9811239 0.8232116 1.9873868 0.8236116 1.9923953 0.8240116 1.9961451 0.82441163 1.9986336 0.82481164 1.99986 0.82521164 1.9998231 0.82561165 1.9985229 0.82601166 1.9959607 0.82641166 1.9921372 0.8268117 1.9870561 0.8272117 1.9807191 0.8276117 1.9731319 0.8280117 1.9642973 0.8284117 1.9542233 0.8288117 1.9429133 0.8292117 1.930378 0.8296117 1.9166213 0.8300117 1.9016562 0.83041173 1.8854876 0.83081174 1.8681304 0.83121175 1.8495907 0.83161175 1.8298856 0.83201176 1.8090215 0.83241177 1.7870181 0.8328118 1.7638824 0.8332118 1.7396363 0.8336118 1.7142875 0.8340118 1.6878599 0.8344118 1.660362 0.8348118 1.6318196 0.8352118 1.6022421 0.8356118 1.5716572 0.8360118 1.5400748 0.83641183 1.5075245 0.83681184 1.4740169 0.83721185 1.4395834 0.83761185 1.4042355 0.83801186 1.3680059 0.83841187 1.3309066 0.8388119 1.2929724 0.8392119 1.2542157 0.8396119 1.2146728 0.8400119 1.1743565 0.8404119 1.1333046 0.8408119 1.0915306 0.8412119 1.0490736 0.8416119 1.0059474 0.8420119 0.96219236 0.84241194 0.9178229 0.84281194 0.8728805 0.84321195 0.8273799 0.84361196 0.7813636 0.84401196 0.7348468 0.84441197 0.6878728 0.844812 0.6404573 0.845212 0.5926444 0.845612 0.5444499 0.846012 0.49591148 0.846412 0.4470672 0.846812 0.39793307 0.847212 0.3485551 0.847612 0.29894942 0.84801203 0.24916248 0.84841204 0.19921057 0.84881204 0.14914043 0.84921205 9.896849e-2 0.84961206 4.874165e-2 0.85001206 -1.5236059e-3 0.8504121 -5.1780272e-2 0.8508121 -0.10201185 0.8512121 -0.15217139 0.8516121 -0.2022424 0.8520121 -0.25217807 0.8524121 -0.30196205 0.8528121 -0.35154775 0.8532121 -0.4009189 0.8536121 -0.45002934 0.85401213 -0.49886295 0.85441214 -0.54737407 0.85481215 -0.5955468 0.85521215 -0.64333606 0.85561216 -0.6907262 0.85601217 -0.73767287 0.8564122 -0.78416073 0.8568122 -0.8301462 0.8572122 -0.8756143 0.8576122 -0.92052245 0.8580122 -0.9648559 0.8584122 -1.0085733 0.8588122 -1.0516602 0.8592122 -1.0940763 0.8596122 -1.1358078 0.86001223 -1.1768155 0.86041224 -1.2170861 0.86081225 -1.2565819 0.86121225 -1.2952899 0.86161226 -1.333174 0.86201227 -1.3702216 0.8624123 -1.4063982 0.8628123 -1.4416919 0.8632123 -1.4760696 0.8636123 -1.5095202 0.8640123 -1.5420122 0.8644123 -1.5735352 0.8648123 -1.6040595 0.8652123 -1.6335752 0.8656123 -1.6620547 0.86601233 -1.6894885 0.86641234 -1.7158512 0.86681235 -1.7411339 0.86721236 -1.7653131 0.86761236 -1.788381 0.86801237 -1.810319 0.8684124 -1.8311101 0.8688124 -1.850748 0.8692124 -1.8692137 0.8696124 -1.8865017 0.8700124 -1.9025954 0.8704124 -1.9174898 0.8708124 -1.9311707 0.8712124 -1.9436339 0.8716124 -1.9548676 0.87201244 -1.9648682 0.87241244 -1.9736263 0.87281245 -1.9811388 0.87321246 -1.9873991 0.87361246 -1.9924048 0.8740125 -1.9961514 0.8744125 -1.9986377 0.8748125 -1.9998612 0.8752125 -1.9998217 0.8756125 -1.9985191 0.8760125 -1.9959537 0.8764125 -1.9921283 0.8768125 -1.9870437 0.8772125 -1.9807049 0.87761253 -1.973114 0.87801254 -1.9642781 0.87841254 -1.9542 0.87881255 -1.9428892 0.87921256 -1.9303493 0.87961257 -1.9165922 0.8800126 -1.9016223 0.8804126 -1.8854536 0.8808126 -1.8680915 0.8812126 -1.849552 0.8816126 -1.8298414 0.8820126 -1.8089781 0.8824126 -1.786969 0.8828126 -1.7638345 0.8832126 -1.7395823 0.88361263 -1.7142351 0.88401264 -1.6878012 0.88441265 -1.6603053 0.88481265 -1.6317564 0.88521266 -1.6021813 0.88561267 -1.5715896 0.8860127 -1.5400099 0.8864127 -1.5074526 0.8868127 -1.4739481 0.8872127 -1.4395076 0.8876127 -1.404163 0.8880127 -1.3679261 0.8884127 -1.3308307 0.8888127 -1.292889 0.8892127 -1.2541305 0.88961273 -1.2145859 0.89001274 -1.174268 0.89041275 -1.1332145 0.89081275 -1.091439 0.89121276 -1.0489805 0.89161277 -1.0058528 0.8920128 -0.96209645 0.8924128 -0.91772574 0.8928128 -0.8727821 0.8932128 -0.8272803 0.8936128 -0.78126293 0.8940128 -0.734745 0.8944128 -0.6877701 0.8948128 -0.6403537 0.8952128 -0.59253997 0.89561284 -0.54434466 0.89601284 -0.49581292 0.89641285 -0.4469606 0.89681286 -0.39783338 0.89721286 -0.34844738 0.89761287 -0.29884884 0.8980129 -0.24905396 0.8984129 -0.19910935 0.8988129 -0.14903137 0.8992129 -9.886687e-2 0.8996129 -4.863231e-2 0.9000129 1.6253471e-3 0.9004129 5.1889606e-2 0.9008129 0.10211346 0.90121293 0.15228043 0.90161294 0.20234363 0.90201294 0.25228658 0.90241295 0.30206263 0.90281296 0.35165542 0.90321296 0.40101856 0.903613 0.45013592 0.904013 0.49896148 0.904413 0.5474793 0.904813 0.59564394 0.905213 0.64343965 0.905613 0.6908217 0.906013 0.73777455 0.906413 0.7842543 0.906813 0.83024573 0.90721303 0.8757058 0.90761304 0.92061955 0.90801305 0.9649451 0.90841305 1.0086677 0.90881306 1.0517467 0.90921307 1.0941678 0.9096131 1.1358916 0.9100131 1.176904 0.9104131 1.2171669 0.9108131 1.256667 0.9112131 1.2953732 0.9116131 1.3332555 0.9120131 1.3703012 0.9124131 1.4064759 0.9128131 1.4417677 0.91321313 1.4761434 0.91361314 1.5095919 0.91401315 1.542082 0.91441315 1.5736027 0.91481316 1.6041248 0.91521317 1.6336383 0.9156132 1.6621155 0.9160132 1.6895471 0.9164132 1.7159073 0.9168132 1.7411877 0.9172132 1.7653645 0.9176132 1.7884299 0.9180132 1.8103621 0.9184132 1.8311541 0.9188132 1.8507864 0.91921324 1.8692527 0.91961324 1.8865354 0.92001325 1.9026291 0.92041326 1.9175186 0.92081326 1.9311992 0.92121327 1.9436579 0.9216133 1.9548907 0.9220133 1.9648871 0.9224133 1.9736439 0.9228133 1.9811528 0.9232133 1.9874114 0.9236133 1.9924138 0.9240133 1.9961582 0.9244133 1.9986415 0.92481333 1.9998626 0.92521334 1.9998202 0.92561334 1.9985148 0.92601335 1.9959472 0.92641336 1.9921185 0.92681336 1.9870322 0.9272134 1.9806898 0.9276134 1.9730974 0.9280134 1.9642575 0.9284134 1.9541783 0.9288134 1.9428632 0.9292134 1.9303228 0.9296134 1.9165609 0.9300134 1.9015907 0.9304134 1.8854171 0.93081343 1.8680551 0.93121344 1.8495104 0.93161345 1.8298004 0.93201345 1.8089315 0.93241346 1.7869233 0.93281347 1.763783 0.9332135 1.7395283 0.9336135 1.7141788 0.9340135 1.6877425 0.9344135 1.6602443 0.9348135 1.6316931 0.9352135 1.6021158 0.9356135 1.5715219 0.9360135 1.5399401 0.9364135 1.5073807 0.93681353 1.4738742 0.93721354 1.4394317 0.93761355 1.4040852 0.93801355 1.3678463 0.93841356 1.330749 0.93881357 1.2928056 0.9392136 1.2540513 0.9396136 1.214499 0.9400136 1.1741856 0.9404136 1.1331244 0.9408136 1.0913537 0.9412136 1.0488873 0.9416136 1.0057648 0.9420136 0.96200055 0.9424136 0.9176353 0.94281363 0.8726837 0.94321364 0.82718766 0.94361365 0.78116226 0.94401366 0.73465043 0.94441366 0.6876674 0.94481367 0.6402573 0.9452137 0.5924355 0.9456137 0.5442468 0.9460137 0.49570695 0.9464137 0.44686142 0.9468137 0.39772618 0.9472137 0.3483472 0.9476137 0.29874068 0.9480137 0.248953 0.9484137 0.19900051 0.94881374 0.14892991 0.94921374 9.875764e-2 0.94961375 4.8530597e-2 0.95001376 -1.7347175e-3 0.95041376 -5.199131e-2 0.9508138 -0.10222269 0.9512138 -0.15238188 0.9516138 -0.20245244 0.9520138 -0.25238752 0.9524138 -0.30217075 0.9528138 -0.35175556 0.9532138 -0.40112573 0.9536138 -0.45023504 0.9540138 -0.4990674 0.95441383 -0.54757714 0.95481384 -0.5957483 0.95521384 -0.6435432 0.95561385 -0.69092435 0.95601386 -0.7378762 0.95641387 -0.7843549 0.9568139 -0.8303452 0.9572139 -0.87580407 0.9576139 -0.92071664 0.9580139 -0.96504086 0.9584139 -1.0087622 0.9588139 -1.0518397 0.9592139 -1.0942594 0.9596139 -1.1359816 0.9600139 -1.1769924 0.96041393 -1.2172537 0.96081394 -1.2567521 0.96121395 -1.2954508 0.96161395 -1.333337 0.96201396 -1.3703754 0.96241397 -1.4065537 0.962814 -1.4418381 0.963214 -1.4762172 0.963614 -1.5096587 0.964014 -1.5421516 0.964414 -1.5736655 0.964814 -1.6041901 0.965214 -1.633697 0.965614 -1.6621763 0.966014 -1.6896015 0.96641403 -1.7159635 0.96681404 -1.7412378 0.96721405 -1.7654159 0.96761405 -1.7884754 0.96801406 -1.8104086 0.96841407 -1.8311951 0.9688141 -1.8508279 0.9692141 -1.8692888 0.9696141 -1.8865718 0.9700141 -1.9026605 0.9704141 -1.9175497 0.9708141 -1.9312257 0.9712141 -1.9436836 0.9716141 -1.9549122 0.9720141 -1.9649075 0.97241414 -1.9736603 0.97281414 -1.9811678 0.97321415 -1.9874227 0.97361416 -1.9924232 0.97401416 -1.9961646 0.97441417 -1.9986454 0.9748142 -1.9998637 0.9752142 -1.9998188 0.9756142 -1.9985108 0.9760142 -1.9959403 0.9764142 -1.9921095 0.9768142 -1.9870197 0.9772142 -1.9806746 0.9776142 -1.9730796 0.97801423 -1.964237 0.97841424 -1.9541551 0.97881424 -1.9428372 0.97921425 -1.9302942 0.97961426 -1.9165297 0.98001426 -1.9015568 0.9804143 -1.8853806 0.9808143 -1.868016 0.9812143 -1.8494687 0.9816143 -1.8297563 0.9820143 -1.8088849 0.9824143 -1.7868742 0.9828143 -1.7637314 0.9832143 -1.7394781 0.9836143 -1.7141224 0.98401433 -1.6876879 0.98441434 -1.6601833 0.98481435 -1.6316344 0.98521435 -1.6020503 0.98561436 -1.5714589 0.98601437 -1.5398703 0.9864144 -1.5073138 0.9868144 -1.4738003 0.9872144 -1.439361 0.9876144 -1.4040072 0.9880144 -1.3677721 0.9884144 -1.3306674 0.9888144 -1.292728 0.9892144 -1.2539661 0.9896144 -1.2144182 0.99001443 -1.1740971 0.99041444 -1.1330405 0.99081445 -1.0912621 0.99121445 -1.0488007 0.99161446 -1.0056703 0.99201447 -0.9619114 0.9924145 -0.91753817 0.9928145 -0.87259215 0.9932145 -0.8270881 0.9936145 -0.78106856 0.9940145 -0.7345487 0.9944145 -0.6875719 0.9948145 -0.6401537 0.9952145 -0.5923383 0.9956145 -0.54414153 0.99601454 -0.4956084 0.99641454 -0.4467548 0.99681455 -0.39762646 0.99721456 -0.3482395 0.99761456 -0.29864007 0.99801457 -0.24884449 0.9984146 -0.19889928 0.9988146 -0.14882085 0.9992146 -9.86484e-2 0.9996146 -4.842126e-2
Gnuplot
0
ocharles/ghc
testsuite/tests/programs/barton-mangler-bug/sine.plt
[ "BSD-3-Clause" ]
: main[ -- ] me @ "Hello world!" notify exit ;
MUF
1
LaudateCorpus1/RosettaCodeData
Task/Hello-world-Text/MUF/hello-world-text.muf
[ "Info-ZIP" ]
import tkinter as tk root = tk.Tk() root.geometry("400x260+50+50") root.title("Welcome to Letter Counter App") message1 = tk.StringVar() Letter1 = tk.StringVar() def printt(): message=message1.get() letter=Letter1.get() message = message.lower() letter = letter.lower() # Get the count and display results. letter_count = message.count(letter) a = "your message has " + str(letter_count) + " " + letter + "'s in it." labl = tk.Label(root,text=a,font=('arial',15),fg='black').place(x=10,y=220) lbl = tk.Label(root,text="Enter the Message--",font=('Ubuntu',15),fg='black').place(x=10,y=10) lbl1 = tk.Label(root,text="Enter the Letter you want to count--",font=('Ubuntu',15),fg='black').place(x=10,y=80) E1= tk.Entry(root,font=("arial",15),textvariable=message1,bg="white",fg="black").place(x=10,y=40,height=40,width=340) E2= tk.Entry(root,font=("arial",15),textvariable=Letter1,bg="white",fg="black").place(x=10,y=120,height=40,width=340) but = tk.Button(root,text="Check",command=printt,cursor="hand2",font=("Times new roman",30),fg="white",bg="black").place(x=10,y=170,height=40,width=380) # print("In this app, I will count the number of times that a specific letter occurs in a message.") # message = input("\nPlease enter a message: ") # letter = input("Which letter would you like to count the occurrences of?: ") root.mainloop()
Python
4
nicetone/Python
Letter_Counter.py
[ "MIT" ]
from typing import Dict from fastapi import FastAPI app = FastAPI() @app.post("/index-weights/") async def create_index_weights(weights: Dict[int, float]): return weights
Python
4
Aryabhata-Rootspring/fastapi
docs_src/body_nested_models/tutorial009.py
[ "MIT" ]
global function PrependControllerPrompts // Returns the string that gets turned into a controller prompt image in the front-end string function ControllerButtonToStr( int buttonID ) { switch (buttonID) { case BUTTON_Y: return "%[Y_BUTTON|]%" case BUTTON_X: return "%[X_BUTTON|]%" } unreachable } string function PrependControllerPrompts( int buttonID, string localizationKey ) { return ControllerButtonToStr( buttonID ) + " " + Localize(localizationKey) }
Squirrel
4
lapaxx/NorthstarMods
Northstar.Client/mod/scripts/vscripts/ui/controller_prompts.nut
[ "MIT" ]
(***********************************************************************) (* *) (* ATS/contrib/atshwxi *) (* *) (***********************************************************************) (* ** Copyright (C) 2013 Hongwei Xi, ATS Trustful Software, Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and associated documentation files (the "Software"), ** to deal in the Software without restriction, including without limitation ** the rights to use, copy, modify, merge, publish, distribute, sublicense, ** and/or sell copies of the Software, and to permit persons to whom the ** Software is furnished to do so, subject to the following stated conditions: ** ** The above copyright notice and this permission notice shall be included in ** all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ** FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS ** IN THE SOFTWARE. *) // Source: https://github.com/githwxi/ATS-Postiats-contrib/blob/04a984d9c08c1831f7dda8a05ce356db01f81850/contrib/libats-/hwxi/intinf/DATS/intinf_vt.dats (* ****** ****** *) // // Author: Hongwei Xi // Authoremail: hwxi AT gmail DOT com // Start Time: April, 2013 // (* ****** ****** *) #include "share/atspre_define.hats" (* ****** ****** *) staload UN = "prelude/SATS/unsafe.sats" (* ****** ****** *) staload GMP = "{$LIBGMP}/SATS/gmp.sats" (* ****** ****** *) vtypedef mpz = $GMP.mpz_vt0ype (* ****** ****** *) // staload "./../SATS/intinf.sats" staload "./../SATS/intinf_vt.sats" // (* ****** ****** *) macdef i2u (x) = g1int2uint_int_uint (,(x)) (* ****** ****** *) local assume intinf_vtype (i: int) = // HX: [i] is a fake [l:addr] (mpz @ l, mfree_gc_v (l) | ptr l) // end of [intinf_vtype] in (* in of [local] *) implement{} intinf_make_int (i) = (x) where { // val x = ptr_alloc<mpz> () val () = $GMP.mpz_init_set_int (!(x.2), i) // } (* end of [intinf_make_int] *) implement{} intinf_make_uint (i) = (x) where { // val x = ptr_alloc<mpz> () val () = $GMP.mpz_init_set_uint (!(x.2), i) // } (* end of [intinf_make_uint] *) implement{} intinf_make_lint (i) = (x) where { // val x = ptr_alloc<mpz> () val () = $GMP.mpz_init_set_lint (!(x.2), i) // } (* end of [intinf_make_lint] *) implement{} intinf_make_ulint (i) = (x) where { // val x = ptr_alloc<mpz> () val () = $GMP.mpz_init_set_ulint (!(x.2), i) // } (* end of [intinf_make_ulint] *) (* ****** ****** *) implement{} intinf_free (x) = let val (pfat, pfgc | p) = x val () = $GMP.mpz_clear (!p) in ptr_free (pfgc, pfat | p) end (* end of [intinf_free] *) (* ****** ****** *) implement{} intinf_get_int (x) = $GMP.mpz_get_int (!(x.2)) implement{} intinf_get_lint (x) = $GMP.mpz_get_lint (!(x.2)) (* ****** ****** *) implement{} intinf_get_strptr (x, base) = $GMP.mpz_get_str_null (base, !(x.2)) // end of [intinf_get_strptr] (* ****** ****** *) implement{} fprint_intinf_base (out, x, base) = let val nsz = $GMP.mpz_out_str (out, base, !(x.2)) in // if (nsz = 0) then exit_errmsg (1, "libgmp/gmp: fprint_intinf_base") // end of [if] // end (* fprint_intinf_base *) (* ****** ****** *) implement{ } neg_intinf0 (x) = (x) where { // val () = $GMP.mpz_neg (!(x.2)) // } (* end of [neg_intinf0] *) implement{ } neg_intinf1 (x) = (y) where { // val y = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(y.2)) val () = $GMP.mpz_neg (!(y.2), !(x.2)) // } (* end of [neg_intinf1] *) (* ****** ****** *) implement{ } abs_intinf0 (x) = (x) where { // val () = $GMP.mpz_abs (!(x.2)) // } (* end of [abs_intinf0] *) implement{ } abs_intinf1 (x) = (y) where { // val y = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(y.2)) val () = $GMP.mpz_abs (!(y.2), !(x.2)) // } (* end of [abs_intinf1] *) (* ****** ****** *) implement{} succ_intinf0 (x) = add_intinf0_int (x, 1) implement{} succ_intinf1 (x) = add_intinf1_int (x, 1) (* ****** ****** *) implement{} pred_intinf0 (x) = sub_intinf0_int (x, 1) implement{} pred_intinf1 (x) = sub_intinf1_int (x, 1) (* ****** ****** *) implement{} add_intinf0_int (x, y) = (x) where { // val () = $GMP.mpz_add2_int (!(x.2), y) // } (* end of [add_intinf0_int] *) implement{} add_intinf1_int (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_add3_int (!(z.2), !(x.2), y) // } (* end of [add_intinf1_int] *) (* ****** ****** *) implement{} add_int_intinf0 (x, y) = add_intinf0_int (y, x) implement{} add_int_intinf1 (x, y) = add_intinf1_int (y, x) (* ****** ****** *) implement{} add_intinf0_intinf1 (x, y) = (x) where { // val () = $GMP.mpz_add2_mpz (!(x.2), !(y.2)) // } (* end of [add_intinf0_intinf1] *) implement{} add_intinf1_intinf0 (x, y) = (y) where { // val () = $GMP.mpz_add2_mpz (!(y.2), !(x.2)) // } (* end of [add_intinf1_intinf0] *) (* ****** ****** *) implement{} add_intinf1_intinf1 (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_add3_mpz (!(z.2), !(x.2), !(y.2)) // } (* end of [add_intinf1_intinf1] *) (* ****** ****** *) implement{} sub_intinf0_int (x, y) = (x) where { // val () = $GMP.mpz_sub2_int (!(x.2), y) // } (* end of [sub_intinf0_int] *) implement{} sub_intinf1_int (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_sub3_int (!(z.2), !(x.2), y) // } (* end of [sub_intinf1_int] *) (* ****** ****** *) implement{} sub_int_intinf0 (x, y) = let val z = sub_intinf0_int (y, x) in neg_intinf0 (z) end (* end of [sub_int_intinf0] *) implement{} sub_int_intinf1 (x, y) = let val z = sub_intinf1_int (y, x) in neg_intinf0 (z) end (* end of [sub_int_intinf1] *) (* ****** ****** *) implement{} sub_intinf0_intinf1 (x, y) = (x) where { // val () = $GMP.mpz_sub2_mpz (!(x.2), !(y.2)) // } (* end of [sub_intinf0_intinf1] *) implement{} sub_intinf1_intinf0 (x, y) = neg_intinf0 (sub_intinf0_intinf1 (y, x)) // end of [sub_intinf1_intinf0] implement{} sub_intinf1_intinf1 (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_sub3_mpz (!(z.2), !(x.2), !(y.2)) // } (* end of [sub_intinf1_intinf1] *) (* ****** ****** *) implement{} mul_intinf0_int (x, y) = (x) where { // val () = $GMP.mpz_mul2_int (!(x.2), y) // } (* end of [mul_intinf0_int] *) implement{} mul_intinf1_int (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_mul3_int (!(z.2), !(x.2), y) // } (* end of [mul_intinf1_int] *) (* ****** ****** *) implement{} mul_int_intinf0 (x, y) = mul_intinf0_int (y, x) implement{} mul_int_intinf1 (x, y) = mul_intinf1_int (y, x) (* ****** ****** *) implement{} mul_intinf0_intinf1 (x, y) = (x) where { // val () = $GMP.mpz_mul2_mpz (!(x.2), !(y.2)) // } (* end of [mul_intinf0_intinf1] *) implement{} mul_intinf1_intinf0 (x, y) = (y) where { // val () = $GMP.mpz_mul2_mpz (!(y.2), !(x.2)) // } (* end of [mul_intinf0_intinf1] *) (* ****** ****** *) implement{} mul_intinf1_intinf1 (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_mul3_mpz (!(z.2), !(x.2), !(y.2)) // } (* end of [mul_intinf1_intinf1] *) (* ****** ****** *) implement{} div_intinf0_int {i,j} (x, y) = let in // if y >= 0 then let val () = $GMP.mpz_tdiv2_q_uint (!(x.2), i2u(y)) in x end else let val () = $GMP.mpz_tdiv2_q_uint (!(x.2), i2u(~y)) in neg_intinf0 (x) end // end of [if] // end (* end of [div_intinf0_int] *) implement{} div_intinf1_int {i,j} (x, y) = let // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) // in // if y >= 0 then let val () = $GMP.mpz_tdiv3_q_uint (!(z.2), !(x.2), i2u(y)) in z end else let val () = $GMP.mpz_tdiv3_q_uint (!(z.2), !(x.2), i2u(~y)) in neg_intinf0 (z) end // end of [if] // end (* end of [div_intinf1_int] *) (* ****** ****** *) implement{} div_intinf0_intinf1 (x, y) = (x) where { // val () = $GMP.mpz_tdiv2_q_mpz (!(x.2), !(y.2)) // } (* end of [div_intinf0_intinf1] *) (* ****** ****** *) implement{} div_intinf1_intinf1 (x, y) = (z) where { // val z = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(z.2)) val () = $GMP.mpz_tdiv3_q_mpz (!(z.2), !(x.2), !(y.2)) // } (* end of [div_intinf1_intinf1] *) (* ****** ****** *) implement{} ndiv_intinf0_int (x, y) = div_intinf0_int (x, y) implement{} ndiv_intinf1_int (x, y) = div_intinf1_int (x, y) (* ****** ****** *) implement{} nmod_intinf0_int {i,j} (x, y) = let // val r = $GMP.mpz_fdiv_uint (!(x.2), i2u(y)) val () = intinf_free (x) // in $UN.cast{intBtw(0,j)}(r) end (* end of [nmod_intinf0_int] *) implement{} nmod_intinf1_int {i,j} (x, y) = let // val r = $GMP.mpz_fdiv_uint (!(x.2), i2u(y)) // in $UN.cast{intBtw(0,j)}(r) end (* end of [nmod_intinf1_int] *) (* ****** ****** *) // // comparison-functions // (* ****** ****** *) implement{} lt_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val ans = (if sgn < 0 then true else false): bool // in $UN.cast{bool(i < j)}(sgn) end // end of [lt_intinf_int] implement{} lt_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val ans = (if sgn < 0 then true else false): bool // in $UN.cast{bool(i < j)}(sgn) end // end of [lt_intinf_intinf] (* ****** ****** *) implement{} lte_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val ans = (if sgn <= 0 then true else false): bool // in $UN.cast{bool(i <= j)}(sgn) end // end of [lte_intinf_int] implement{} lte_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val ans = (if sgn <= 0 then true else false): bool // in $UN.cast{bool(i <= j)}(sgn) end // end of [lte_intinf_intinf] (* ****** ****** *) implement{} gt_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val ans = (if sgn > 0 then true else false): bool // in $UN.cast{bool(i > j)}(sgn) end // end of [gt_intinf_int] implement{} gt_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val ans = (if sgn > 0 then true else false): bool // in $UN.cast{bool(i > j)}(sgn) end // end of [gt_intinf_intinf] (* ****** ****** *) implement{} gte_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val ans = (if sgn >= 0 then true else false): bool // in $UN.cast{bool(i >= j)}(sgn) end // end of [gte_intinf_int] implement{} gte_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val ans = (if sgn >= 0 then true else false): bool // in $UN.cast{bool(i >= j)}(sgn) end // end of [gte_intinf_intinf] (* ****** ****** *) implement{} eq_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val ans = (if sgn = 0 then true else false): bool // in $UN.cast{bool(i == j)}(sgn) end // end of [eq_intinf_int] implement{} eq_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val ans = (if sgn = 0 then true else false): bool // in $UN.cast{bool(i == j)}(sgn) end // end of [eq_intinf_intinf] (* ****** ****** *) implement{} neq_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val ans = (if sgn != 0 then true else false): bool // in $UN.cast{bool(i != j)}(sgn) end // end of [neq_intinf_int] implement{} neq_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val ans = (if sgn != 0 then true else false): bool // in $UN.cast{bool(i != j)}(sgn) end // end of [neq_intinf_intinf] (* ****** ****** *) implement{} compare_intinf_int {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(x.2), y) val sgn = (if sgn < 0 then ~1 else (if sgn > 0 then 1 else 0)): int // in $UN.cast{int(sgn(i-j))}(sgn) end // end of [compare_intinf_int] implement{} compare_int_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_int (!(y.2), x) val sgn = (if sgn > 0 then ~1 else (if sgn < 0 then 1 else 0)): int // in $UN.cast{int(sgn(i-j))}(sgn) end // end of [compare_int_intinf] implement{} compare_intinf_intinf {i,j} (x, y) = let // val sgn = $GMP.mpz_cmp_mpz (!(x.2), !(y.2)) val sgn = (if sgn < 0 then ~1 else (if sgn > 0 then 1 else 0)): int // in $UN.cast{int(sgn(i-j))}(sgn) end // end of [compare_intinf_intinf] (* ****** ****** *) implement{} pow_intinf_int (base, exp) = r where { // val r = ptr_alloc<mpz> () val () = $GMP.mpz_init (!(r.2)) val () = $GMP.mpz_pow_uint (!(r.2), !(base.2), i2u(exp)) // } (* end of [pow_intinf_int] *) (* ****** ****** *) end // end of [local] (* ****** ****** *) implement{} print_intinf (x) = fprint_intinf (stdout_ref, x) implement{} prerr_intinf (x) = fprint_intinf (stderr_ref, x) implement{} fprint_intinf (out, x) = fprint_intinf_base (out, x, 10(*base*)) (* ****** ****** *) (* end of [intinf_vt.dats] *)
ATS
5
JavascriptID/sourcerer-app
src/test/resources/samples/langs/ATS/intinf_vt.dats
[ "MIT" ]
export { default } from './TabsListUnstyled'; export { default as tabsListUnstyledClasses } from './tabsListUnstyledClasses'; export * from './tabsListUnstyledClasses'; export type { default as TabsListUnstyledProps } from './TabsListUnstyledProps'; export { default as useTabsList } from './useTabsList'; export * from './useTabsList';
TypeScript
2
starmarke/starmarke
node_modules/@mui/base/TabsListUnstyled/index.d.ts
[ "MIT" ]
<script name="spf" src="{{ site.baseurl }}/assets/vendor/spf/2.1.1/spf.js"></script> <script name="main" src="{{ site.baseurl }}{{ '/assets/scripts/main.js' | md5_cgi_url }}"></script>
Liquid
2
enterstudio/spfjs
web/includes/scripts.liquid
[ "MIT" ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./RecordInterface.sol"; import "./RestStorage.sol"; import "./UserStorage.sol"; import "./RecordStorage.sol"; import "./AppealStorage.sol"; contract OrderStorage is Ownable { RestStorage private _restStorage; RecordInterface private _recordStorage; UserInterface private _userStorage; AppealInterface private _appealS; address recordAddress; struct Order { address userAddr; uint256 orderNo; uint256 restNo; uint256 coinCount; uint256 orderAmount; uint256 payType; string currencyType; uint256 orderType; uint256 orderStatus; OrderDetail orderDetail; } struct OrderDetail { address buyerAddr; address sellerAddr; string coinType; uint256 price; uint256 tradeTime; uint256 updateTime; string tradeHash; uint256 tradeFee; } mapping(uint256 => Order) private orders; mapping(uint256 => uint256) private orderIndex; Order[] private orderList; mapping(address => mapping(uint256 => uint256)) orderFrozenTotal; uint256 cancelOrderTime = 30; function setCancelOrderTime(uint256 _count) public onlyOwner { cancelOrderTime = _count; } function getCancelOrderTime() public view returns (uint256) { return cancelOrderTime; } event OrderAdd( uint256 _orderNo, uint256 _restNo, uint256 _coinCount, uint256 _tradeFee, uint256 _orderAmount, uint256 _payType, uint256 _orderType, address _buyerAddr, address _sellerAddr ); event OrderUpdateHash(uint256 _orderNo, string _tradeHash); event OrderPaidMoney(uint256 _orderNo); event OrderConfirmCollect(uint256 _orderNo); event OrderCancel(uint256 _orderNo); event OrderUpdateStatus(uint256 _orderNo, uint256 _orderStatus); constructor( address _recordAddr, address _restAddr, address _userAddr ) { _recordStorage = RecordInterface(_recordAddr); _restStorage = RestStorage(_restAddr); _userStorage = UserInterface(_userAddr); recordAddress = _recordAddr; } address _appealCAddr; modifier onlyAuthFromAddr() { require(_appealCAddr != address(0), "Invalid address call order"); _; } function authFromContract(address _fromAppeal) external { require(_appealCAddr == address(0), "appeal address has Auth"); _appealCAddr = _fromAppeal; _appealS = AppealInterface(_appealCAddr); } modifier onlyBuyer(uint256 _orderNo) { require(_orderNo != uint256(0), "orderNo null is not allowed"); require( orders[_orderNo].orderDetail.buyerAddr == msg.sender, "Only buyer can call" ); _; } modifier onlySeller(uint256 _orderNo) { require(_orderNo != uint256(0), "orderNo null is not allowed"); require( orders[_orderNo].orderDetail.sellerAddr == msg.sender, "Only seller can call" ); _; } modifier onlyBuyerOrSeller(uint256 _orderNo) { require(_orderNo != uint256(0), "orderNo null is not allowed"); require( orders[_orderNo].orderDetail.sellerAddr == msg.sender || orders[_orderNo].orderDetail.buyerAddr == msg.sender, "Only buyer or seller can call" ); _; } function _checkParam( uint256 _restNo, uint256 _coinCount, uint256 _orderAmount, uint256 _payType ) internal pure { require( _restNo != uint256(0), "OrderStorage: restNo null is not allowed" ); require(_coinCount > 0, "OrderStorage: coinCount null is not allowed"); require( _orderAmount > 0, "OrderStorage: orderAmount null is not allowed" ); require( _payType != uint256(0), "OrderStorage: payType null is not allowed" ); } function _insert( uint256 _restNo, uint256 _coinCount, uint256 _tradeFee, uint256 _orderAmount, uint256 _payType, uint256 _orderType, address _buyerAddr, address _sellerAddr ) internal returns (uint256 restNo) { _checkParam(_restNo, _coinCount, _orderAmount, _payType); RestStorage.Rest memory _rest = _restStorage.searchRest(_restNo); require(_rest.userAddr != address(0), "rest not exist"); OrderDetail memory _orderDetail = OrderDetail({ buyerAddr: _buyerAddr, sellerAddr: _sellerAddr, coinType: _rest.coinType, price: _rest.price, tradeTime: block.timestamp, updateTime: 0, tradeHash: "", tradeFee: _tradeFee }); uint256 _orderNo = block.timestamp; Order memory order = Order({ userAddr: msg.sender, orderNo: _orderNo, restNo: _restNo, coinCount: _coinCount, orderAmount: _orderAmount, payType: _payType, currencyType: _rest.currencyType, orderType: _orderType, orderStatus: 1, orderDetail: _orderDetail }); orders[_orderNo] = order; orderList.push(order); orderIndex[_orderNo] = orderList.length - 1; if (_orderType == 2) { orderFrozenTotal[msg.sender][_orderNo] = _coinCount; } else if (_orderType == 1) { orderFrozenTotal[_rest.userAddr][_orderNo] = _coinCount; } emit OrderAdd( _orderNo, _restNo, _coinCount, _tradeFee, _orderAmount, _payType, _orderType, _buyerAddr, _sellerAddr ); return _orderNo; } function addBuyOrder( uint256 _restNo, uint256 _coinCount, uint256 _orderAmount, uint256 _payType ) external { RestStorage.Rest memory _rest = _restStorage.searchRest(_restNo); require(_rest.userAddr != msg.sender, "rest not exist"); require(_rest.restType == 2, "sell rest not exist"); require(_coinCount > 0 && _orderAmount > 0, "coin count error"); require(_rest.restStatus == 1, "rest status error"); UserStorage.User memory _currentUser = _userStorage.searchUser( msg.sender ); require( _currentUser.userFlag != 1 && _currentUser.userFlag != 2, "invalid user" ); uint256 _restFrozen = _restStorage.getRestFrozenTotal( _rest.userAddr, _restNo ); require(_restFrozen >= _coinCount, "coin not enough"); uint256 _amo = SafeMath.mul(_rest.price, _coinCount); require( _amo >= _rest.restDetail.limitAmountFrom && _amo <= _rest.restDetail.limitAmountTo, "amount error" ); require( _currentUser.credit >= _rest.restDetail.limitMinCredit, "credit error" ); require( _currentUser.morgageStats.mortgage >= _rest.restDetail.limitMinMortgage, "mortgage error" ); _restStorage.updateRestFinishCount(_restNo, _coinCount); _insert( _restNo, _coinCount, 0, _orderAmount, _payType, 1, msg.sender, _rest.userAddr ); } function addSellOrder( uint256 _restNo, uint256 _coinCount, uint256 _tradeFee, uint256 _orderAmount, uint256 _payType ) external { RestStorage.Rest memory _rest = _restStorage.searchRest(_restNo); require(_rest.userAddr != msg.sender, "rest not exist"); require(_rest.restType == 1, "buy rest not exist"); require(_coinCount > 0 && _tradeFee >= 0, "coin count error"); require(_orderAmount > 0, "orderAmount error"); require(_rest.restStatus == 1, "rest status error"); uint256 _amo = SafeMath.mul(_rest.price, _coinCount); require( _amo >= _rest.restDetail.limitAmountFrom && _amo <= _rest.restDetail.limitAmountTo, "amount error" ); UserStorage.User memory _currentUser = _userStorage.searchUser( msg.sender ); require( _currentUser.userFlag != 1 && _currentUser.userFlag != 2, "invalid user" ); require( _currentUser.credit >= _rest.restDetail.limitMinCredit, "credit error" ); require( _currentUser.morgageStats.mortgage >= _rest.restDetail.limitMinMortgage, "mortgage error" ); uint256 _needSub = SafeMath.add(_coinCount, _tradeFee); _restStorage.updateRestFinishCount(_restNo, _coinCount); _insert( _restNo, _coinCount, _tradeFee, _orderAmount, _payType, 2, _rest.userAddr, msg.sender ); TokenTransfer _tokenTransfer = _recordStorage.setERC20Address( _rest.coinType ); _tokenTransfer.transferFrom(msg.sender, recordAddress, _needSub); _recordStorage.addRecord( msg.sender, "", _rest.coinType, _coinCount, 2, 1, 2 ); } function setPaidMoney(uint256 _orderNo) external onlyBuyer(_orderNo) returns (bool) { _updateOrderStatus(_orderNo, 2); emit OrderPaidMoney(_orderNo); return true; } function confirmCollect(uint256 _orderNo) external onlySeller(_orderNo) { require( _orderNo != uint256(0), "OrderStorage:orderNo null is not allowed" ); Order memory _order = orders[_orderNo]; require(_order.orderStatus == 2, "OrderStorage:Invalid order status"); require( _order.orderDetail.buyerAddr != address(0), "OrderStorage:Invalid buyer address" ); require( orderFrozenTotal[msg.sender][_orderNo] >= _order.coinCount, "OrderStorage:coin not enough" ); _updateOrderStatus(_orderNo, 3); orderFrozenTotal[msg.sender][_orderNo] = 0; uint256 _rc = _recordStorage.getTradeCredit(); UserStorage.User memory _user = _userStorage.searchUser(msg.sender); uint256 _credit = _user.credit + _rc; UserStorage.TradeStats memory _tradeStats = _user.tradeStats; _tradeStats.tradeTotal += 1; _userStorage.updateTradeStats(msg.sender, _tradeStats, _credit); UserStorage.User memory _user2 = _userStorage.searchUser( _order.orderDetail.buyerAddr ); uint256 _credit2 = _user2.credit + _rc; UserStorage.TradeStats memory _tradeStats2 = _user2.tradeStats; _tradeStats2.tradeTotal += 1; _userStorage.updateTradeStats( _order.orderDetail.buyerAddr, _tradeStats2, _credit2 ); _recordStorage.subFrozenTotal(_orderNo, _order.orderDetail.buyerAddr); emit OrderConfirmCollect(_orderNo); } function cancelOrder(uint256 _orderNo) external onlyBuyerOrSeller(_orderNo) returns (bool) { Order memory _order = orders[_orderNo]; require( _order.orderNo != uint256(0), "OrderStorage: current Order not exist" ); require(_order.orderStatus == 1, "Can't cancel order"); require( _order.orderDetail.tradeTime + cancelOrderTime * 1 minutes < block.timestamp, "30 minutes limit" ); RestStorage.Rest memory _rest = _restStorage.searchRest(_order.restNo); if (_rest.restStatus == 4 || _rest.restStatus == 5) { orderFrozenTotal[_order.orderDetail.sellerAddr][_orderNo] = 0; _recordStorage.addAvailableTotal( _order.orderDetail.sellerAddr, _order.orderDetail.coinType, _order.coinCount ); } else { if (_order.orderType == 2) { orderFrozenTotal[_order.orderDetail.sellerAddr][_orderNo] = 0; _recordStorage.addAvailableTotal( _order.orderDetail.sellerAddr, _order.orderDetail.coinType, _order.coinCount ); } _restStorage.addRestRemainCount(_order.restNo, _order.coinCount); } _updateOrderStatus(_orderNo, 4); emit OrderCancel(_orderNo); return true; } function takeCoin(uint256 _o) external onlyBuyerOrSeller(_o) { AppealStorage.Appeal memory _appeal = _appealS.searchAppeal(_o); require( block.timestamp - _appeal.detail.witnessHandleTime > 24 hours, "time error" ); address _win; if (_appeal.user == _appeal.buyer) { if (_appeal.status == 2) { _win = _appeal.buyer; } else if (_appeal.status == 3) { _win = _appeal.seller; } } else { if (_appeal.status == 2) { _win = _appeal.seller; } else if (_appeal.status == 3) { _win = _appeal.buyer; } } require(_win == msg.sender, "opt error"); _updateOrderStatus(_o, 5); orderFrozenTotal[_appeal.seller][_o] = 0; _recordStorage.subFrozenTotal(_o, msg.sender); } function _updateOrderStatus(uint256 _orderNo, uint256 _orderStatus) internal onlyBuyerOrSeller(_orderNo) { Order memory order = orders[_orderNo]; require( order.orderNo != uint256(0), "OrderStorage: current Order not exist" ); require(_orderStatus >= 1 && _orderStatus <= 5, "Invalid order status"); if (_orderStatus == 2 && order.orderStatus != 1) { revert("Invalid order status 2"); } if (_orderStatus == 3 && order.orderStatus != 2) { revert("Invalid order status 3"); } if (_orderStatus == 4 && order.orderStatus != 1) { revert("Invalid order status 4"); } if ( _orderStatus == 5 && order.orderStatus != 1 && order.orderStatus != 2 ) { revert("Invalid order status 5"); } if (_orderStatus == 2) { require( order.orderDetail.buyerAddr == msg.sender, "only buyer call" ); } if (_orderStatus == 3) { require( order.orderDetail.sellerAddr == msg.sender, "only seller call" ); } order.orderStatus = _orderStatus; order.orderDetail.updateTime = block.timestamp; orders[_orderNo] = order; orderList[orderIndex[_orderNo]] = order; emit OrderUpdateStatus(_orderNo, _orderStatus); } function _search(uint256 _orderNo) internal view returns (Order memory order) { require( _orderNo != uint256(0), "OrderStorage: orderNo null is not allowed" ); require( orders[_orderNo].orderNo != uint256(0), "OrderStorage: current Order not exist" ); Order memory o = orders[_orderNo]; return o; } function searchOrder(uint256 _orderNo) external view returns (Order memory order) { return _search(_orderNo); } function searchOrderList() external view returns (Order[] memory) { return orderList; } function searchMyOrderList() external view returns (Order[] memory) { Order[] memory resultList = new Order[](orderList.length); for (uint256 i = 0; i < orderList.length; i++) { Order memory _order = orderList[i]; if ( _order.orderDetail.buyerAddr == msg.sender || _order.orderDetail.sellerAddr == msg.sender ) { resultList[i] = _order; } } return resultList; } function searchListByRest(uint256 _restNo) external view returns (Order[] memory) { Order[] memory resultList = new Order[](orderList.length); for (uint256 i = 0; i < orderList.length; i++) { Order memory _order = orderList[i]; if (_order.restNo == _restNo) { resultList[i] = _order; } } return resultList; } }
Solidity
4
Aircoin-official/AirCash
OrderStorage.sol
[ "MIT" ]
import React from 'react'; import {FocusedContentStore, Actions} from 'nylas-exports'; import {FluxContainer} from 'nylas-component-kit'; export default class FocusContainer extends React.Component { static displayName: 'FocusContainer' static propTypes = { children: React.PropTypes.element, collection: React.PropTypes.string, } getStateFromStores = () => { const {collection} = this.props; return { focused: FocusedContentStore.focused(collection), focusedId: FocusedContentStore.focusedId(collection), keyboardCursor: FocusedContentStore.keyboardCursor(collection), keyboardCursorId: FocusedContentStore.keyboardCursorId(collection), onFocusItem: (item) => Actions.setFocus({collection: collection, item: item}), onSetCursorPosition: (item) => Actions.setCursorPosition({collection: collection, item: item}), }; } render() { return ( <FluxContainer {...this.props} stores={[FocusedContentStore]} getStateFromStores={this.getStateFromStores} > {this.props.children} </FluxContainer> ); } }
JSX
4
cnheider/nylas-mail
packages/client-app/src/components/focus-container.jsx
[ "MIT" ]
library: dswank executable: dswank files: library dswank-console-compiler dswank
Dylan
0
kryptine/opendylan
sources/environment/dswank/dswank.lid
[ "BSD-2-Clause" ]
require 'cunn' local EdgeFilter, parent = torch.class('w2nn.EdgeFilter', 'nn.SpatialConvolution') function EdgeFilter:__init(nInputPlane) local output = 0 parent.__init(self, nInputPlane, nInputPlane * 8, 3, 3, 1, 1, 0, 0) end function EdgeFilter:reset() self.bias = nil self.gradBias = nil self.gradWeight:fill(0) self.weight:fill(0) local fi = 1 -- each channel for ch = 1, self.nInputPlane do for i = 0, 8 do y = math.floor(i / 3) + 1 x = i % 3 + 1 if not (y == 2 and x == 2) then self.weight[fi][ch][2][2] = 1 self.weight[fi][ch][y][x] = -1 fi = fi + 1 end end end end function EdgeFilter:accGradParameters(input, gradOutput, scale) end function EdgeFilter:updateParameters(learningRate) end
Lua
4
zhyukun/waifu
lib/EdgeFilter.lua
[ "MIT" ]
module Concourse.BuildStatus exposing ( BuildStatus(..) , decodeBuildStatus , encodeBuildStatus , isBad , isRunning , ordering , show ) import Json.Decode import Json.Encode import Ordering exposing (Ordering) type BuildStatus = BuildStatusPending | BuildStatusStarted | BuildStatusSucceeded | BuildStatusFailed | BuildStatusErrored | BuildStatusAborted ordering : Ordering BuildStatus ordering = Ordering.explicit [ BuildStatusFailed , BuildStatusErrored , BuildStatusAborted , BuildStatusSucceeded , BuildStatusPending ] show : BuildStatus -> String show status = case status of BuildStatusPending -> "pending" BuildStatusStarted -> "started" BuildStatusSucceeded -> "succeeded" BuildStatusFailed -> "failed" BuildStatusErrored -> "errored" BuildStatusAborted -> "aborted" encodeBuildStatus : BuildStatus -> Json.Encode.Value encodeBuildStatus = show >> Json.Encode.string decodeBuildStatus : Json.Decode.Decoder BuildStatus decodeBuildStatus = Json.Decode.string |> Json.Decode.andThen (\status -> case status of "pending" -> Json.Decode.succeed BuildStatusPending "started" -> Json.Decode.succeed BuildStatusStarted "succeeded" -> Json.Decode.succeed BuildStatusSucceeded "failed" -> Json.Decode.succeed BuildStatusFailed "errored" -> Json.Decode.succeed BuildStatusErrored "aborted" -> Json.Decode.succeed BuildStatusAborted unknown -> Json.Decode.fail <| "unknown build status: " ++ unknown ) isRunning : BuildStatus -> Bool isRunning status = case status of BuildStatusPending -> True BuildStatusStarted -> True _ -> False isBad : BuildStatus -> Bool isBad status = case status of BuildStatusPending -> False BuildStatusStarted -> False BuildStatusSucceeded -> False BuildStatusFailed -> True BuildStatusErrored -> True BuildStatusAborted -> False
Elm
5
Caprowni/concourse
web/elm/src/Concourse/BuildStatus.elm
[ "Apache-2.0" ]
--TEST-- Test return values of posix_getgrgid() on MacOSX. --CREDITS-- Till Klampaeckel, till@php.net TestFest Berlin 2009 --EXTENSIONS-- posix --SKIPIF-- <?php if (strtolower(PHP_OS) != 'darwin') { die('SKIP This test requires MacOSX/Darwin.'); } ?> --FILE-- <?php $grp = posix_getgrgid(-1); var_dump($grp['name']); ?> --EXPECT-- string(7) "nogroup"
PHP
4
NathanFreeman/php-src
ext/posix/tests/posix_getgrgid_macosx.phpt
[ "PHP-3.01" ]
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import React from 'react'; import ReactDom from 'react-dom'; import Form from 'react-jsonschema-form'; import { interpolate } from 'src/showSavedQuery/utils'; import './index.less'; const scheduleInfoContainer = document.getElementById('schedule-info'); const bootstrapData = JSON.parse( scheduleInfoContainer.getAttribute('data-bootstrap'), ); const config = bootstrapData.common.conf.SCHEDULED_QUERIES; const { query } = bootstrapData.common; const scheduleInfo = query.extra_json.schedule_info; const linkback = config.linkback ? interpolate(config.linkback, query) : null; if (scheduleInfo && config) { // hide instructions when showing schedule info config.JSONSCHEMA.description = ''; ReactDom.render( <div> <Form schema={config.JSONSCHEMA} uiSchema={config.UISCHEMA} formData={scheduleInfo} disabled > <br /> </Form> {linkback && ( <div className="linkback"> <a href={linkback}> <i className="fa fa-link" /> &nbsp; Pipeline status </a> </div> )} </div>, scheduleInfoContainer, ); }
JSX
5
delorenzosoftware/superset
superset-frontend/src/showSavedQuery/index.jsx
[ "Apache-2.0" ]
CDF xy data `  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG
nesC
0
jhh67/chapel
test/library/packages/NetCDF/simple_xy.nc
[ "ECL-2.0", "Apache-2.0" ]
#!/bin/sh VSCODE_GIT_ASKPASS_PIPE=`mktemp` ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $VSCODE_GIT_ASKPASS_EXTRA_ARGS $* cat $VSCODE_GIT_ASKPASS_PIPE rm $VSCODE_GIT_ASKPASS_PIPE
Shell
3
sbj42/vscode
extensions/git/src/askpass.sh
[ "MIT" ]
#version 310 es layout (local_size_x = 2, local_size_y = 4) in; layout (binding = 0) readonly buffer InBufU { uint data[]; } in_buf_u; layout (binding = 1) readonly buffer InBufV { uint data[]; } in_buf_v; layout (binding = 2) writeonly buffer OutBufU { uint data[]; } out_buf_u; layout (binding = 3) writeonly buffer OutBufV { uint data[]; } out_buf_v; layout (binding = 4) readonly buffer CoordX { vec4 data[]; } coordx; layout (binding = 5) readonly buffer CoordY { vec4 data[]; } coordy; uniform uint in_img_width; uniform uint out_img_width; uniform uint extended_offset; uniform uint coords_width; #define UNIT_SIZE 4u #define unpack_unorm(buf, index) \ { \ vec4 value = unpackUnorm4x8 (buf.data[index00[index]]); \ out00[index] = value[x00_fract[index]]; \ value = (index01[index] == index00[index]) ? value : unpackUnorm4x8 (buf.data[index01[index]]); \ out01[index] = value[x01_fract[index]]; \ value = unpackUnorm4x8 (buf.data[index10[index]]); \ out10[index] = value[x10_fract[index]]; \ value = (index11[index] == index10[index]) ? value : unpackUnorm4x8 (buf.data[index11[index]]); \ out11[index] = value[x11_fract[index]]; \ } void main () { uint coord_pos = gl_GlobalInvocationID.y * coords_width + gl_GlobalInvocationID.x; vec4 in_uv_x = coordx.data[coord_pos]; vec4 in_uv_y = coordy.data[coord_pos]; uvec4 x00 = uvec4 (in_uv_x); uvec4 y00 = uvec4 (in_uv_y); uvec4 x01 = x00 + 1u; uvec4 y01 = y00; uvec4 x10 = x00; uvec4 y10 = y00 + 1u; uvec4 x11 = x01; uvec4 y11 = y10; vec4 fract_x = fract (in_uv_x); vec4 fract_y = fract (in_uv_y); vec4 weight00 = (1.0f - fract_x) * (1.0f - fract_y); vec4 weight01 = fract_x * (1.0f - fract_y); vec4 weight10 = (1.0f - fract_x) * fract_y; vec4 weight11 = fract_x * fract_y; uvec4 x00_floor = x00 >> 2u; // divided by UNIT_SIZE uvec4 x01_floor = x01 >> 2u; uvec4 x10_floor = x10 >> 2u; uvec4 x11_floor = x11 >> 2u; uvec4 x00_fract = x00 % UNIT_SIZE; uvec4 x01_fract = x01 % UNIT_SIZE; uvec4 x10_fract = x10 % UNIT_SIZE; uvec4 x11_fract = x11 % UNIT_SIZE; uvec4 index00 = y00 * in_img_width + x00_floor; uvec4 index01 = y01 * in_img_width + x01_floor; uvec4 index10 = y10 * in_img_width + x10_floor; uvec4 index11 = y11 * in_img_width + x11_floor; // pixel U-value vec4 out00, out01, out10, out11; unpack_unorm (in_buf_u, 0); unpack_unorm (in_buf_u, 1); unpack_unorm (in_buf_u, 2); unpack_unorm (in_buf_u, 3); vec4 inter = out00 * weight00 + out01 * weight01 + out10 * weight10 + out11 * weight11; uint out_pos = gl_GlobalInvocationID.y * out_img_width + extended_offset + gl_GlobalInvocationID.x; out_buf_u.data[out_pos] = packUnorm4x8 (inter); // pixel V-value unpack_unorm (in_buf_v, 0); unpack_unorm (in_buf_v, 1); unpack_unorm (in_buf_v, 2); unpack_unorm (in_buf_v, 3); inter = out00 * weight00 + out01 * weight01 + out10 * weight10 + out11 * weight11; out_buf_v.data[out_pos] = packUnorm4x8 (inter); }
Slash
4
zongwave/libxcam
shaders/glsl/shader_geomap_fastmap_uv_yuv420.comp.sl
[ "Apache-2.0" ]
<%inherit file="/display_base.mako"/> <%def name="javascripts()"> <% config = item_data %> ${parent.javascripts()} <script type='text/javascript'> $(function() { // HACK: add bookmarks container and header. $('#right > .unified-panel-body > div').append( $('<div/>').attr('id', 'bookmarks-container') .append( $('<h4/>').text('Bookmarks') ) ); }); </script> </%def> <%def name="stylesheets()"> ${parent.stylesheets()} ${h.css( "trackster" )} ## Style changes needed for display. <style type="text/css"> .page-body { padding: 0px; } #bookmarks-container { padding-left: 10px; } .bookmark { margin: 0em; } </style> </%def> <%def name="render_item_header( item )"> ## Don't need to show header </%def> <%def name="render_item_links( visualization )"> <a href="${h.url_for( controller='/visualization', action='imp', id=trans.security.encode_id( visualization.id ) )}" class="btn btn-secondary fa fa-plus float-right" title="Import visualization"></a> </%def> <%def name="render_item( visualization, config )"> <div id="${trans.security.encode_id( visualization.id )}" class="unified-panel-body" style="overflow:none;top:0px;"> <iframe frameborder="0" width="100%" height="100%" sandbox="allow-forms allow-same-origin allow-scripts" src="/visualization/saved?id=${encoded_visualization_id}"> </iframe> </div> </%def>
Mako
3
rhpvorderman/galaxy
templates/webapps/galaxy/visualization/display_in_frame.mako
[ "CC-BY-3.0" ]
<article id="entry-<$mt:EntryID$>" class="entry-asset entry asset hentry" itemscope itemType="http://schema.org/BlogPosting"> <div class="asset-header"> <h2 class="asset-name entry-title" itemprop="name"><a href="<$mt:EntryPermalink encode_html="1"$>"><$mt:EntryTitle$></a></h2> <footer class="asset-meta"> <ul class="asset-meta-list"> <li class="asset-meta-list-item"><__trans phrase="Posted on [_1]" params="<time datetime="<$mt:EntryDate format_name="iso8601"$>" itemprop="datePublished"><$mt:EntryDate format="%x"$></time>"></li> <li class="asset-meta-list-item"><__trans phrase="by [_1]" params="<span class="author entry-author vcard"><$mt:EntryAuthorLink show_hcard="1"$></span>"></li> <mt:IfArchiveTypeEnabled archive_type="Category"> <mt:If tag="EntryPrimaryCategory"> <li class="asset-meta-list-item"><__trans phrase="in [_1]" params="<mt:EntryPrimaryCategory><a itemprop="articleSection" rel="tag" href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></mt:EntryPrimaryCategory>"></li> </mt:If> </mt:IfArchiveTypeEnabled> </ul> </footer> </div> <div class="asset-content entry-content" itemprop="articleBody"> <$mt:EntryBody$> </div> <div class="entry-more-link"> <a href="<$mt:EntryPermalink encode_html="1"$>" itemprop="url"><__trans phrase="Continue reading"></a> </div> </article>
MTML
4
movabletype/mt-theme-rainier
themes/rainier/templates/entry_summary.mtml
[ "MIT" ]
%%% -*- Mode: Prolog; -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % $Date: 2011-11-28 14:41:26 +0100 (Mon, 28 Nov 2011) $ % $Revision: 6764 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog % % ProbLog was developed at Katholieke Universiteit Leuven % % Copyright 2009 % Angelika Kimmig, Vitor Santos Costa, Bernd Gutmann % % Main authors of this file: % Bernd Gutmann % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Artistic License 2.0 % % Copyright (c) 2000-2006, The Perl Foundation. % % Everyone is permitted to copy and distribute verbatim copies of this % license document, but changing it is not allowed. Preamble % % This license establishes the terms under which a given free software % Package may be copied, modified, distributed, and/or % redistributed. The intent is that the Copyright Holder maintains some % artistic control over the development of that Package while still % keeping the Package available as open source and free software. % % You are always permitted to make arrangements wholly outside of this % license directly with the Copyright Holder of a given Package. If the % terms of this license do not permit the full use that you propose to % make of the Package, you should contact the Copyright Holder and seek % a different licensing arrangement. Definitions % % "Copyright Holder" means the individual(s) or organization(s) named in % the copyright notice for the entire Package. % % "Contributor" means any party that has contributed code or other % material to the Package, in accordance with the Copyright Holder's % procedures. % % "You" and "your" means any person who would like to copy, distribute, % or modify the Package. % % "Package" means the collection of files distributed by the Copyright % Holder, and derivatives of that collection and/or of those files. A % given Package may consist of either the Standard Version, or a % Modified Version. % % "Distribute" means providing a copy of the Package or making it % accessible to anyone else, or in the case of a company or % organization, to others outside of your company or organization. % % "Distributor Fee" means any fee that you charge for Distributing this % Package or providing support for this Package to another party. It % does not mean licensing fees. % % "Standard Version" refers to the Package if it has not been modified, % or has been modified only in ways explicitly requested by the % Copyright Holder. % % "Modified Version" means the Package, if it has been changed, and such % changes were not explicitly requested by the Copyright Holder. % % "Original License" means this Artistic License as Distributed with the % Standard Version of the Package, in its current version or as it may % be modified by The Perl Foundation in the future. % % "Source" form means the source code, documentation source, and % configuration files for the Package. % % "Compiled" form means the compiled bytecode, object code, binary, or % any other form resulting from mechanical transformation or translation % of the Source form. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Permission for Use and Modification Without Distribution % % (1) You are permitted to use the Standard Version and create and use % Modified Versions for any purpose without restriction, provided that % you do not Distribute the Modified Version. % % Permissions for Redistribution of the Standard Version % % (2) You may Distribute verbatim copies of the Source form of the % Standard Version of this Package in any medium without restriction, % either gratis or for a Distributor Fee, provided that you duplicate % all of the original copyright notices and associated disclaimers. At % your discretion, such verbatim copies may or may not include a % Compiled form of the Package. % % (3) You may apply any bug fixes, portability changes, and other % modifications made available from the Copyright Holder. The resulting % Package will still be considered the Standard Version, and as such % will be subject to the Original License. % % Distribution of Modified Versions of the Package as Source % % (4) You may Distribute your Modified Version as Source (either gratis % or for a Distributor Fee, and with or without a Compiled form of the % Modified Version) provided that you clearly document how it differs % from the Standard Version, including, but not limited to, documenting % any non-standard features, executables, or modules, and provided that % you do at least ONE of the following: % % (a) make the Modified Version available to the Copyright Holder of the % Standard Version, under the Original License, so that the Copyright % Holder may include your modifications in the Standard Version. (b) % ensure that installation of your Modified Version does not prevent the % user installing or running the Standard Version. In addition, the % modified Version must bear a name that is different from the name of % the Standard Version. (c) allow anyone who receives a copy of the % Modified Version to make the Source form of the Modified Version % available to others under (i) the Original License or (ii) a license % that permits the licensee to freely copy, modify and redistribute the % Modified Version using the same licensing terms that apply to the copy % that the licensee received, and requires that the Source form of the % Modified Version, and of any works derived from it, be made freely % available in that license fees are prohibited but Distributor Fees are % allowed. % % Distribution of Compiled Forms of the Standard Version or % Modified Versions without the Source % % (5) You may Distribute Compiled forms of the Standard Version without % the Source, provided that you include complete instructions on how to % get the Source of the Standard Version. Such instructions must be % valid at the time of your distribution. If these instructions, at any % time while you are carrying out such distribution, become invalid, you % must provide new instructions on demand or cease further % distribution. If you provide valid instructions or cease distribution % within thirty days after you become aware that the instructions are % invalid, then you do not forfeit any of your rights under this % license. % % (6) You may Distribute a Modified Version in Compiled form without the % Source, provided that you comply with Section 4 with respect to the % Source of the Modified Version. % % Aggregating or Linking the Package % % (7) You may aggregate the Package (either the Standard Version or % Modified Version) with other packages and Distribute the resulting % aggregation provided that you do not charge a licensing fee for the % Package. Distributor Fees are permitted, and licensing fees for other % components in the aggregation are permitted. The terms of this license % apply to the use and Distribution of the Standard or Modified Versions % as included in the aggregation. % % (8) You are permitted to link Modified and Standard Versions with % other works, to embed the Package in a larger work of your own, or to % build stand-alone binary or bytecode versions of applications that % include the Package, and Distribute the result without restriction, % provided the result does not expose a direct interface to the Package. % % Items That are Not Considered Part of a Modified Version % % (9) Works (including, but not limited to, modules and scripts) that % merely extend or make use of the Package, do not, by themselves, cause % the Package to be a Modified Version. In addition, such works are not % considered parts of the Package itself, and are not subject to the % terms of this license. % % General Provisions % % (10) Any use, modification, and distribution of the Standard or % Modified Versions is governed by this Artistic License. By using, % modifying or distributing the Package, you accept this license. Do not % use, modify, or distribute the Package, if you do not accept this % license. % % (11) If your Modified Version has been derived from a Modified Version % made by someone other than you, you are nevertheless required to % ensure that your Modified Version complies with the requirements of % this license. % % (12) This license does not grant you the right to use any trademark, % service mark, tradename, or logo of the Copyright Holder. % % (13) This license includes the non-exclusive, worldwide, % free-of-charge patent license to make, have made, use, offer to sell, % sell, import and otherwise transfer the Package with respect to any % patent claims licensable by the Copyright Holder that are necessarily % infringed by the Package. If you institute patent litigation % (including a cross-claim or counterclaim) against any party alleging % that the Package constitutes direct or contributory patent % infringement, then this Artistic License to you shall terminate on the % date that such litigation is filed. % % (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT % HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED % WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A % PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT % PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT % HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, % INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE % OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Discrete probability distributions for ProbLog % % this file contains predicates to emulate discrete distributions in ProbLog % % uniform(I,N,ID) % emulates a uniform discrete distribution % P(I) = 1/N for I in {1,2,...,N} % If I is a variable, the predicate backtracks over all % possible values for I % ID has to be ground, it is an identifier which - if in the same proof - % reused, will always return the same value % % binomial(K,N,P,ID) % emulates a binomial distribution % P(K) = (N over K) x P^K x (1-P)^(N-K) for K in {0,1,...,N} % If K is a variable, the predicate backtracks over all % possible values for K % ID has to be ground, it is an identifier which - if in the same proof - % reused, will always return the same value % % poisson(K,Lambda,ID) % emulates a Poisson distribution % P(K) = Lamda^K / K! x exp(-Lambda) for K in {0,1,2, ....} % If K is a variable, the predicate backtracks over all % possible values for K % ID has to be ground, it is an identifier which - if in the same proof - % reused, will always return the same value % % % Author : Bernd Gutmann, bernd.gutmann@cs.kuleuven.be % Version : January 14, 2009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :- module(discrete, [uniform/3,binomial/4,poisson/3]). :- use_module('../problog'). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % A distribution over 1,2, ..., N % where P(I) := 1/N %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Prob::p_uniform(_I,_N,_ID,Prob). uniform(I,N,ID) :- integer(N), N>0, ( var(I) ; integer(I), I>0, I=<N), uniform(1,I,true,N,ID). uniform(I,I,Old,N,ID) :- I=<N, FactProb is 1/(N-I+1), call(Old), p_uniform(I,N,ID,FactProb). uniform(I,I2,Old,N,ID) :- I<N, FactProb is 1/(N-I+1), NextI is I+1, uniform(NextI,I2,(problog_not(p_uniform(I,N,ID,FactProb)),Old),N,ID). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Binomial Distribution % K in { 0,1,2,3, ... } % Lambda >= 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Prob::p_binomial(_K,_N,_P,_ID,Prob). binomial(K,N,P,ID) :- number(P), P >= 0, P =< 1, integer(N), N>=0, ( var(K) ; integer(K),K>=0,K=<N), binomial(0,K,N,P,true,0.0,ID). binomial(K,KResult,N,P,Old,ProbAcc,ID) :- % KResult is a number, make sure, not to go over it % safes some time ( number(KResult) -> K=<KResult; true ), binomial_coefficient(N,K,BinomCoeff), Prob is BinomCoeff * (P ** K) * ((1-P) ** (N-K)), FactProb is Prob / (1-ProbAcc), % this check stops the derivation, if the floating-point-based % rounding errors get too big FactProb > 0.0, FactProb =< 1.0, ( ( call(Old), p_binomial(K,N,P,ID,FactProb), KResult=K ); ( K<N, NextK is K+1, NextProbAcc is ProbAcc+Prob, binomial(NextK,KResult,N,P,(problog_not(p_binomial(K,N,P,ID,FactProb)),Old),NextProbAcc,ID) ) ). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Poisson Distribution % K in { 0,1,2,3, ... } or var(K) % Lambda >= 0 % ID has to be ground %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% P :: p_poisson(_K,_Lambda,_ID,P). poisson(K,Lambda,ID) :- ( var(K); integer(K),K>=0 ), number(Lambda), Lambda>=0, ground(ID), poisson(0,K,true,Lambda,0.0,ID). poisson(K,K2,Old,Lambda,ProbAcc,ID) :- % KResult is a number, make sure, not to go over it % safes some time ( integer(K2) -> K=<K2; true ), power_over_factorial(K,Lambda,Part1), % Prob is P(K) for a Poisson distribution with Lambda Prob is Part1 * exp(-Lambda), % now we have to determine the fact probability % conditioned on the aggregated probabilities so far FactProb is Prob/(1-ProbAcc), % this check stops the derivation, if the floating-point-based % rounding errors get too big FactProb > 0.0, FactProb =< 1.0, ( ( call(Old), p_poisson(K,Lambda,ID,FactProb), K2=K ); ( NextK is K+1, NextProbAcc is ProbAcc+Prob, poisson(NextK,K2,(problog_not(p_poisson(K,Lambda,ID,FactProb)),Old),Lambda,NextProbAcc,ID) ) ). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % calculates (Lambda ** N) / N! power_over_factorial(N,Lambda,Result) :- integer(N), N>=0, power_over_factorial(N,Lambda,1.0,Result). power_over_factorial(N,Lambda,Old,Result) :- ( N>0 -> ( N2 is N-1, New is Old * Lambda/N, power_over_factorial(N2,Lambda,New,Result) ); Result=Old ). % calculates (N \over K) = N!/(K! * (N-K)!) binomial_coefficient(N,K,Result) :- integer(K), K >= 0, binomial_coefficient(K,N,1,Result). binomial_coefficient(I,N,Product,Result) :- ( I=0 -> Result=Product; ( I2 is I-1, Product2 is Product * (N+1-I)/I, binomial_coefficient(I2,N,Product2,Result) ) ).
Prolog
5
ryandesign/yap
packages/ProbLog/problog/discrete.yap
[ "Artistic-1.0-Perl", "ClArtistic" ]
(ns wisp.analyzer (:require [wisp.ast :refer [meta with-meta symbol? keyword? quote? symbol namespace name pr-str unquote? unquote-splicing?]] [wisp.sequence :refer [list? list conj partition seq empty? map vec every? concat first second third rest last butlast interleave cons count some assoc reduce filter seq?]] [wisp.runtime :refer [nil? dictionary? vector? keys vals string? number? boolean? date? re-pattern? even? = max dec dictionary subs inc dec]] [wisp.expander :refer [macroexpand]] [wisp.string :refer [split join]])) (defn syntax-error [message form] (let [metadata (meta form) line (:line (:start metadata)) uri (:uri metadata) column (:column (:start metadata)) error (SyntaxError (str message "\n" "Form: " (pr-str form) "\n" "URI: " uri "\n" "Line: " line "\n" "Column: " column))] (set! error.lineNumber line) (set! error.line line) (set! error.columnNumber column) (set! error.column column) (set! error.fileName uri) (set! error.uri uri) (throw error))) (defn analyze-keyword "Example: (analyze-keyword {} :foo) => {:op :constant :form ':foo :env {}}" [env form] {:op :constant :form form}) (def **specials** {}) (defn install-special! [op analyzer] (set! (get **specials** (name op)) analyzer)) (defn analyze-special [analyzer env form] (let [metadata (meta form) ast (analyzer env form)] (conj {:start (:start metadata) :end (:end metadata)} ast))) (defn analyze-if "Example: (analyze-if {} '(if monday? :yep :nope)) => {:op :if :form '(if monday? :yep :nope) :env {} :test {:op :var :form 'monday? :info nil :env {}} :consequent {:op :constant :form ':yep :type :keyword :env {}} :alternate {:op :constant :form ':nope :type :keyword :env {}}}" [env form] (let [forms (rest form) test (analyze env (first forms)) consequent (analyze env (second forms)) alternate (analyze env (third forms))] (if (< (count forms) 2) (syntax-error "Malformed if expression, too few operands" form)) {:op :if :form form :test test :consequent consequent :alternate alternate})) (install-special! :if analyze-if) (defn analyze-throw "Example: (analyze-throw {} '(throw (Error :boom))) => {:op :throw :form '(throw (Error :boom)) :throw {:op :invoke :callee {:op :var :form 'Error :info nil :env {}} :params [{:op :constant :type :keyword :form ':boom :env {}}]}}" [env form] (let [expression (analyze env (second form))] {:op :throw :form form :throw expression})) (install-special! :throw analyze-throw) (defn analyze-try [env form] (let [forms (vec (rest form)) ;; Finally tail (last forms) finalizer-form (if (and (list? tail) (= 'finally (first tail))) (rest tail)) finalizer (if finalizer-form (analyze-block env finalizer-form)) ;; catch body-form (if finalizer (butlast forms) forms) tail (last body-form) handler-form (if (and (list? tail) (= 'catch (first tail))) (rest tail)) handler (if handler-form (conj {:name (analyze env (first handler-form))} (analyze-block env (rest handler-form)))) ;; Try body (if handler-form (analyze-block env (butlast body-form)) (analyze-block env body-form))] {:op :try :form form :body body :handler handler :finalizer finalizer})) (install-special! :try analyze-try) (defn analyze-set! [env form] (let [body (rest form) left (first body) right (second body) target (cond (symbol? left) (analyze-symbol env left) (list? left) (analyze-list env left) :else left) value (analyze env right)] {:op :set! :target target :value value :form form})) (install-special! :set! analyze-set!) (defn analyze-new [env form] (let [body (rest form) constructor (analyze env (first body)) params (vec (map #(analyze env %) (rest body)))] {:op :new :constructor constructor :form form :params params})) (install-special! :new analyze-new) (defn analyze-aget [env form] (let [body (rest form) target (analyze env (first body)) attribute (second body) field (and (quote? attribute) (symbol? (second attribute)) (second attribute))] (if (nil? attribute) (syntax-error "Malformed aget expression expected (aget object member)" form) {:op :member-expression :computed (not field) :form form :target target ;; If field is a quoted symbol there's no need to resolve ;; it for info :property (if field (conj (analyze-special analyze-identifier env field) {:binding nil}) (analyze env attribute))}))) (install-special! :aget analyze-aget) (defn parse-def ([id] {:id id}) ([id init] {:id id :init init}) ([id doc init] {:id id :doc doc :init init})) (defn analyze-def [env form] (let [params (apply parse-def (vec (rest form))) id (:id params) metadata (meta id) binding (analyze-special analyze-declaration env id) init (analyze env (:init params)) doc (or (:doc params) (:doc metadata))] {:op :def :doc doc :id binding :init init :export (and (:top env) (not (:private metadata))) :form form})) (install-special! :def analyze-def) (defn analyze-do [env form] (let [expressions (rest form) body (analyze-block env expressions)] (conj body {:op :do :form form}))) (install-special! :do analyze-do) (defn analyze-symbol "Symbol analyzer also does syntax desugaring for the symbols like foo.bar.baz producing (aget foo 'bar.baz) form. This enables renaming of shadowed symbols." [env form] (let [forms (split (name form) \.) metadata (meta form) start (:start metadata) end (:end metadata) expansion (if (> (count forms) 1) (list 'aget (with-meta (symbol (first forms)) (conj metadata {:start start :end {:line (:line end) :column (+ 1 (:column start) (count (first forms)))}})) (list 'quote (with-meta (symbol (join \. (rest forms))) (conj metadata {:end end :start {:line (:line start) :column (+ 1 (:column start) (count (first forms)))}})))))] (if expansion (analyze env (with-meta expansion (meta form))) (analyze-special analyze-identifier env form)))) (defn analyze-identifier [env form] {:op :var :type :identifier :form form :start (:start (meta form)) :end (:end (meta form)) :binding (resolve-binding env form)}) (defn unresolved-binding [env form] {:op :unresolved-binding :type :unresolved-binding :identifier {:type :identifier :form (symbol (namespace form) (name form))} :start (:start (meta form)) :end (:end (meta form))}) (defn resolve-binding [env form] (or (get (:locals env) (name form)) (get (:enclosed env) (name form)) (unresolved-binding env form))) (defn analyze-shadow [env id] (let [binding (resolve-binding env id)] {:depth (inc (or (:depth binding) 0)) :shadow binding})) (defn analyze-binding [env form] (let [id (first form) body (second form)] (conj (analyze-shadow env id) {:op :binding :type :binding :id id :init (analyze env body) :form form}))) (defn analyze-declaration [env form] (assert (not (or (namespace form) (< 1 (count (split \. (str form))))))) (conj (analyze-shadow env form) {:op :var :type :identifier :depth 0 :id form :form form})) (defn analyze-param [env form] (conj (analyze-shadow env form) {:op :param :type :parameter :id form :form form :start (:start (meta form)) :end (:end (meta form))})) (defn with-binding "Returns enhanced environment with additional binding added to the :bindings and :scope" [env form] (conj env {:locals (assoc (:locals env) (name (:id form)) form) :bindings (conj (:bindings env) form)})) (defn with-param [env form] (conj (with-binding env form) {:params (conj (:params env) form)})) (defn sub-env [env] {:enclosed (conj {} (:enclosed env) (:locals env)) :locals {} :bindings [] :params (or (:params env) [])}) (defn analyze-let* "Takes let form and enhances it's metadata via analyzed info" [env form is-loop] (let [expressions (rest form) bindings (first expressions) body (rest expressions) valid-bindings? (and (vector? bindings) (even? (count bindings))) _ (assert valid-bindings? "bindings must be vector of even number of elements") scope (reduce #(with-binding %1 (analyze-binding %1 %2)) (sub-env env) (partition 2 bindings)) bindings (:bindings scope) expressions (analyze-block (if is-loop (conj scope {:params bindings}) scope) body)] {:op :let :form form :start (:start (meta form)) :end (:end (meta form)) :bindings bindings :statements (:statements expressions) :result (:result expressions)})) (defn analyze-let [env form] (analyze-let* env form false)) (install-special! :let analyze-let) (defn analyze-loop [env form] (conj (analyze-let* env form true) {:op :loop})) (install-special! :loop analyze-loop) (defn analyze-recur [env form] (let [params (:params env) forms (vec (map #(analyze env %) (rest form)))] (if (= (count params) (count forms)) {:op :recur :form form :params forms} (syntax-error "Recurs with wrong number of arguments" form)))) (install-special! :recur analyze-recur) (defn analyze-quoted-list [form] {:op :list :items (map analyze-quoted (vec form)) :form form :start (:start (meta form)) :end (:end (meta form))}) (defn analyze-quoted-vector [form] {:op :vector :items (map analyze-quoted form) :form form :start (:start (meta form)) :end (:end (meta form))}) (defn analyze-quoted-dictionary [form] (let [names (vec (map analyze-quoted (keys form))) values (vec (map analyze-quoted (vals form)))] {:op :dictionary :form form :keys names :values values :start (:start (meta form)) :end (:end (meta form))})) (defn analyze-quoted-symbol [form] {:op :symbol :name (name form) :namespace (namespace form) :form form}) (defn analyze-quoted-keyword [form] {:op :keyword :name (name form) :namespace (namespace form) :form form}) (defn analyze-quoted [form] (cond (symbol? form) (analyze-quoted-symbol form) (keyword? form) (analyze-quoted-keyword form) (list? form) (analyze-quoted-list form) (vector? form) (analyze-quoted-vector form) (dictionary? form) (analyze-quoted-dictionary form) :else {:op :constant :form form})) (defn analyze-quote "Examples: (analyze-quote {} '(quote foo)) => {:op :constant :form 'foo :env env}" [env form] (analyze-quoted (second form))) (install-special! :quote analyze-quote) (defn analyze-statement [env form] (let [statements (or (:statements env) []) bindings (or (:bindings env) []) statement (analyze env form) op (:op statement) defs (cond (= op :def) [(:var statement)] ;; (= op :ns) (:requirement node) :else nil)] (conj env {:statements (conj statements statement) :bindings (concat bindings defs)}))) (defn analyze-block "Examples: (analyze-block {} '((foo bar))) => {:statements nil :result {:op :invoke :form '(foo bar) :env {} :callee {:op :var :form 'foo :info nil :env {}} :params [{:op :var :form 'bar :info nil :env {}}]} (analyze-block {} '((beep bz) (foo bar))) => {:statements [{:op :invoke :form '(beep bz) :env {} :callee {:op :var :form 'beep :info nil :env {}} :params [{:op :var :form 'bz :info nil :env {}}]}] :result {:op :invoke :form '(foo bar) :env {} :callee {:op :var :form 'foo :info nil :env {}} :params [{:op :var :form 'bar :info nil :env {}}]}" [env form] (let [body (if (> (count form) 1) (reduce analyze-statement env (butlast form))) result (analyze (or body env) (last form))] {:statements (:statements body) :result result})) (defn analyze-fn-method " {} -> '([x y] (+ x y)) -> {:env {} :form '([x y] (+ x y)) :variadic false :arity 2 :params [{:op :var :form 'x} {:op :var :form 'y}] :statements [] :return {:op :invoke :callee {:op :var :form '+ :env {:parent {} :locals {x {:name 'x :shadow nil :local true :tag nil} y {:name 'y :shadow nil :local true :tag nil}}}} :params [{:op :var :form 'x :info nil :tag nil} {:op :var :form 'y :info nil :tag nil}]}}" [env form] (let [signature (if (and (list? form) (vector? (first form))) (first form) (syntax-error "Malformed fn overload form" form)) body (rest form) ;; If param signature contains & fn is variadic. variadic (some #(= '& %) signature) ;; All named params of the fn. params (if variadic (filter #(not (= '& %)) signature) signature) ;; Number of parameters fixed parameters fn takes. arity (if variadic (dec (count params)) (count params)) ;; Analyze parameters in correspondence to environment ;; locals to identify binding shadowing. scope (reduce #(with-param %1 (analyze-param %1 %2)) (conj env {:params []}) params)] (conj (analyze-block scope body) {:op :overload :variadic variadic :arity arity :params (:params scope) :form form}))) (defn analyze-fn [env form] (let [forms (rest form) ;; Normalize fn form so that it contains name ;; '(fn [x] x) -> '(fn nil [x] x) forms (if (symbol? (first forms)) forms (cons nil forms)) id (first forms) binding (if id (analyze-special analyze-declaration env id)) body (rest forms) ;; Make sure that fn definition is strucutered ;; in method overload style: ;; (fn a [x] y) -> (([x] y)) ;; (fn a ([x] y)) -> (([x] y)) overloads (cond (vector? (first body)) (list body) (and (list? (first body)) (vector? (first (first body)))) body :else (syntax-error (str "Malformed fn expression, " "parameter declaration (" (pr-str (first body)) ") must be a vector") form)) scope (if binding (with-binding (sub-env env) binding) (sub-env env)) methods (map #(analyze-fn-method scope %) (vec overloads)) arity (apply max (map #(:arity %) methods)) variadic (some #(:variadic %) methods)] {:op :fn :type :function :id binding :variadic variadic :methods methods :form form})) (install-special! :fn analyze-fn) (defn parse-references "Takes part of namespace difinition and creates hash of reference forms" [forms] (reduce (fn [references form] ;; If not a vector than it's not a reference ;; form that wisp understands so just skip it. (if (seq? form) (assoc references (name (first form)) (vec (rest form))) references)) {} forms)) (defn parse-require [form] (let [;; require form may be either vector with id in the ;; head or just an id symbol. normalizing to a vector requirement (if (symbol? form) [form] (vec form)) id (first requirement) ;; bunch of directives may follow require form but they ;; all come in pairs. wisp supports following pairs: ;; :as foo ;; :refer [foo bar] ;; :rename {foo bar} ;; join these pairs in a hash for key based access. params (apply dictionary (rest requirement)) renames (get params ':rename) names (get params ':refer) alias (get params ':as) references (if (not (empty? names)) (reduce (fn [refers reference] (conj refers {:op :refer :form reference :name reference ;; Look up by reference symbol and by symbol ;; bit in a fuzz right now. :rename (or (get renames reference) (get renames (name reference))) :ns id})) [] names))] {:op :require :alias alias :ns id :refer references :form form})) (defn analyze-ns [env form] (let [forms (rest form) name (first forms) body (rest forms) ;; Optional docstring that follows name symbol doc (if (string? (first body)) (first body)) ;; If second form is not a string than treat it ;; as regular reference form references (parse-references (if doc (rest body) body)) requirements (if (:require references) (map parse-require (:require references)))] {:op :ns :name name :doc doc :require (if requirements (vec requirements)) :form form})) (install-special! :ns analyze-ns) (defn analyze-list "Takes form of list type and performs a macroexpansions until fully expanded. If expansion is different from a given form then expanded form is handed back to analyzer. If form is special like def, fn, let... than associated is dispatched, otherwise form is analyzed as invoke expression." [env form] (let [expansion (macroexpand form) ;; Special operators must be symbols and stored in the ;; **specials** hash by operator name. operator (first form) analyzer (and (symbol? operator) (get **specials** (name operator)))] ;; If form is expanded pass it back to analyze since it may no ;; longer be a list. Otherwise either analyze as a special form ;; (if it's such) or as function invokation form. (cond (not (identical? expansion form)) (analyze env expansion) analyzer (analyze-special analyzer env expansion) :else (analyze-invoke env expansion)))) (defn analyze-vector [env form] (let [items (vec (map #(analyze env %) form))] {:op :vector :form form :items items})) (defn analyze-dictionary [env form] (let [names (vec (map #(analyze env %) (keys form))) values (vec (map #(analyze env %) (vals form)))] {:op :dictionary :keys names :values values :form form})) (defn analyze-invoke "Returns node of :invoke type, representing a function call. In addition to regular properties this node contains :callee mapped to a node that is being invoked and :params that is an vector of paramter expressions that :callee is invoked with." [env form] (let [callee (analyze env (first form)) params (vec (map #(analyze env %) (rest form)))] {:op :invoke :callee callee :params params :form form})) (defn analyze-constant "Returns a node representing a contstant value which is most certainly a primitive value literal this form cantains no extra information." [env form] {:op :constant :form form}) (defn analyze "Takes a hash representing a given environment and `form` to be analyzed. Environment may contain following entries: :locals - Hash of the given environments bindings mappedy by binding name. :context - One of the following :statement, :expression, :return. That information is included in resulting nodes and is meant for writer that may output different forms based on context. :ns - Namespace of the forms being analized. Analyzer performs all the macro & syntax expansions and transforms form into AST node of an expression. Each such node contains at least following properties: :op - Operation type of the expression. :form - Given form. Based on :op node may contain different set of properties." ([form] (analyze {:locals {} :bindings [] :top true} form)) ([env form] (cond (nil? form) (analyze-constant env form) (symbol? form) (analyze-symbol env form) (list? form) (if (empty? form) (analyze-quoted form) (analyze-list env form)) (dictionary? form) (analyze-dictionary env form) (vector? form) (analyze-vector env form) ;(set? form) (analyze-set env form name) (keyword? form) (analyze-keyword env form) :else (analyze-constant env form))))
wisp
5
bamboo/wisp
src/analyzer.wisp
[ "BSD-3-Clause" ]
===Filters, sources and sinks: design, motivation and examples=== ==or Functional programming for the rest of us== by DiegoNehab {{{ }}} ===Abstract=== Certain operations can be implemented in the form of filters. A filter is a function that processes data received in consecutive function calls, returning partial results chunk by chunk. Examples of operations that can be implemented as filters include the end-of-line normalization for text, Base64 and Quoted-Printable transfer content encodings, the breaking of text into lines, SMTP byte stuffing, and there are many others. Filters become even more powerful when we allow them to be chained together to create composite filters. Filters can be seen as middle nodes in a chain of data transformations. Sources an sinks are the corresponding end points of these chains. A source is a function that produces data, chunk by chunk, and a sink is a function that takes data, chunk by chunk. In this technical note, we define an elegant interface for filters, sources, sinks and chaining. We evolve our interface progressively, until we reach a high degree of generality. We discuss difficulties that arise during the implementation of this interface and we provide solutions and examples. ===Introduction=== Applications sometimes have too much information to process to fit in memory and are thus forced to process data in smaller parts. Even when there is enough memory, processing all the data atomically may take long enough to frustrate a user that wants to interact with the application. Furthermore, complex transformations can often be defined as series of simpler operations. Several different complex transformations might share the same simpler operations, so that an uniform interface to combine them is desirable. The following concepts constitute our solution to these problems. ''Filters'' are functions that accept successive chunks of input, and produce successive chunks of output. Furthermore, the result of concatenating all the output data is the same as the result of applying the filter over the concatenation of the input data. As a consequence, boundaries are irrelevant: filters have to handle input data split arbitrarily by the user. A ''chain'' is a function that combines the effect of two (or more) other functions, but whose interface is indistinguishable from the interface of one of its components. Thus, a chained filter can be used wherever an atomic filter can be used. However, its effect on data is the combined effect of its component filters. Note that, as a consequence, chains can be chained themselves to create arbitrarily complex operations that can be used just like atomic operations. Filters can be seen as internal nodes in a network through which data flows, potentially being transformed along its way. Chains connect these nodes together. To complete the picture, we need ''sources'' and ''sinks'' as initial and final nodes of the network, respectively. Less abstractly, a source is a function that produces new data every time it is called. On the other hand, sinks are functions that give a final destination to the data they receive. Naturally, sources and sinks can be chained with filters. Finally, filters, chains, sources, and sinks are all passive entities: they need to be repeatedly called in order for something to happen. ''Pumps'' provide the driving force that pushes data through the network, from a source to a sink. Hopefully, these concepts will become clear with examples. In the following sections, we start with simplified interfaces, which we improve several times until we can find no obvious shortcomings. The evolution we present is not contrived: it follows the steps we followed ourselves as we consolidated our understanding of these concepts. == A concrete example == Some data transformations are easier to implement as filters than others. Examples of operations that can be implemented as filters include the end-of-line normalization for text, the Base64 and Quoted-Printable transfer content encodings, the breaking of text into lines, SMTP byte stuffing, and many others. Let's use the end-of-line normalization as an example to define our initial filter interface. We later discuss why the implementation might not be trivial. Assume we are given text in an unknown end-of-line convention (including possibly mixed conventions) out of the commonly found Unix (LF), Mac OS (CR), and DOS (CRLF) conventions. We would like to be able to write code like the following: {{{ input = source.chain(source.file(io.stdin), normalize("\r\n")) output = sink.file(io.stdout) pump(input, output) }}} This program should read data from the standard input stream and normalize the end-of-line markers to the canonic CRLF marker defined by the MIME standard, finally sending the results to the standard output stream. For that, we use a ''file source'' to produce data from standard input, and chain it with a filter that normalizes the data. The pump then repeatedly gets data from the source, and moves it to the ''file sink'' that sends it to standard output. To make the discussion even more concrete, we start by discussing the implementation of the normalization filter. The {{normalize}} ''factory'' is a function that creates such a filter. Our initial filter interface is as follows: the filter receives a chunk of input data, and returns a chunk of processed data. When there is no more input data, the user notifies the filter by invoking it with a {{nil}} chunk. The filter then returns the final chunk of processed data. Although the interface is extremely simple, the implementation doesn't seem so obvious. Any filter respecting this interface needs to keep some kind of context between calls. This is because chunks can be broken between the CR and LF characters marking the end of a line. This need for context storage is what motivates the use of factories: each time the factory is called, it returns a filter with its own context so that we can have several independent filters being used at the same time. For the normalization filter, we know that the obvious solution (i.e. concatenating all the input into the context before producing any output) is not good enough, so we will have to find another way. We will break the implementation in two parts: a low-level filter, and a factory of high-level filters. The low-level filter will be implemented in C and will not carry any context between function calls. The high-level filter factory, implemented in Lua, will create and return a high-level filter that keeps whatever context the low-level filter needs, but isolates the user from its internal details. That way, we take advantage of C's efficiency to perform the dirty work, and take advantage of Lua's simplicity for the bookkeeping. ==The Lua part of the implementation== Below is the implementation of the factory of high-level end-of-line normalization filters: {{{ function filter.cycle(low, ctx, extra) return function(chunk) local ret ret, ctx = low(ctx, chunk, extra) return ret end end function normalize(marker) return cycle(eol, 0, marker) end }}} The {{normalize}} factory simply calls a more generic factory, the {{cycle}} factory. This factory receives a low-level filter, an initial context and some extra value and returns the corresponding high-level filter. Each time the high level filer is called with a new chunk, it calls the low-level filter passing the previous context, the new chunk and the extra argument. The low-level filter produces the chunk of processed data and a new context. Finally, the high-level filter updates its internal context and returns the processed chunk of data to the user. It is the low-level filter that does all the work. Notice that this implementation takes advantage of the Lua 5.0 lexical scoping rules to store the context locally, between function calls. Moving to the low-level filter, we notice there is no perfect solution to the end-of-line marker normalization problem itself. The difficulty comes from an inherent ambiguity on the definition of empty lines within mixed input. However, the following solution works well for any consistent input, as well as for non-empty lines in mixed input. It also does a reasonable job with empty lines and serves as a good example of how to implement a low-level filter. Here is what we do: CR and LF are considered candidates for line break. We issue ''one'' end-of-line line marker if one of the candidates is seen alone, or followed by a ''different'' candidate. That is, CR&nbsp;CR and LF&nbsp;LF issue two end of line markers each, but CR&nbsp;LF and LF&nbsp;CR issue only one marker. This idea takes care of Mac OS, Mac OS X, VMS and Unix, DOS and MIME, as well as probably other more obscure conventions. ==The C part of the implementation== The low-level filter is divided into two simple functions. The inner function actually does the conversion. It takes each input character in turn, deciding what to output and how to modify the context. The context tells if the last character seen was a candidate and, if so, which candidate it was. {{{ #define candidate(c) (c == CR || c == LF) static int process(int c, int last, const char *marker, luaL_Buffer *buffer) { if (candidate(c)) { if (candidate(last)) { if (c == last) luaL_addstring(buffer, marker); return 0; } else { luaL_addstring(buffer, marker); return c; } } else { luaL_putchar(buffer, c); return 0; } } }}} The inner function makes use of Lua's auxiliary library's buffer interface for its efficiency and ease of use. The outer function simply interfaces with Lua. It receives the context and the input chunk (as well as an optional end-of-line marker), and returns the transformed output and the new context. {{{ static int eol(lua_State *L) { int ctx = luaL_checkint(L, 1); size_t isize = 0; const char *input = luaL_optlstring(L, 2, NULL, &isize); const char *last = input + isize; const char *marker = luaL_optstring(L, 3, CRLF); luaL_Buffer buffer; luaL_buffinit(L, &amp;buffer); if (!input) { lua_pushnil(L); lua_pushnumber(L, 0); return 2; } while (input &lt; last) ctx = process(*input++, ctx, marker, &amp;buffer); luaL_pushresult(&amp;buffer); lua_pushnumber(L, ctx); return 2; } }}} Notice that if the input chunk is {{nil}}, the operation is considered to be finished. In that case, the loop will not execute a single time and the context is reset to the initial state. This allows the filter to be reused indefinitely. It is a good idea to write filters like this, when possible. Besides the end-of-line normalization filter shown above, many other filters can be implemented with the same ideas. Examples include Base64 and Quoted-Printable transfer content encodings, the breaking of text into lines, SMTP byte stuffing etc. The challenging part is to decide what will be the context. For line breaking, for instance, it could be the number of bytes left in the current line. For Base64 encoding, it could be the bytes that remain in the division of the input into 3-byte atoms. ===Chaining=== Filters become more powerful when the concept of chaining is introduced. Suppose you have a filter for Quoted-Printable encoding and you want to encode some text. According to the standard, the text has to be normalized into its canonic form prior to encoding. A nice interface that simplifies this task is a factory that creates a composite filter that passes data through multiple filters, but that can be used wherever a primitive filter is used. {{{ local function chain2(f1, f2) return function(chunk) local ret = f2(f1(chunk)) if chunk then return ret else return ret .. f2() end end end function filter.chain(...) local arg = {...} local f = arg[1] for i = 2, #arg do f = chain2(f, arg[i]) end return f end local chain = filter.chain(normalize("\r\n"), encode("quoted-printable")) while 1 do local chunk = io.read(2048) io.write(chain(chunk)) if not chunk then break end end }}} The chaining factory is very simple. All it does is return a function that passes data through all filters and returns the result to the user. It uses the simpler auxiliary function that knows how to chain two filters together. In the auxiliary function, special care must be taken if the chunk is final. This is because the final chunk notification has to be pushed through both filters in turn. Thanks to the chain factory, it is easy to perform the Quoted-Printable conversion, as the above example shows. ===Sources, sinks, and pumps=== As we noted in the introduction, the filters we introduced so far act as the internal nodes in a network of transformations. Information flows from node to node (or rather from one filter to the next) and is transformed on its way out. Chaining filters together is the way we found to connect nodes in the network. But what about the end nodes? In the beginning of the network, we need a node that provides the data, a source. In the end of the network, we need a node that takes in the data, a sink. ==Sources== We start with two simple sources. The first is the {{empty}} source: It simply returns no data, possibly returning an error message. The second is the {{file}} source, which produces the contents of a file in a chunk by chunk fashion, closing the file handle when done. {{{ function source.empty(err) return function() return nil, err end end function source.file(handle, io_err) if handle then return function() local chunk = handle:read(2048) if not chunk then handle:close() end return chunk end else return source.empty(io_err or "unable to open file") end end }}} A source returns the next chunk of data each time it is called. When there is no more data, it just returns {{nil}}. If there is an error, the source can inform the caller by returning {{nil}} followed by an error message. Adrian Sietsma noticed that, although not on purpose, the interface for sources is compatible with the idea of iterators in Lua 5.0. That is, a data source can be nicely used in conjunction with {{for}} loops. Using our file source as an iterator, we can rewrite our first example: {{{ local process = normalize("\r\n") for chunk in source.file(io.stdin) do io.write(process(chunk)) end io.write(process(nil)) }}} Notice that the last call to the filter obtains the last chunk of processed data. The loop terminates when the source returns {{nil}} and therefore we need that final call outside of the loop. ==Maintaining state between calls== It is often the case that a source needs to change its behavior after some event. One simple example would be a file source that wants to make sure it returns {{nil}} regardless of how many times it is called after the end of file, avoiding attempts to read past the end of the file. Another example would be a source that returns the contents of several files, as if they were concatenated, moving from one file to the next until the end of the last file is reached. One way to implement this kind of source is to have the factory declare extra state variables that the source can use via lexical scoping. Our file source could set the file handle itself to {{nil}} when it detects the end-of-file. Then, every time the source is called, it could check if the handle is still valid and act accordingly: {{{ function source.file(handle, io_err) if handle then return function() if not handle then return nil end local chunk = handle:read(2048) if not chunk then handle:close() handle = nil end return chunk end else return source.empty(io_err or "unable to open file") end end }}} Another way to implement this behavior involves a change in the source interface to makes it more flexible. Let's allow a source to return a second value, besides the next chunk of data. If the returned chunk is {{nil}}, the extra return value tells us what happened. A second {{nil}} means that there is just no more data and the source is empty. Any other value is considered to be an error message. On the other hand, if the chunk was ''not'' {{nil}}, the second return value tells us whether the source wants to be replaced. If it is {{nil}}, we should proceed using the same source. Otherwise it has to be another source, which we have to use from then on, to get the remaining data. This extra freedom is good for someone writing a source function, but it is a pain for those that have to use it. Fortunately, given one of these ''fancy'' sources, we can transform it into a simple source that never needs to be replaced, using the following factory. {{{ function source.simplify(src) return function() local chunk, err_or_new = src() src = err_or_new or src if not chunk then return nil, err_or_new else return chunk end end end }}} The simplification factory allows us to write fancy sources and use them as if they were simple. Therefore, our next functions will only produce simple sources, and functions that take sources will assume they are simple. Going back to our file source, the extended interface allows for a more elegant implementation. The new source just asks to be replaced by an empty source as soon as there is no more data. There is no repeated checking of the handle. To make things simpler to the user, the factory itself simplifies the the fancy file source before returning it to the user: {{{ function source.file(handle, io_err) if handle then return source.simplify(function() local chunk = handle:read(2048) if not chunk then handle:close() return "", source.empty() end return chunk end) else return source.empty(io_err or "unable to open file") end end }}} We can make these ideas even more powerful if we use a new feature of Lua 5.0: coroutines. Coroutines suffer from a great lack of advertisement, and I am going to play my part here. Just like lexical scoping, coroutines taste odd at first, but once you get used with the concept, it can save your day. I have to admit that using coroutines to implement our file source would be overkill, so let's implement a concatenated source factory instead. {{{ function source.cat(...) local arg = {...} local co = coroutine.create(function() local i = 1 while i <= #arg do local chunk, err = arg[i]() if chunk then coroutine.yield(chunk) elseif err then return nil, err else i = i + 1 end end end) return function() return shift(coroutine.resume(co)) end end }}} The factory creates two functions. The first is an auxiliary that does all the work, in the form of a coroutine. It reads a chunk from one of the sources. If the chunk is {{nil}}, it moves to the next source, otherwise it just yields returning the chunk. When it is resumed, it continues from where it stopped and tries to read the next chunk. The second function is the source itself, and just resumes the execution of the auxiliary coroutine, returning to the user whatever chunks it returns (skipping the first result that tells us if the coroutine terminated). Imagine writing the same function without coroutines and you will notice the simplicity of this implementation. We will use coroutines again when we make the filter interface more powerful. ==Chaining Sources== What does it mean to chain a source with a filter? The most useful interpretation is that the combined source-filter is a new source that produces data and passes it through the filter before returning it. Here is a factory that does it: {{{ function source.chain(src, f) return source.simplify(function() local chunk, err = src() if not chunk then return f(nil), source.empty(err) else return f(chunk) end end) end }}} Our motivating example in the introduction chains a source with a filter. The idea of chaining a source with a filter is useful when one thinks about functions that might get their input data from a source. By chaining a simple source with one or more filters, the same function can be provided with filtered data even though it is unaware of the filtering that is happening behind its back. ==Sinks== Just as we defined an interface for an initial source of data, we can also define an interface for a final destination of data. We call any function respecting that interface a ''sink''. Below are two simple factories that return sinks. The table factory creates a sink that stores all obtained data into a table. The data can later be efficiently concatenated into a single string with the {{table.concat}} library function. As another example, we introduce the {{null}} sink: A sink that simply discards the data it receives. {{{ function sink.table(t) t = t or {} local f = function(chunk, err) if chunk then table.insert(t, chunk) end return 1 end return f, t end local function null() return 1 end function sink.null() return null end }}} Sinks receive consecutive chunks of data, until the end of data is notified with a {{nil}} chunk. An error is notified by an extra argument giving an error message after the {{nil}} chunk. If a sink detects an error itself and wishes not to be called again, it should return {{nil}}, optionally followed by an error message. A return value that is not {{nil}} means the source will accept more data. Finally, just as sources can choose to be replaced, so can sinks, following the same interface. Once again, it is easy to implement a {{sink.simplify}} factory that transforms a fancy sink into a simple sink. As an example, let's create a source that reads from the standard input, then chain it with a filter that normalizes the end-of-line convention and let's use a sink to place all data into a table, printing the result in the end. {{{ local load = source.chain(source.file(io.stdin), normalize("\r\n")) local store, t = sink.table() while 1 do local chunk = load() store(chunk) if not chunk then break end end print(table.concat(t)) }}} Again, just as we created a factory that produces a chained source-filter from a source and a filter, it is easy to create a factory that produces a new sink given a sink and a filter. The new sink passes all data it receives through the filter before handing it in to the original sink. Here is the implementation: {{{ function sink.chain(f, snk) return function(chunk, err) local r, e = snk(f(chunk)) if not r then return nil, e end if not chunk then return snk(nil, err) end return 1 end end }}} ==Pumps== There is a while loop that has been around for too long in our examples. It's always there because everything that we designed so far is passive. Sources, sinks, filters: None of them will do anything on their own. The operation of pumping all data a source can provide into a sink is so common that we will provide a couple helper functions to do that for us. {{{ function pump.step(src, snk) local chunk, src_err = src() local ret, snk_err = snk(chunk, src_err) return chunk and ret and not src_err and not snk_err, src_err or snk_err end function pump.all(src, snk, step) step = step or pump.step while true do local ret, err = step(src, snk) if not ret then return not err, err end end end }}} The {{pump.step}} function moves one chunk of data from the source to the sink. The {{pump.all}} function takes an optional {{step}} function and uses it to pump all the data from the source to the sink. We can now use everything we have to write a program that reads a binary file from disk and stores it in another file, after encoding it to the Base64 transfer content encoding: {{{ local load = source.chain( source.file(io.open("input.bin", "rb")), encode("base64") ) local store = sink.chain( wrap(76), sink.file(io.open("output.b64", "w")), ) pump.all(load, store) }}} The way we split the filters here is not intuitive, on purpose. Alternatively, we could have chained the Base64 encode filter and the line-wrap filter together, and then chain the resulting filter with either the file source or the file sink. It doesn't really matter. ===One last important change=== Turns out we still have a problem. When David Burgess was writing his gzip filter, he noticed that the decompression filter can explode a small input chunk into a huge amount of data. Although we wished we could ignore this problem, we soon agreed we couldn't. The only solution is to allow filters to return partial results, and that is what we chose to do. After invoking the filter to pass input data, the user now has to loop invoking the filter to find out if it has more output data to return. Note that these extra calls can't pass more data to the filter. More specifically, after passing a chunk of input data to a filter and collecting the first chunk of output data, the user invokes the filter repeatedly, passing the empty string, to get extra output chunks. When the filter itself returns an empty string, the user knows there is no more output data, and can proceed to pass the next input chunk. In the end, after the user passes a {{nil}} notifying the filter that there is no more input data, the filter might still have produced too much output data to return in a single chunk. The user has to loop again, this time passing {{nil}} each time, until the filter itself returns {{nil}} to notify the user it is finally done. Most filters won't need this extra freedom. Fortunately, the new filter interface is easy to implement. In fact, the end-of-line translation filter we created in the introduction already conforms to it. On the other hand, the chaining function becomes much more complicated. If it wasn't for coroutines, I wouldn't be happy to implement it. Let me know if you can find a simpler implementation that does not use coroutines! {{{ local function chain2(f1, f2) local co = coroutine.create(function(chunk) while true do local filtered1 = f1(chunk) local filtered2 = f2(filtered1) local done2 = filtered1 and "" while true do if filtered2 == "" or filtered2 == nil then break end coroutine.yield(filtered2) filtered2 = f2(done2) end if filtered1 == "" then chunk = coroutine.yield(filtered1) elseif filtered1 == nil then return nil else chunk = chunk and "" end end end) return function(chunk) local _, res = coroutine.resume(co, chunk) return res end end }}} Chaining sources also becomes more complicated, but a similar solution is possible with coroutines. Chaining sinks is just as simple as it has always been. Interestingly, these modifications do not have a measurable negative impact in the the performance of filters that didn't need the added flexibility. They do severely improve the efficiency of filters like the gzip filter, though, and that is why we are keeping them. ===Final considerations=== These ideas were created during the development of {{LuaSocket}}[http://www.tecgraf.puc-rio.br/luasocket] 2.0, and are available as the LTN12 module. As a result, {{LuaSocket}}[http://www.tecgraf.puc-rio.br/luasocket] implementation was greatly simplified and became much more powerful. The MIME module is especially integrated to LTN12 and provides many other filters. We felt these concepts deserved to be made public even to those that don't care about {{LuaSocket}}[http://www.tecgraf.puc-rio.br/luasocket], hence the LTN. One extra application that deserves mentioning makes use of an identity filter. Suppose you want to provide some feedback to the user while a file is being downloaded into a sink. Chaining the sink with an identity filter (a filter that simply returns the received data unaltered), you can update a progress counter on the fly. The original sink doesn't have to be modified. Another interesting idea is that of a T sink: A sink that sends data to two other sinks. In summary, there appears to be enough room for many other interesting ideas. In this technical note we introduced filters, sources, sinks, and pumps. These are useful tools for data processing in general. Sources provide a simple abstraction for data acquisition. Sinks provide an abstraction for final data destinations. Filters define an interface for data transformations. The chaining of filters, sources and sinks provides an elegant way to create arbitrarily complex data transformation from simpler transformations. Pumps just put the machinery to work.
MediaWiki
5
ford442/openmpt
include/premake/binmodules/luasocket/ltn012.wiki
[ "BSD-3-Clause" ]
/* THREADS: number of threads Used as array dimension June. 19, 2008 Liao */ shared int a[THREADS]; shared int b[5*THREADS]; shared int c[THREADS*5]; /* int a[THREADS]; only arrays of a shared type can be dimensioned to a multiple of THREADS */
Unified Parallel C
3
maurizioabba/rose
tests/CompileTests/UPC_tests/threads_2.upc
[ "BSD-3-Clause" ]
size: A4; dpi: 240;
CLIPS
0
asmuth-archive/travistest
test/layer/resize_a4_dpi.clp
[ "Apache-2.0" ]
## Data Structures ### Object + thing (optional, array[]) + foo: bar
API Blueprint
1
darkcl/drafter
test/fixtures/mson/regression-267.apib
[ "MIT" ]
MODULE NCDF DESCRIPTION IDL NetCDF support VERSION 4.0.1 SOURCE ITT Visual Information Solutions BUILD_DATE OCT 28 2009 CHECKSUM W9FBJZ99 FUNCTION NCDF_ATTCOPY 3 5 KEYWORDS FUNCTION NCDF_ATTINQ 2 3 KEYWORDS FUNCTION NCDF_ATTNAME 2 3 KEYWORDS FUNCTION NCDF_CREATE 1 1 KEYWORDS XDEMO FUNCTION NCDF_DIMDEF 2 3 KEYWORDS FUNCTION NCDF_DIMID 2 2 FUNCTION NCDF_DIMIDSINQ 1 1 KEYWORDS FUNCTION NCDF_FULLGROUPNAME 1 1 FUNCTION NCDF_GROUPDEF 2 2 XDEMO FUNCTION NCDF_GROUPNAME 1 1 FUNCTION NCDF_GROUPPARENT 1 1 FUNCTION NCDF_GROUPSINQ 1 1 FUNCTION NCDF_INQUIRE 1 1 FUNCTION NCDF_NCIDINQ 2 2 FUNCTION NCDF_OPEN 1 1 KEYWORDS FUNCTION NCDF_VARDEF 2 3 KEYWORDS FUNCTION NCDF_VARID 2 2 FUNCTION NCDF_VARIDSINQ 1 1 FUNCTION NCDF_VARINQ 2 2 PROCEDURE NCDF_ATTDEL 2 3 KEYWORDS XDEMO PROCEDURE NCDF_ATTGET 3 4 KEYWORDS PROCEDURE NCDF_ATTPUT 3 4 KEYWORDS XDEMO PROCEDURE NCDF_ATTRENAME 3 4 KEYWORDS PROCEDURE NCDF_CLOSE 1 1 PROCEDURE NCDF_CONTROL 1 1 KEYWORDS PROCEDURE NCDF_DIMINQ 4 4 PROCEDURE NCDF_DIMRENAME 3 3 PROCEDURE NCDF_VARGET 3 3 KEYWORDS PROCEDURE NCDF_VARGET1 3 3 KEYWORDS PROCEDURE NCDF_VARPUT 3 3 KEYWORDS XDEMO PROCEDURE NCDF_VARRENAME 3 3
IDL
2
rogerionegri/GeotexInspector
GeotexInspector_Windows/IDL71/bin/bin.x86/idl_netcdf.dlm
[ "MIT" ]
// run-pass // Tests that codegen_path checks whether a // pattern-bound var is an upvar (when codegenning // the for-each body) fn foo(src: usize) { match Some(src) { Some(src_id) => { for _i in 0_usize..10_usize { let yyy = src_id; assert_eq!(yyy, 0_usize); } } _ => { } } } pub fn main() { foo(0_usize); }
Rust
4
Eric-Arellano/rust
src/test/ui/binding/pattern-bound-var-in-for-each.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
# Copyright (C) 2007-2012, Parrot Foundation. =pod =head1 DESCRIPTION A tutorial lesson about Parrot's namespaces (continued. =head1 SUBROUTINES IN A NAMESPACE Subroutines created in one namespace can be accessed from another using the C<get_global> opcode, just like global variables. In fact, since subroutines are really just PMCs, they are variables themselves and the two operations are actually the same. Namespaces can be defined in code using the C<.namespace> directive, followed by the name of the namespace as a hash key. The default root namespace can be specified with an empty set of brackets such as C<.namespace []>. =cut .sub main :main $P0 = get_global ["Different"; "Namespace"], "foo" $S0 = $P0("Zaphod") say $S0 .end .namespace ["Different"; "Namespace"] .sub foo .param string name .local string greeting greeting = "Hello, " . name .return (greeting) .end # Local Variables: # mode: pir # fill-column: 100 # End: # vim: expandtab shiftwidth=4 ft=pir:
Parrot Internal Representation
4
winnit-myself/Wifie
examples/tutorial/62_namespaces.pir
[ "Artistic-2.0" ]
/** * @file * @brief [Geometric * Distribution](https://en.wikipedia.org/wiki/Geometric_distribution) * * @details * The geometric distribution models the experiment of doing Bernoulli trials * until a sucess was observed. There are two formulations of the geometric * distribution: 1) The probability distribution of the number X of Bernoulli * trials needed to get one success, supported on the set { 1, 2, 3, ... } 2) * The probability distribution of the number Y = X − 1 of failures before the * first success, supported on the set { 0, 1, 2, 3, ... } Here, the first one * is implemented. * * Common variables used: * p - The success probability * k - The number of tries * * @author [Domenic Zingsheim](https://github.com/DerAndereDomenic) */ #include <cassert> /// for assert #include <cmath> /// for math functions #include <cstdint> /// for fixed size data types #include <ctime> /// for time to initialize rng #include <iostream> /// for std::cout #include <limits> /// for std::numeric_limits #include <random> /// for random numbers #include <vector> /// for std::vector /** * @namespace probability * @brief Probability algorithms */ namespace probability { /** * @namespace geometric_dist * @brief Functions for the [Geometric * Distribution](https://en.wikipedia.org/wiki/Geometric_distribution) algorithm * implementation */ namespace geometric_dist { /** * @brief Returns a random number between [0,1] * @returns A uniformly distributed random number between 0 (included) and 1 * (included) */ float generate_uniform() { return static_cast<float>(rand()) / static_cast<float>(RAND_MAX); } /** * @brief A class to model the geometric distribution */ class geometric_distribution { private: float p; ///< The succes probability p public: /** * @brief Constructor for the geometric distribution * @param p The success probability */ explicit geometric_distribution(const float& p) : p(p) {} /** * @brief The expected value of a geometrically distributed random variable * X * @returns E[X] = 1/p */ float expected_value() const { return 1.0f / p; } /** * @brief The variance of a geometrically distributed random variable X * @returns V[X] = (1 - p) / p^2 */ float variance() const { return (1.0f - p) / (p * p); } /** * @brief The standard deviation of a geometrically distributed random * variable X * @returns \sigma = \sqrt{V[X]} */ float standard_deviation() const { return std::sqrt(variance()); } /** * @brief The probability density function * @details As we use the first definition of the geometric series (1), * we are doing k - 1 failed trials and the k-th trial is a success. * @param k The number of trials to observe the first success in [1,\infty) * @returns A number between [0,1] according to p * (1-p)^{k-1} */ float probability_density(const uint32_t& k) const { return std::pow((1.0f - p), static_cast<float>(k - 1)) * p; } /** * @brief The cumulative distribution function * @details The sum of all probabilities up to (and including) k trials. * Basically CDF(k) = P(x <= k) * @param k The number of trials in [1,\infty) * @returns The probability to have success within k trials */ float cumulative_distribution(const uint32_t& k) const { return 1.0f - std::pow((1.0f - p), static_cast<float>(k)); } /** * @brief The inverse cumulative distribution function * @details This functions answers the question: Up to how many trials are * needed to have success with a probability of cdf? The exact floating * point value is reported. * @param cdf The probability in [0,1] * @returns The number of (exact) trials. */ float inverse_cumulative_distribution(const float& cdf) const { return std::log(1.0f - cdf) / std::log(1.0f - p); } /** * @brief Generates a (discrete) sample according to the geometrical * distribution * @returns A geometrically distributed number in [1,\infty) */ uint32_t draw_sample() const { float uniform_sample = generate_uniform(); return static_cast<uint32_t>( inverse_cumulative_distribution(uniform_sample)) + 1; } /** * @brief This function computes the probability to have success in a given * range of tries * @details Computes P(min_tries <= x <= max_tries). * Can be used to calculate P(x >= min_tries) by not passing a second * argument. Can be used to calculate P(x <= max_tries) by passing 1 as the * first argument * @param min_tries The minimum number of tries in [1,\infty) (inclusive) * @param max_tries The maximum number of tries in [min_tries, \infty) * (inclusive) * @returns The probability of having success within a range of tries * [min_tries, max_tries] */ float range_tries(const uint32_t& min_tries = 1, const uint32_t& max_tries = std::numeric_limits<uint32_t>::max()) const { float cdf_lower = cumulative_distribution(min_tries - 1); float cdf_upper = max_tries == std::numeric_limits<uint32_t>::max() ? 1.0f : cumulative_distribution(max_tries); return cdf_upper - cdf_lower; } }; } // namespace geometric_dist } // namespace probability /** * @brief Tests the sampling method of the geometric distribution * @details Draws 1000000 random samples and estimates mean and variance * These should be close to the expected value and variance of the given * distribution to pass. * @param dist The distribution to test */ void sample_test( const probability::geometric_dist::geometric_distribution& dist) { uint32_t n_tries = 1000000; std::vector<float> tries; tries.resize(n_tries); float mean = 0.0f; for (uint32_t i = 0; i < n_tries; ++i) { tries[i] = static_cast<float>(dist.draw_sample()); mean += tries[i]; } mean /= static_cast<float>(n_tries); float var = 0.0f; for (uint32_t i = 0; i < n_tries; ++i) { var += (tries[i] - mean) * (tries[i] - mean); } // Unbiased estimate of variance var /= static_cast<float>(n_tries - 1); std::cout << "This value should be near " << dist.expected_value() << ": " << mean << std::endl; std::cout << "This value should be near " << dist.variance() << ": " << var << std::endl; } /** * @brief Self-test implementations * @returns void */ static void test() { probability::geometric_dist::geometric_distribution dist(0.3); const float threshold = 1e-3f; std::cout << "Starting tests for p = 0.3..." << std::endl; assert(std::abs(dist.expected_value() - 3.33333333f) < threshold); assert(std::abs(dist.variance() - 7.77777777f) < threshold); assert(std::abs(dist.standard_deviation() - 2.788866755) < threshold); assert(std::abs(dist.probability_density(5) - 0.07203) < threshold); assert(std::abs(dist.cumulative_distribution(6) - 0.882351) < threshold); assert(std::abs(dist.inverse_cumulative_distribution( dist.cumulative_distribution(8)) - 8) < threshold); assert(std::abs(dist.range_tries() - 1.0f) < threshold); assert(std::abs(dist.range_tries(3) - 0.49f) < threshold); assert(std::abs(dist.range_tries(5, 11) - 0.2203267f) < threshold); std::cout << "All tests passed" << std::endl; sample_test(dist); dist = probability::geometric_dist::geometric_distribution(0.5f); std::cout << "Starting tests for p = 0.5..." << std::endl; assert(std::abs(dist.expected_value() - 2.0f) < threshold); assert(std::abs(dist.variance() - 2.0f) < threshold); assert(std::abs(dist.standard_deviation() - 1.4142135f) < threshold); assert(std::abs(dist.probability_density(5) - 0.03125) < threshold); assert(std::abs(dist.cumulative_distribution(6) - 0.984375) < threshold); assert(std::abs(dist.inverse_cumulative_distribution( dist.cumulative_distribution(8)) - 8) < threshold); assert(std::abs(dist.range_tries() - 1.0f) < threshold); assert(std::abs(dist.range_tries(3) - 0.25f) < threshold); assert(std::abs(dist.range_tries(5, 11) - 0.062011f) < threshold); std::cout << "All tests passed" << std::endl; sample_test(dist); dist = probability::geometric_dist::geometric_distribution(0.8f); std::cout << "Starting tests for p = 0.8..." << std::endl; assert(std::abs(dist.expected_value() - 1.25f) < threshold); assert(std::abs(dist.variance() - 0.3125f) < threshold); assert(std::abs(dist.standard_deviation() - 0.559016f) < threshold); assert(std::abs(dist.probability_density(5) - 0.00128) < threshold); assert(std::abs(dist.cumulative_distribution(6) - 0.999936) < threshold); assert(std::abs(dist.inverse_cumulative_distribution( dist.cumulative_distribution(8)) - 8) < threshold); assert(std::abs(dist.range_tries() - 1.0f) < threshold); assert(std::abs(dist.range_tries(3) - 0.04f) < threshold); assert(std::abs(dist.range_tries(5, 11) - 0.00159997f) < threshold); std::cout << "All tests have successfully passed!" << std::endl; sample_test(dist); } /** * @brief Main function * @return 0 on exit */ int main() { srand(time(nullptr)); test(); // run self-test implementations return 0; }
C++
5
Kahemp/C-Plus-Plus
probability/geometric_dist.cpp
[ "MIT" ]
At: "059.hac":8: parse error: syntax error parser stacks: state value #STATE# (null) #STATE# (process-prototype) [3:1..59] #STATE# { [3:61] #STATE# list<(def-body-item)>: (instance-decl) ... [4:1..9] #STATE# keyword: chp [5:1..3] #STATE# { [5:5] #STATE# *[ [6:2] #STATE# list<(chp-statement)>: list<(chp-statement)>: (chp-receive) ... ... [7:3..7] #STATE# ; [7:8] #STATE# [ [8:3] #STATE# (chp-guarded-cmd) [8:4..13] #STATE# : [8:15] #STATE# keyword: else [8:17..20] in state #STATE#, possible rules are: chp_nondet_guarded_command_list: chp_guarded_command ':' . chp_guarded_command (#RULE#) acceptable tokens are: '(' (shift) '#' (shift) '-' (shift) '~' (shift) ID (shift) FLOAT (shift) INT (shift) SCOPE (shift) BOOL_TRUE (shift) BOOL_FALSE (shift)
Bison
1
broken-wheel/hacktist
hackt_docker/hackt/test/parser/chp/059.stderr.bison
[ "MIT" ]
server { server_name [domain]; root [symfony-web-root] location / { include proxy_params; proxy_set_header X-Forwarded-Host "$http_host:$server_port"; proxy_pass http://127.0.0.1:9100$request_uri; } error_log /var/log/nginx/syrma.log; access_log /var/log/nginx/syrma.log; }
ApacheConf
3
syrma-php/web-container-bundle
Resources/doc/sample/nginx.vhost
[ "MIT" ]
{% include '@SyliusShop/Common/Order/_addresses.html.twig' %} {% include '@SyliusShop/Common/Order/_table.html.twig' %} <div class="ui two column stackable grid"> <div class="column" id="sylius-payments"> {% include '@SyliusShop/Common/Order/_payments.html.twig' %} </div> <div class="column" id="sylius-shipments"> {% include '@SyliusShop/Common/Order/_shipments.html.twig' %} </div> </div>
Twig
3
titomtd/Sylius
src/Sylius/Bundle/ShopBundle/Resources/views/Common/Order/_summary.html.twig
[ "MIT" ]
""" Regression tests for the resolve_url function. """ from django.db import models class UnimportantThing(models.Model): importance = models.IntegerField() def get_absolute_url(self): return '/importance/%d/' % self.importance
Python
3
ni-ning/django
tests/resolve_url/models.py
[ "CNRI-Python-GPL-Compatible", "BSD-3-Clause" ]
--- layout: pages/guides ---
HTML
0
Hans-Halverson/flow
website/en/docs/index.html
[ "MIT" ]
{:queries {:search {:type String :resolve :placeholder :args {:terms {:type (list String) :default-value ["columbia" "river" "gorge"]}}}}}
edn
3
hagenek/lacinia
dev-resources/list-default-value-schema.edn
[ "Apache-2.0" ]
{ // width: 200, height: 500, width: 500, height: 500, outPath: './mosaic.mp4', defaults: { transition: { duration: 0 }, layer: { fontPath: './assets/Patua_One/PatuaOne-Regular.ttf' }, layerType: { video: { width: 0.4, height: 0.4 }, } }, clips: [ { duration: 2, layers: [ { type: 'video', path: './assets/palawan.mp4', cutFrom: 0, cutTo: 2, resizeMode: 'cover', top: 0.5, left: 0.5, originY: 'center', originX: 'center' }, { type: 'video', path: './assets/palawan.mp4', cutFrom: 0, cutTo: 2, resizeMode: 'contain' }, { type: 'video', path: './assets/palawan.mp4', cutFrom: 0, cutTo: 2, resizeMode: 'contain-blur', left: 1, originX: 'right' }, { type: 'video', path: './assets/IMG_1884.MOV', cutFrom: 0, cutTo: 2, resizeMode: 'contain-blur', left: 1, top: 1, originX: 'right', originY: 'bottom' }, { type: 'video', path: './assets/palawan.mp4', cutFrom: 0, cutTo: 2, resizeMode: 'stretch', top: 1, originY: 'bottom' }, ] }, ], }
JSON5
3
aaverty/editly
examples/mosaic.json5
[ "MIT" ]
-- (c) 2009 Aarne Ranta under LGPL instance LexFoodsIta of LexFoods = open SyntaxIta, ParadigmsIta in { oper wine_N = mkN "vino" ; pizza_N = mkN "pizza" ; cheese_N = mkN "formaggio" ; fish_N = mkN "pesce" ; fresh_A = mkA "fresco" ; warm_A = mkA "caldo" ; italian_A = mkA "italiano" ; expensive_A = mkA "caro" ; delicious_A = mkA "delizioso" ; boring_A = mkA "noioso" ; }
Grammatical Framework
4
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Grammatical Framework/LexFoodsIta.gf
[ "MIT" ]
<html> <head> <meta charset="utf-8"> <title>Mongoose ODM</title> <style> body { background: url('/docs/2.8.x/images/bg.png'); padding: 0 30px 30px; margin-top: 0; } #wrap { background: url('/docs/2.8.x/images/pattern.png') no-repeat -134px -211px; min-height: 600px; padding-top: 30px; } #page { width: 650px; margin: auto; position: relative; } #footer { font: 13px Helvetica; padding-top: 15px; border-top: 1px solid #000; color: #666; margin-top: 25px; } #footer > div { padding-top: 8px; float: right; text-align: right; padding-bottom: 20px; } #content { color: #111; font: 15px Courier; } #content h1, #content h2, #content h3 { text-shadow: 0 1px 0 #fff; } #announce { background: #2A758A; border: 10px solid black; border-radius: 7px; padding: 30px; font-size: 125%; color: white; text-shadow: none; font-family: Arial; } #announce a { color: orange; text-shadow: none; } pre { background: rgba(255,255,255,.8); border: 1px solid #c6c6c6; padding: 10px; border-radius: 3px; box-shadow: 1px 3px 6px #ddd; } code { background: rgba(255,255,255,.8); border: 1px solid #c6c6c6; color: #333; border-radius: 3px } pre code { border: 0 none; } form { font: bold 12px Helvetica; text-shadow: 0 1px 0 #fff; float: left; padding-bottom: 25px; } form img { margin-right: 5px } #google-members-count { vertical-align: top; line-height: 32px; } h1 a { background: url('/docs/2.8.x/images/logo.png'); width: 404px; height: 47px; margin-bottom: 40px; text-indent: -500em; display: block; } a { color: #2a758a; text-shadow: 0 1px 0 #fff; text-decoration: none; } a:hover { opacity: 0.8; } #menu { position: fixed; top: 0; left: 0; height: 100%; background-color: rgba(0,0,0,0.3); font: bold 15px Helvetica; border-right: 1px solid rgba(0,0,0,0.2); } #menu ul { margin: 0; padding: 50px 0; } #menu ul li { list-style-type: none; padding-left: 15px; padding-right: 20px; } #menu ul li a { color: #fff; text-shadow: none; } #menu ul li a:hover { text-decoration: underline; } #wild { margin-top: 10px; } </style> <script> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1122274-9']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); function getMembers(data){ if (!(data && data.query && data.query.results && data.query.results.p)) return; var members = document.createElement('span'); members.id = 'google-members-count'; members.innerHTML = '('+ data.query.results.p +' members)'; document.getElementsByTagName('FORM')[0].insertBefore(members, document.getElementById('google-subscribe-input')); }; window.onload = function(){ // lame jsonp var script = document.createElement('script'); script.src = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fgroups.google.com%2Fgroup%2Fmongoose-orm%2Fabout%22%20and%20xpath%3D'%2F%2Fdiv%5B%40class%3D%5C'maincontbox%5C'%5D%2Ftable%2Ftr%5B1%5D%2Ftd%2Fp%5B1%5D'%0A&format=json&callback=getMembers"; document.head.appendChild(script); }; </script> </head> <body> <a href="http://github.com/learnboost/mongoose"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a> <div id="wrap"> <div id="page"> <div id="menu"> <ul> <li><a href="index.html">Home</a></li> <li><a href="docs/model-definition.html">Models/Schemas</a></li> <li><a href="docs/schematypes.html">Schema Types</a></li> <li><a href="docs/schema-options.html">Schema Options</a></li> <li><a href="docs/middleware.html">Middleware</a></li> <li><a href="docs/finding-documents.html">Finding Docs</a></li> <li><a href="docs/updating-documents.html">Updating Docs</a></li> <li><a href="docs/query.html">Queries</a></li> <li><a href="docs/querystream.html">Query Streams</a></li> <li><a href="docs/methods-statics.html">Methods &amp; Statics</a> <li><a href="docs/defaults.html">Defaults</a></li> <li><a href="docs/indexes.html">Indexes</a></li> <li><a href="docs/validation.html">Validation</a></li> <li><a href="docs/virtuals.html">Virtuals</a></li> <li><a href="docs/getters-setters.html">Getters / Setters</a></li> <li><a href="docs/embedded-documents.html">Embedded Docs</a></li> <li><a href="docs/populate.html">Populate (DBRef-like)</a></li> <li><a href="docs/plugins.html">Plugins</a></li> <li><a href="docs/errors.html">Errors</a></li> <li><a href="docs/migration-1x-2x.html">v1x - v2x Migration</a></li> <li><a href="docs/api.html">API</a></li> </ul> </div> <h1><a href="index.html">Mongoose</a></h1> <div id="content"> <h1>Mongoose 2.8.x</h1> <div id="announce"><strong>08-23-2012: Mongoose 2.8 is out</strong> with a few bug fixes, a couple of which cause a slight change in behavior from previous 2.x versions. Check out the <a href="https://groups.google.com/d/topic/mongoose-orm/UVx4xdufz-I/discussion">release notes</a> for details. </div> <h2>What's Mongoose?</h2> <p>Mongoose is a <a href="http://www.mongodb.org/">MongoDB</a> object modeling tool designed to work in an asynchronous environment.</p> <p>Defining a model is as easy as:</p> <pre><code>var Comments = new Schema({ title : String , body : String , date : Date }); var BlogPost = new Schema({ author : ObjectId , title : String , body : String , buf : Buffer , date : Date , comments : [Comments] , meta : { votes : Number , favs : Number } }); var Post = mongoose.model('BlogPost', BlogPost); </code></pre> <h2>Installation</h2> <p>The recommended way is through the excellent <a href="http://www.npmjs.org/">NPM</a>:</p> <pre><code>$ npm install mongoose </code></pre> <p>Otherwise, you can check it in your repository and then expose it:</p> <pre><code>$ git clone git://github.com/LearnBoost/mongoose.git node_modules/mongoose/ </code></pre> <p>And install dependency modules written on <code>package.json</code>.</p> <p>Then you can <code>require</code> it:</p> <pre><code>require('mongoose') </code></pre> <h2>Connecting to MongoDB</h2> <p>First, we need to define a connection. If your app uses only one database, you should use <code>mongoose.connect</code>. If you need to create additional connections, use <code>mongoose.createConnection</code>.</p> <p>Both <code>connect</code> and <code>createConnection</code> take a <code>mongodb://</code> URI, or the parameters <code>host, database, port, options</code>.</p> <pre><code>var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/my_database'); </code></pre> <p>Once connected, the <code>open</code> event is fired on the <code>Connection</code> instance. If you're using <code>mongoose.connect</code>, the <code>Connection</code> is <code>mongoose.connection</code>. Otherwise, <code>mongoose.createConnection</code> return value is a <code>Connection</code>.</p> <p><strong>Important!</strong> Mongoose buffers all the commands until it's connected to the database. This means that you don't have to wait until it connects to MongoDB in order to define models, run queries, etc.</p> <h2>Defining a Model</h2> <p>Models are defined through the <code>Schema</code> interface. </p> <pre><code>var Schema = mongoose.Schema , ObjectId = Schema.ObjectId; var BlogPost = new Schema({ author : ObjectId , title : String , body : String , date : Date }); </code></pre> <p>Aside from defining the structure of your documents and the types of data you're storing, a Schema handles the definition of:</p> <ul> <li><a href="docs/validation.html">Validators</a> (async and sync)</li> <li><a href="docs/schematypes.html">Defaults</a></li> <li><a href="docs/getters-setters.html">Getters</a></li> <li><a href="docs/getters-setters.html">Setters</a></li> <li><a href="docs/indexes.html">Indexes</a></li> <li><a href="docs/middleware.html">Middleware</a></li> <li><a href="docs/methods-statics.html">Methods</a> definition</li> <li><a href="docs/methods-statics.html">Statics</a> definition</li> <li><a href="docs/plugins.html">Plugins</a></li> <li><a href="docs/populate.html">DBRefs</a></li> </ul> <p>The following example shows some of these features:</p> <pre><code>var Comment = new Schema({ name : { type: String, default: 'hahaha' } , age : { type: Number, min: 18, index: true } , bio : { type: String, match: /[a-z]/ } , date : { type: Date, default: Date.now } , buff : Buffer }); // a setter Comment.path('name').set(function (v) { return capitalize(v); }); // middleware Comment.pre('save', function (next) { notify(this.get('email')); next(); }); </code></pre> <p>Take a look at the example in <code>examples/schema.js</code> for an end-to-end example of a typical setup.</p> <h2>Accessing a Model</h2> <p>Once we define a model through <code>mongoose.model('ModelName', mySchema)</code>, we can access it through the same function</p> <pre><code>var myModel = mongoose.model('ModelName'); </code></pre> <p>Or just do it all at once</p> <pre><code>var MyModel = mongoose.model('ModelName', mySchema); </code></pre> <p>We can then instantiate it, and save it:</p> <pre><code>var instance = new MyModel(); instance.my.key = 'hello'; instance.save(function (err) { // }); </code></pre> <p>Or we can find documents from the same collection</p> <pre><code>MyModel.find({}, function (err, docs) { // docs.forEach }); </code></pre> <p>You can also <code>findOne</code>, <code>findById</code>, <code>update</code>, etc. For more details check out <a href="docs/finding-documents.html">this link</a>.</p> <p><strong>Important!</strong> If you opened a separate connection using <code>mongoose.createConnection()</code> but attempt to access the model through <code>mongoose.model('ModelName')</code> it will not work as expected since it is not hooked up to an active db connection. In this case access your model through the connection you created:</p> <pre><code>var conn = mongoose.createConnection('your connection string'); var MyModel = conn.model('ModelName', schema); var m = new MyModel; m.save() // works vs var conn = mongoose.createConnection('your connection string'); var MyModel = mongoose.model('ModelName', schema); var m = new MyModel; m.save() // does not work b/c the default connection object was never connected </code></pre> <h2>Embedded Documents</h2> <p>In the first example snippet, we defined a key in the Schema that looks like:</p> <pre><code>comments: [Comments] </code></pre> <p>Where <code>Comments</code> is a <code>Schema</code> we created. This means that creating embedded documents is as simple as:</p> <pre><code>// retrieve my model var BlogPost = mongoose.model('BlogPost'); // create a blog post var post = new BlogPost(); // create a comment post.comments.push({ title: 'My comment' }); post.save(function (err) { if (!err) console.log('Success!'); }); </code></pre> <p>The same goes for removing them:</p> <pre><code>BlogPost.findById(myId, function (err, post) { if (!err) { post.comments[0].remove(); post.save(function (err) { // do something }); } }); </code></pre> <p>Embedded documents enjoy all the same features as your models. Defaults, validators, middleware. Whenever an error occurs, it's bubbled to the <code>save()</code> error callback, so error handling is a snap!</p> <p>Mongoose interacts with your embedded documents in arrays <em>atomically</em>, out of the box.</p> <h2>Middleware</h2> <p>Middleware is one of the most exciting features about Mongoose. Middleware takes away all the pain of nested callbacks.</p> <p>Middleware are defined at the Schema level and are applied for the methods <code>init</code> (when a document is initialized with data from MongoDB), <code>save</code> (when a document or embedded document is saved).</p> <p>There's two types of middleware:</p> <ul> <li><p>Serial<br />Serial middleware are defined like:</p> <pre><code>.pre(method, function (next, methodArg1, methodArg2, ...) { // ... }) </code></pre> <p>They're executed one after the other, when each middleware calls <code>next</code>.</p> <p>You can also intercept the <code>method</code>'s incoming arguments via your middleware -- notice <code>methodArg1</code>, <code>methodArg2</code>, etc in the <code>pre</code> definition above. See section "Intercepting and mutating method arguments" below.</p></li> <li><p>Parallel<br />Parallel middleware offer more fine-grained flow control, and are defined like:</p> <pre><code>.pre(method, true, function (next, done, methodArg1, methodArg2) { // ... }) </code></pre> <p>Parallel middleware can <code>next()</code> immediately, but the final argument will be called when all the parallel middleware have called <code>done()</code>.</p></li> </ul> <h3>Error handling</h3> <p>If any middleware calls <code>next</code> or <code>done</code> with an <code>Error</code> instance, the flow is interrupted, and the error is passed to the function passed as an argument.</p> <p>For example:</p> <pre><code>schema.pre('save', function (next) { // something goes wrong next(new Error('something went wrong')); }); // later... myModel.save(function (err) { // err can come from a middleware }); </code></pre> <h3>Intercepting and mutating method arguments</h3> <p>You can intercept method arguments via middleware.</p> <p>For example, this would allow you to broadcast changes about your Documents every time someone <code>set</code>s a path in your Document to a new value:</p> <pre><code>schema.pre('set', function (next, path, val, typel) { // `this` is the current Document this.emit('set', path, val); // Pass control to the next pre next(); }); </code></pre> <p>Moreover, you can mutate the incoming <code>method</code> arguments so that subsequent middleware see different values for those arguments. To do so, just pass the new values to <code>next</code>:</p> <pre><code>.pre(method, function firstPre (next, methodArg1, methodArg2) { // Mutate methodArg1 next("altered-" + methodArg1.toString(), methodArg2); }) // pre declaration is chainable .pre(method, function secondPre (next, methodArg1, methodArg2) { console.log(methodArg1); // =&gt; 'altered-originalValOfMethodArg1' console.log(methodArg2); // =&gt; 'originalValOfMethodArg2' // Passing no arguments to `next` automatically passes along the current argument values // i.e., the following `next()` is equivalent to `next(methodArg1, methodArg2)` // and also equivalent to, with the example method arg // values, `next('altered-originalValOfMethodArg1', 'originalValOfMethodArg2')` next(); }) </code></pre> <h3>Schema gotcha</h3> <p><code>type</code>, when used in a schema has special meaning within Mongoose. If your schema requires using <code>type</code> as a nested property you must use object notation:</p> <pre><code>new Schema({ broken: { type: Boolean } , asset : { name: String , type: String // uh oh, it broke. asset will be interpreted as String } }); new Schema({ works: { type: Boolean } , asset : { name: String , type: { type: String } // works. asset is an object with a type property } }); </code></pre> <h2>API docs</h2> <p>You can find the <a href="http://github.com/visionmedia/dox">Dox</a> generated API docs <a href="docs/api.html">here</a>.</p> <h2>Getting support</h2> <p>Please subscribe to the Google Groups <a href="http://groups.google.com/group/mongoose-orm">mailing list</a>.</p> <p>Join #mongoosejs on freenode.</p> <h2>Driver access</h2> The driver being used defaults to <a href="https://github.com/mongodb/node-mongodb-native">node-mongodb-native</a> and is directly accessible through <code>YourModel.collection</code>. <strong>Note</strong>: using the driver directly bypasses all Mongoose power-tools like validation, getters, setters, hooks, etc., with the notable exception that <code>YourModel.collection</code> still buffers commands. As such, <code>YourModel.collection.find()</code> will <b>not</b> return a cursor. <h2>Mongoose Plugins</h2> <p>Take a peek at the <a href="https://github.com/LearnBoost/mongoose/wiki/Plugins">plugins page</a> to see contributions from the community. Add your own!</p> <h2>Contributing to Mongoose</h2> <h3>Cloning the repository</h3> <p>Make a fork of <code>mongoose</code>, then clone it in your computer. The <code>v2.x</code> branch contains the current stable release, and the <code>master</code> branch the next upcoming major release.</p> <h3>Guidelines</h3> <ul> <li>Please write inline documentation for new methods or class members.</li> <li>Please write tests and make sure your tests pass.</li> <li>Before starting to write code, look for existing tickets or create one for your specific issue (unless you're addressing something that's clearly broken). That way you avoid working on something that might not be of interest or that has been addressed already in a different branch.</li> </ul> <h2>Credits</h2> <ul> <li>Guillermo Rauch - <a href='mailto:guillermo@learnboost.com'>guillermo@learnboost.com</a> - <a href="http://github.com/guille">Guille</a></li> <li>Nathan White - <a href="http://github.com/nw/">nw</a></li> <li>Brian Noguchi - <a href="https://github.com/bnoguchi">bnoguchi</a></li> <li>Aaron Heckmann - <a href="https://github.com/aheckmann">aheckmann</a></li> </ul> <h2>License</h2> <p>Copyright (c) 2010-2012 LearnBoost &lt;<a href='mailto:dev@learnboost.com'>dev@learnboost.com</a>&gt;</p> <p>Permission is hereby granted, free of charge, to any person obtaining<br />a copy of this software and associated documentation files (the<br />'Software'), to deal in the Software without restriction, including<br />without limitation the rights to use, copy, modify, merge, publish,<br />distribute, sublicense, and/or sell copies of the Software, and to<br />permit persons to whom the Software is furnished to do so, subject to<br />the following conditions:</p> <p>The above copyright notice and this permission notice shall be<br />included in all copies or substantial portions of the Software.</p> <p>THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,<br />EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br />MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.<br />IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY<br />CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,<br />TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE<br />SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> </div> <div id="footer"> <form action="http://groups.google.com/group/mongoose-orm/boxsubscribe"> <a href="http://groups.google.com/group/mongoose-orm" id="google-subscribe-link"><img src="/docs/2.8.x/images/groups.png" border="0"></a> <span id="google-members-count">&nbsp;</span> <div id="google-subscribe-input"> Email: <input type="text" name="email" id="google-subscribe-email"> <input type="submit" name="go" value="Subscribe"> </div> </form> <div> Mongoose by <a href="http://github.com/learnboost">LearnBoost Labs</a>.<br> Released under the MIT license.<br> Copyright <a href="http://learnboost.com">LearnBoost 2011</a>. </div> </div> </div> </div> </body> </html>
HTML
5
gavi-shandler/mongoose
docs/2.8.x/index.html
[ "MIT" ]
{ "@context": [{ "term": "http://example.org/term" }, { "term2": "http://example.org/term2" }] }
JSONLD
2
donbowman/rdflib
test/jsonld/1.1/toRdf/so13-context.jsonld
[ "BSD-3-Clause" ]
/** * Author......: See docs/credits.txt * License.....: MIT */ //#define NEW_SIMD_CODE #ifdef KERNEL_STATIC #include "inc_vendor.h" #include "inc_types.h" #include "inc_platform.cl" #include "inc_common.cl" #include "inc_rp.h" #include "inc_rp.cl" #include "inc_scalar.cl" #endif CONSTANT_VK u32a PE_CONST[256] = { 0, 49345, 49537, 320, 49921, 960, 640, 49729, 50689, 1728, 1920, 51009, 1280, 50625, 50305, 1088, 52225, 3264, 3456, 52545, 3840, 53185, 52865, 3648, 2560, 51905, 52097, 2880, 51457, 2496, 2176, 51265, 55297, 6336, 6528, 55617, 6912, 56257, 55937, 6720, 7680, 57025, 57217, 8000, 56577, 7616, 7296, 56385, 5120, 54465, 54657, 5440, 55041, 6080, 5760, 54849, 53761, 4800, 4992, 54081, 4352, 53697, 53377, 4160, 61441, 12480, 12672, 61761, 13056, 62401, 62081, 12864, 13824, 63169, 63361, 14144, 62721, 13760, 13440, 62529, 15360, 64705, 64897, 15680, 65281, 16320, 16000, 65089, 64001, 15040, 15232, 64321, 14592, 63937, 63617, 14400, 10240, 59585, 59777, 10560, 60161, 11200, 10880, 59969, 60929, 11968, 12160, 61249, 11520, 60865, 60545, 11328, 58369, 9408, 9600, 58689, 9984, 59329, 59009, 9792, 8704, 58049, 58241, 9024, 57601, 8640, 8320, 57409, 40961, 24768, 24960, 41281, 25344, 41921, 41601, 25152, 26112, 42689, 42881, 26432, 42241, 26048, 25728, 42049, 27648, 44225, 44417, 27968, 44801, 28608, 28288, 44609, 43521, 27328, 27520, 43841, 26880, 43457, 43137, 26688, 30720, 47297, 47489, 31040, 47873, 31680, 31360, 47681, 48641, 32448, 32640, 48961, 32000, 48577, 48257, 31808, 46081, 29888, 30080, 46401, 30464, 47041, 46721, 30272, 29184, 45761, 45953, 29504, 45313, 29120, 28800, 45121, 20480, 37057, 37249, 20800, 37633, 21440, 21120, 37441, 38401, 22208, 22400, 38721, 21760, 38337, 38017, 21568, 39937, 23744, 23936, 40257, 24320, 40897, 40577, 24128, 23040, 39617, 39809, 23360, 39169, 22976, 22656, 38977, 34817, 18624, 18816, 35137, 19200, 35777, 35457, 19008, 19968, 36545, 36737, 20288, 36097, 19904, 19584, 35905, 17408, 33985, 34177, 17728, 34561, 18368, 18048, 34369, 33281, 17088, 17280, 33601, 16640, 33217, 32897, 16448 }; KERNEL_FQ void m26200_mxx (KERN_ATTR_RULES ()) { /** * modifier */ const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); if (gid >= gid_max) return; /** * base */ COPY_PW (pws[gid]); /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { pw_t tmp = PASTE_PW; tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); u32 hash = 17; u8 scratch[16] = { 0 }; u8 *input = (u8 *) tmp.i; for (u32 i = 0; i < 5; i++) { for (u32 j = 0; j < tmp.pw_len; j++) { int idx = 15 - (j & 15); scratch[idx] ^= input[j]; } for (u32 j = 0; j < 16; j += 2) { hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]); scratch[j] = (unsigned char)( hash & 0xff); scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff); } } u8 target[16] = { 0 }; for (u32 i = 0; i < 16; i++) { u8 lower = (scratch[i] & 0x7f); if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z')) { target[i] = lower; } else { target[i] = (u8)((scratch[i] >> 4) + 0x61); } } u32 *digest = (u32 *) target; const u32 r0 = digest[DGST_R0]; const u32 r1 = digest[DGST_R1]; const u32 r2 = digest[DGST_R2]; const u32 r3 = digest[DGST_R3]; COMPARE_M_SCALAR (r0, r1, r2, r3); } } KERNEL_FQ void m26200_sxx (KERN_ATTR_RULES ()) { /** * modifier */ const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); if (gid >= gid_max) return; /** * digest */ const u32 search[4] = { digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0], digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1], digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2], digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3] }; /** * base */ COPY_PW (pws[gid]); /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { pw_t tmp = PASTE_PW; tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); u32 hash = 17; u8 scratch[16] = { 0 }; u8 *input = (u8 *) tmp.i; for (u32 i = 0; i < 5; i++) { for (u32 j = 0; j < tmp.pw_len; j++) { int idx = 15 - (j & 15); scratch[idx] ^= input[j]; } for (u32 j = 0; j < 16; j += 2) { hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]); scratch[j] = (unsigned char)( hash & 0xff); scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff); } } u8 target[16] = { 0 }; for (u32 i = 0; i < 16; i++) { u8 lower = (scratch[i] & 0x7f); if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z')) { target[i] = lower; } else { target[i] = (u8)((scratch[i] >> 4) + 0x61); } } u32 *digest = (u32 *) target; const u32 r0 = digest[DGST_R0]; const u32 r1 = digest[DGST_R1]; const u32 r2 = digest[DGST_R2]; const u32 r3 = digest[DGST_R3]; COMPARE_S_SCALAR (r0, r1, r2, r3); } }
OpenCL
4
Masha/hashcat
OpenCL/m26200_a0-pure.cl
[ "MIT" ]
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" xmlns:xalan="http://xml.apache.org/xslt"/> <xsl:template match="text()"> Let's put some content here </xsl:template> </xsl:stylesheet>
XSLT
2
zealoussnow/chromium
chrome/test/data/extensions/api_test/webnavigation/xslt/transform.xsl
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
#lang scribble/doc @(require "common.rkt") @(tools-title "language-configuration") @(tools-include "language-configuration")
Racket
1
rrthomas/drracket
drracket/scribblings/tools/language-configuration.scrbl
[ "Apache-2.0", "MIT" ]
/****************************************************************************** * Copyright 2018 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ /* * @file */ #include "modules/planning/open_space/coarse_trajectory_generator/node3d.h" #include "absl/strings/str_cat.h" namespace apollo { namespace planning { using apollo::common::math::Box2d; Node3d::Node3d(double x, double y, double phi) { x_ = x; y_ = y; phi_ = phi; } Node3d::Node3d(double x, double y, double phi, const std::vector<double>& XYbounds, const PlannerOpenSpaceConfig& open_space_conf) { CHECK_EQ(XYbounds.size(), 4U) << "XYbounds size is not 4, but" << XYbounds.size(); x_ = x; y_ = y; phi_ = phi; x_grid_ = static_cast<int>( (x_ - XYbounds[0]) / open_space_conf.warm_start_config().xy_grid_resolution()); y_grid_ = static_cast<int>( (y_ - XYbounds[2]) / open_space_conf.warm_start_config().xy_grid_resolution()); phi_grid_ = static_cast<int>( (phi_ - (-M_PI)) / open_space_conf.warm_start_config().phi_grid_resolution()); traversed_x_.push_back(x); traversed_y_.push_back(y); traversed_phi_.push_back(phi); index_ = ComputeStringIndex(x_grid_, y_grid_, phi_grid_); } Node3d::Node3d(const std::vector<double>& traversed_x, const std::vector<double>& traversed_y, const std::vector<double>& traversed_phi, const std::vector<double>& XYbounds, const PlannerOpenSpaceConfig& open_space_conf) { CHECK_EQ(XYbounds.size(), 4U) << "XYbounds size is not 4, but" << XYbounds.size(); CHECK_EQ(traversed_x.size(), traversed_y.size()); CHECK_EQ(traversed_x.size(), traversed_phi.size()); x_ = traversed_x.back(); y_ = traversed_y.back(); phi_ = traversed_phi.back(); // XYbounds in xmin, xmax, ymin, ymax x_grid_ = static_cast<int>( (x_ - XYbounds[0]) / open_space_conf.warm_start_config().xy_grid_resolution()); y_grid_ = static_cast<int>( (y_ - XYbounds[2]) / open_space_conf.warm_start_config().xy_grid_resolution()); phi_grid_ = static_cast<int>( (phi_ - (-M_PI)) / open_space_conf.warm_start_config().phi_grid_resolution()); traversed_x_ = traversed_x; traversed_y_ = traversed_y; traversed_phi_ = traversed_phi; index_ = ComputeStringIndex(x_grid_, y_grid_, phi_grid_); step_size_ = traversed_x.size(); } Box2d Node3d::GetBoundingBox(const common::VehicleParam& vehicle_param_, const double x, const double y, const double phi) { double ego_length = vehicle_param_.length(); double ego_width = vehicle_param_.width(); double shift_distance = ego_length / 2.0 - vehicle_param_.back_edge_to_center(); Box2d ego_box( {x + shift_distance * std::cos(phi), y + shift_distance * std::sin(phi)}, phi, ego_length, ego_width); return ego_box; } bool Node3d::operator==(const Node3d& right) const { return right.GetIndex() == index_; } std::string Node3d::ComputeStringIndex(int x_grid, int y_grid, int phi_grid) { return absl::StrCat(x_grid, "_", y_grid, "_", phi_grid); } } // namespace planning } // namespace apollo
C++
4
jzjonah/apollo
modules/planning/open_space/coarse_trajectory_generator/node3d.cc
[ "Apache-2.0" ]
import { init as initWebpack } from 'next/dist/compiled/webpack/webpack' let installed: boolean = false export function loadWebpackHook() { if (installed) { return } installed = true initWebpack() // hook the Node.js require so that webpack requires are // routed to the bundled and now initialized webpack version require('../build/webpack/require-hook') }
TypeScript
4
blomqma/next.js
packages/next/server/config-utils.ts
[ "MIT" ]
#!/bin/sh set -ex URL=https://dl.google.com/android/repository download_ndk() { mkdir -p /android/ndk cd /android/ndk curl -fO $URL/$1 unzip -q $1 rm $1 mv android-ndk-* ndk } make_standalone_toolchain() { # See https://developer.android.com/ndk/guides/standalone_toolchain.htm python3 /android/ndk/ndk/build/tools/make_standalone_toolchain.py \ --install-dir /android/ndk/$1-$2 \ --arch $1 \ --api $2 } remove_ndk() { rm -rf /android/ndk/ndk } download_and_make_toolchain() { download_ndk $1 && \ make_standalone_toolchain $2 $3 && \ remove_ndk }
Shell
4
Eric-Arellano/rust
src/ci/docker/scripts/android-ndk.sh
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
static const q31_t in_linear_x[40] = { 0x00080000, 0x00180000, 0x00280000, 0x00380000, 0x00480000, 0x00580000, 0x00680000, 0x00780000, 0x00880000, 0x00980000, 0x00A80000, 0x00B80000, 0x00C80000, 0x00D80000, 0x00E80000, 0x00F80000, 0x01080000, 0x01180000, 0x01280000, 0x01380000, 0x01480000, 0x01580000, 0x01680000, 0x01780000, 0x01880000, 0x01980000, 0x01A80000, 0x01B80000, 0x01C80000, 0x01D80000, 0x01E80000, 0x01F80000, 0x02080000, 0x02180000, 0x02280000, 0x02380000, 0x02480000, 0x02580000, 0x02680000, 0x02780000 }; static const q7_t in_linear_y[41] = { 0x7F, 0x7F, 0x7F, 0x7D, 0x75, 0x67, 0x4D, 0x28, 0xF7, 0xC2, 0x95, 0x80, 0x93, 0xD1, 0x27, 0x6F, 0x7B, 0x37, 0xC8, 0x82, 0xAA, 0x27, 0x7E, 0x45, 0xB4, 0x86, 0x07, 0x7E, 0x28, 0x8B, 0xC4, 0x71, 0x37, 0x88, 0xE6, 0x7F, 0xE1, 0x93, 0x64, 0x22, 0x82 }; static const q7_t ref_linear[40] = { 0x7F, 0x7F, 0x7E, 0x79, 0x6E, 0x5A, 0x3A, 0x0F, 0xDC, 0xAB, 0x8A, 0x8A, 0xB2, 0xFC, 0x4B, 0x75, 0x59, 0xFF, 0xA5, 0x96, 0xE9, 0x53, 0x62, 0xFD, 0x9D, 0xC7, 0x43, 0x53, 0xDA, 0xA8, 0x1B, 0x54, 0xE0, 0xB7, 0x33, 0x31, 0xBA, 0xFB, 0x43, 0xD2 }; static const q31_t in_bilinear_x[300] = { 0x00080000, 0x00080000, 0x000F1C72, 0x00080000, 0x001638E4, 0x00080000, 0x001D5555, 0x00080000, 0x002471C7, 0x00080000, 0x002B8E39, 0x00080000, 0x0032AAAB, 0x00080000, 0x0039C71C, 0x00080000, 0x0040E38E, 0x00080000, 0x00480000, 0x00080000, 0x00080000, 0x000DB6DB, 0x000F1C72, 0x000DB6DB, 0x001638E4, 0x000DB6DB, 0x001D5555, 0x000DB6DB, 0x002471C7, 0x000DB6DB, 0x002B8E39, 0x000DB6DB, 0x0032AAAB, 0x000DB6DB, 0x0039C71C, 0x000DB6DB, 0x0040E38E, 0x000DB6DB, 0x00480000, 0x000DB6DB, 0x00080000, 0x00136DB7, 0x000F1C72, 0x00136DB7, 0x001638E4, 0x00136DB7, 0x001D5555, 0x00136DB7, 0x002471C7, 0x00136DB7, 0x002B8E39, 0x00136DB7, 0x0032AAAB, 0x00136DB7, 0x0039C71C, 0x00136DB7, 0x0040E38E, 0x00136DB7, 0x00480000, 0x00136DB7, 0x00080000, 0x00192492, 0x000F1C72, 0x00192492, 0x001638E4, 0x00192492, 0x001D5555, 0x00192492, 0x002471C7, 0x00192492, 0x002B8E39, 0x00192492, 0x0032AAAB, 0x00192492, 0x0039C71C, 0x00192492, 0x0040E38E, 0x00192492, 0x00480000, 0x00192492, 0x00080000, 0x001EDB6E, 0x000F1C72, 0x001EDB6E, 0x001638E4, 0x001EDB6E, 0x001D5555, 0x001EDB6E, 0x002471C7, 0x001EDB6E, 0x002B8E39, 0x001EDB6E, 0x0032AAAB, 0x001EDB6E, 0x0039C71C, 0x001EDB6E, 0x0040E38E, 0x001EDB6E, 0x00480000, 0x001EDB6E, 0x00080000, 0x00249249, 0x000F1C72, 0x00249249, 0x001638E4, 0x00249249, 0x001D5555, 0x00249249, 0x002471C7, 0x00249249, 0x002B8E39, 0x00249249, 0x0032AAAB, 0x00249249, 0x0039C71C, 0x00249249, 0x0040E38E, 0x00249249, 0x00480000, 0x00249249, 0x00080000, 0x002A4925, 0x000F1C72, 0x002A4925, 0x001638E4, 0x002A4925, 0x001D5555, 0x002A4925, 0x002471C7, 0x002A4925, 0x002B8E39, 0x002A4925, 0x0032AAAB, 0x002A4925, 0x0039C71C, 0x002A4925, 0x0040E38E, 0x002A4925, 0x00480000, 0x002A4925, 0x00080000, 0x00300000, 0x000F1C72, 0x00300000, 0x001638E4, 0x00300000, 0x001D5555, 0x00300000, 0x002471C7, 0x00300000, 0x002B8E39, 0x00300000, 0x0032AAAB, 0x00300000, 0x0039C71C, 0x00300000, 0x0040E38E, 0x00300000, 0x00480000, 0x00300000, 0x00080000, 0x0035B6DB, 0x000F1C72, 0x0035B6DB, 0x001638E4, 0x0035B6DB, 0x001D5555, 0x0035B6DB, 0x002471C7, 0x0035B6DB, 0x002B8E39, 0x0035B6DB, 0x0032AAAB, 0x0035B6DB, 0x0039C71C, 0x0035B6DB, 0x0040E38E, 0x0035B6DB, 0x00480000, 0x0035B6DB, 0x00080000, 0x003B6DB7, 0x000F1C72, 0x003B6DB7, 0x001638E4, 0x003B6DB7, 0x001D5555, 0x003B6DB7, 0x002471C7, 0x003B6DB7, 0x002B8E39, 0x003B6DB7, 0x0032AAAB, 0x003B6DB7, 0x0039C71C, 0x003B6DB7, 0x0040E38E, 0x003B6DB7, 0x00480000, 0x003B6DB7, 0x00080000, 0x00412492, 0x000F1C72, 0x00412492, 0x001638E4, 0x00412492, 0x001D5555, 0x00412492, 0x002471C7, 0x00412492, 0x002B8E39, 0x00412492, 0x0032AAAB, 0x00412492, 0x0039C71C, 0x00412492, 0x0040E38E, 0x00412492, 0x00480000, 0x00412492, 0x00080000, 0x0046DB6E, 0x000F1C72, 0x0046DB6E, 0x001638E4, 0x0046DB6E, 0x001D5555, 0x0046DB6E, 0x002471C7, 0x0046DB6E, 0x002B8E39, 0x0046DB6E, 0x0032AAAB, 0x0046DB6E, 0x0039C71C, 0x0046DB6E, 0x0040E38E, 0x0046DB6E, 0x00480000, 0x0046DB6E, 0x00080000, 0x004C9249, 0x000F1C72, 0x004C9249, 0x001638E4, 0x004C9249, 0x001D5555, 0x004C9249, 0x002471C7, 0x004C9249, 0x002B8E39, 0x004C9249, 0x0032AAAB, 0x004C9249, 0x0039C71C, 0x004C9249, 0x0040E38E, 0x004C9249, 0x00480000, 0x004C9249, 0x00080000, 0x00524925, 0x000F1C72, 0x00524925, 0x001638E4, 0x00524925, 0x001D5555, 0x00524925, 0x002471C7, 0x00524925, 0x002B8E39, 0x00524925, 0x0032AAAB, 0x00524925, 0x0039C71C, 0x00524925, 0x0040E38E, 0x00524925, 0x00480000, 0x00524925, 0x00080000, 0x00580000, 0x000F1C72, 0x00580000, 0x001638E4, 0x00580000, 0x001D5555, 0x00580000, 0x002471C7, 0x00580000, 0x002B8E39, 0x00580000, 0x0032AAAB, 0x00580000, 0x0039C71C, 0x00580000, 0x0040E38E, 0x00580000, 0x00480000, 0x00580000 }; static const q7_t in_bilinear_y[56] = { 0x62, 0x7A, 0x82, 0xC8, 0x8A, 0x58, 0xA3, 0x2F, 0xB5, 0x3C, 0xA5, 0xF7, 0x3C, 0x71, 0xD6, 0x4F, 0xBF, 0x57, 0x04, 0xC8, 0x8C, 0x96, 0x8B, 0x7B, 0x45, 0x7B, 0x9F, 0x52, 0xCA, 0x81, 0x7B, 0x03, 0x57, 0xD8, 0x79, 0x8A, 0x97, 0x72, 0x58, 0x7F, 0x90, 0x3E, 0x06, 0x6F, 0x9B, 0x2E, 0xD4, 0xF7, 0x80, 0xE6, 0x88, 0x70, 0xE5, 0x3E, 0xF5, 0x7F }; static const uint16_t in_bilinear_config[2] = { 0x0007, 0x0008 }; static const q7_t ref_bilinear[150] = { 0x30, 0x1A, 0x01, 0xE8, 0xD4, 0xC2, 0xB8, 0xBD, 0xC8, 0x05, 0x03, 0xD6, 0xF0, 0x14, 0x01, 0xCB, 0xB4, 0xD0, 0xED, 0x14, 0xF9, 0xDA, 0xF3, 0x15, 0x0A, 0xE3, 0xD3, 0xE8, 0xFC, 0x0F, 0x04, 0x0C, 0x04, 0xF9, 0xFB, 0x05, 0x09, 0x03, 0xFE, 0xFC, 0x10, 0x3E, 0x14, 0xDD, 0xEC, 0x26, 0x3F, 0x1F, 0x00, 0xEA, 0xED, 0x13, 0x0A, 0xFB, 0x0F, 0x38, 0x4B, 0x37, 0x20, 0xF1, 0xBF, 0xCF, 0xF9, 0x27, 0x3D, 0x46, 0x4C, 0x4E, 0x47, 0xFF, 0x90, 0x8B, 0xE8, 0x53, 0x6C, 0x54, 0x4E, 0x66, 0x6F, 0x0D, 0x98, 0x89, 0xE6, 0x53, 0x66, 0x43, 0x38, 0x55, 0x64, 0x10, 0x9F, 0x87, 0xE4, 0x52, 0x5F, 0x32, 0x22, 0x44, 0x58, 0x14, 0xA4, 0x86, 0xE3, 0x51, 0x5B, 0x29, 0x16, 0x3A, 0x52, 0x16, 0x9C, 0x8C, 0xE7, 0x50, 0x61, 0x3E, 0x32, 0x4F, 0x5E, 0x11, 0x95, 0x92, 0xEA, 0x4F, 0x67, 0x53, 0x4E, 0x64, 0x6B, 0x0B, 0xA9, 0xB4, 0xF3, 0x39, 0x53, 0x52, 0x56, 0x5F, 0x5C, 0x03, 0xE6, 0x00, 0x04, 0x06, 0x17, 0x32, 0x3F, 0x33, 0x24, 0xF7 };
Max
3
Trifunik/zephyr
tests/lib/cmsis_dsp/interpolation/src/q7.pat
[ "Apache-2.0" ]
import "ast_new" as ast import "parser_new" as parser import "lexer" as lexer import "io" as io import "sys" as sys def settings = object { var inputdir:String is public := "" var outputdir:String is public := "" var verbosity:Number is public := 0 var publicOnly:Boolean is public := false def version:Number is public = 1.0 } method parsearguments { def args = sys.argv if (args.size > 1) then { def indices = args.indices var skip := true for (indices) do { i -> def arg = args.at(i) if (arg.at(1)=="-") then { match (arg) case { "-i" -> if (args.size < (i+1)) then { io.error.write "gracedoc: -i requires an argument.\n" sys.exit(1) } skip := true settings.inputdir := args.at(i+1) } case { "-o" -> if (args.size < (i+1)) then { io.error.write "gracedoc: -o requires an argument.\n" sys.exit(1) } skip := true settings.outputdir := args.at(i+1) } case { "-v" -> if (args.size < (i+1)) then { io.error.write "gracedoc: -v requires an argument.\n" sys.exit(1) } skip := true settings.verbosity := args.at(i+1).asNumber } case { "--publiconly" -> settings.publicOnly := true } case { "--help" -> print "Usage: {args.at(1)} -i <path> -o <path> [-v <level>] [--help] [--publiconly]" print " -i <path> The Grace file to process (with path relative to ./minigrace executable)" print " -o <path> The directory to contain the generated HTML files" print " [-v <level>] Optional. Level of detail in output (0 = none, 1 = some, 2 = all), default is 0" print " [--publiconly] Optional. If set, only public methods are documented and public variables are listed as methods. Default is off." print " [--help] Optional. Print this usage information." } case { _ -> io.error.write "gracedoc: Invalid argument {arg}.\n" } } else { if (skip == true) then { skip := false } else { io.error.write "gracedoc: Invalid argument {arg}. Arguments must start with a -.\n" sys.exit(1) } } } if ((settings.inputdir=="") || (settings.outputdir=="")) then { io.error.write "gracedoc: Both the -i and -o arguments are required.\n" sys.exit(1) } } else { io.error.write "gracedoc: Both the -i and -o arguments are required.\n" sys.exit(1) } } type Section = type { html -> String isEmpty -> Boolean insert -> Done } class section.withTemplate(html')andCursorAt(idx) -> Section { var html:String is readable := html' var hasContent is readable := false var cursor:Number is confidential := idx var elts is public := dictionary.empty method addElement(n:String)withText(t:String) { hasContent := true elts.at(n)put(t) } method insert(t:String) { hasContent := true def begin = html.substringFrom(1)to(cursor) def end = html.substringFrom(cursor+1)to(html.size) html := "{begin}{t}{end}" cursor := cursor + t.size } method alphabetize { var alpha := elts.keys.sorted var numElts := 0 for (alpha) do { k -> var rowClass if ((numElts % 2) == 0) then { rowClass := "row-even" } else { rowClass := "row-odd" } elts.at(k)put(elts.at(k).replace("class='placeholder'") with("class='{rowClass}'")) insert(elts.at(k)) numElts := numElts + 1 } } } method trim(c:String) -> String { var start := 1 var end := c.size while { c[start] == " " } do { start := start + 1 } while { c[end] == " " } do { end := end - 1 } return c.substringFrom(start)to(end) } method indent(n:Number) -> String { //unrolled for optimization if (n==0) then { return "" } elseif (n==1) then { return " " } elseif (n==2) then { return " " } elseif (n==3) then { return " " } elseif (n==4) then { return " " } elseif (n==5) then { return " " } elseif (n==6) then { return " " } elseif (n==7) then { return " " } elseif (n==8) then { return " " } else { return " "} } method autoindent(input) { def indentedtags = set.with("link", "td", "meta", "style", "title", "table", "div", "tr", "th", "iframe", "script", "section", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "li", "html", "body", "head", "hr") def samelineclosingtags = set.with("a", "span", "td", "th", "li", "h1", "h2", "h3", "h4", "h5", "h6", "title", "script", "b", "i", "em", "strong") var stack:Number := 0 def inputSize = input.length var output := "" var char1 var char2 var cidx := 1 var tagName while { cidx <= inputSize } do { tagName := "" char1 := input.at(cidx) char2 := input.at(cidx+1) if (char1=="<") then { if (char2!="/") then { //OPENING TAG var idx := cidx + 1 while {(input.at(idx)!=" ") && (input.at(idx)!=">")} do { tagName := tagName ++ input.at(idx) idx := idx + 1 } if (indentedtags.contains(tagName)) then { if (tagName != "html") then { output := output ++ "\n" } output := output ++ indent(stack) stack := stack + 1 } } else { //CLOSING TAG var idx := cidx + 2 while {input.at(idx)!=">"} do { tagName := tagName ++ input.at(idx) idx := idx + 1 } if (indentedtags.contains(tagName)) then { stack := stack - 1 if (!samelineclosingtags.contains(tagName)) then { output := output ++ "\n" ++ indent(stack) } } } } elseif ((char1=="/") && (char2==">")) then { //ABBREVIATED CLOSING TAG stack := stack - 1 } output := output ++ char1 cidx := cidx + 1 } return output } class directoryBuildingVisitor.createFrom(in)outTo(dir)as(pageType) { inherits ast.baseVisitor var isClass := false var isType := false if (pageType=="class") then { isClass := true } elseif (pageType=="type") then { isType := true } def pageName = if (in.endsWith(".grace").not) then { in } else { in.substringFrom(0)to(in.size - 6) } def title = if (isType) then { "Type: {pageName}" } elseif (isClass) then { "Class: {pageName}" } else { "Module: {pageName}" } def outdir = if (isClass || isType) then { dir } else { pageName } method generate is public { var outfile if (!io.exists("{settings.outputdir}")) then { io.system("mkdir {settings.outputdir}") } if (!io.exists("{settings.outputdir}/{outdir}")) then { io.system("mkdir {settings.outputdir}/{outdir}") } if (!io.exists("{settings.outputdir}/{outdir}/classes")) then { io.system("mkdir {settings.outputdir}/{outdir}/classes") } if (!io.exists("{settings.outputdir}/{outdir}/types")) then { io.system("mkdir {settings.outputdir}/{outdir}/types") } if (isClass) then { outfile := io.open("{settings.outputdir}/{outdir}/classes/{pageName}.html", "w") } elseif (isType) then { outfile := io.open("{settings.outputdir}/{outdir}/types/{pageName}.html", "w") } else { outfile := io.open("{settings.outputdir}/{outdir}/{pageName}.html", "w") } outfile.write("TEMPORARY") outfile.close if (!isClass && !isType) then { // Rebuild the modules list with contents var out := "<!-- generated by Gracedoc, v{settings.version} -- https://github.com/reid47/gracedoc -->\n" out := out ++ "<!DOCTYPE html>\n<html>" out := out ++ "<head>" out := out ++ "<title>Modules | GraceDocs</title>" out := out ++ "<meta charset=\"UTF-8\" />" out := out ++ "<link rel=\"stylesheet\" href=\"gracedoc.css\">" out := out ++ "<script type='text/javascript' src=\"gracedoc.js\"></script>" out := out ++ "</head>" out := out ++ "<body>" out := out ++ "<div class='list-container'>" out := out ++ "<h5>Modules</h5><ul>" var modules := io.listdir(settings.outputdir) def modit = modules.iterator while {modit.hasNext} do { var mod := modit.next if ((mod.startsWith(".")==false) && (!mod.endsWith(".css")) && (!mod.endsWith(".js")) && (mod != "index.html") && (mod != "modules.html") && (mod != "404.html") && (mod != "inputs")) then { out := out ++ "<li><span class='arrow-button-toggle' id='arrow-button-{mod}' onclick=\"toggleContents('{mod}');\">&#9654;</span><a href='{mod}/{mod}.html' target='mainFrame'>{mod}</a></li>" out := out ++ "<div class='contents-list' id='contents-{mod}' style='display:none;'>" out := out ++ "<h6>Types</h6><ul>" var types := io.listdir("{settings.outputdir}/{mod}/types") def typit = types.iterator while {typit.hasNext} do { var typ := typit.next typ := typ.substringFrom(1)to(typ.size - 5) if ((typ.startsWith(".")==false) && (typ != "contents.html")) then { out := out ++ "<li><a href='{mod}/types/{typ}.html' target='mainFrame'>{typ}</a></li>" } } out := out ++ "</ul>" out := out ++ "<h6>Classes</h6><ul>" var clss := io.listdir("{settings.outputdir}/{mod}/classes") def clsit = clss.iterator while {clsit.hasNext} do { var cls := clsit.next cls := cls.substringFrom(1)to(cls.size - 5) if ((cls.startsWith(".")==false) && (cls != "contents.html")) then { out := out ++ "<li><a href='{mod}/classes/{cls}.html' target='mainFrame'>{cls}</a></li>" } } out := out ++ "</ul>" out := out ++ "</div>" } } out := out ++ "</ul></div></body>" out := out ++ "</html>" var moduleslistfile := io.open("{settings.outputdir}/modules.html", "w") moduleslistfile.write(autoindent(out)) moduleslistfile.close } } method visitTypeDec(o) -> Boolean { if (isType == false) then { def typeVis = directoryBuildingVisitor.createFrom("{o.name.value}")outTo("{outdir}")as("type") o.accept(typeVis) typeVis.generate return false } else { return true } } method visitClass(o) -> Boolean { if (isClass == false) then { if(o.superclass != false) then { o.superclass.accept(self) } def classVis = directoryBuildingVisitor.createFrom("{o.name.value}")outTo("{outdir}")as("class") o.accept(classVis) classVis.generate return false } else { return true } } } class graceDocVisitor.createFrom(in)outTo(dir)as(pageType) { inherits ast.baseVisitor var isClass := false var isType := false if (pageType=="class") then { isClass := true } elseif (pageType=="type") then { isType := true } def pageName = if (in.endsWith(".grace").not) then { in } else { in.substringFrom(0)to(in.size - 6) } def title = if (isType) then { "Type: {pageName}" } elseif (isClass) then { "Class: {pageName}" } else { "Module: {pageName}" } var headerSection var methodsSection var typesSection var fieldsSection var classesSection var footerSection var methodtypesSection var topDescSection //debugging if (settings.verbosity > 1) then { print "On {title} - graceDocVisitor created... ({sys.cputime})" } def outdir = if (isClass || isType) then { dir } else { pageName } buildTemplate method getTypeLink(v:String) is confidential { def filename = "{v}.html" var out := "<a href='" //first, check current module's types directory for filename if (io.exists("{settings.outputdir}/{outdir}/types/{filename}")) then { if (isType) then { out := out ++ "{filename}" } elseif (isClass) then { out := out ++ "../types/{filename}" } else { out := out ++ "types/{filename}" } //if not found, check imported module directories } elseif (io.exists("{settings.outputdir}/imported/types/{filename}")) then { if (isType || isClass) then { out := out ++ "../../imported/types/{filename}" } else { out := out ++ "../imported/types/{filename}" } //if not found, check gracelib types } elseif (io.exists("{settings.outputdir}/gracelib/types/{filename}")) then { if (isType || isClass) then { out := out ++ "../../gracelib/types/{filename}" } else { out := out ++ "../gracelib/types/{filename}" } } else { var dots := "" if (isClass || isType) then { dots := "../../" } else { dots := "../" } out := out ++ "{dots}404.html" } out := out ++ "'>{v}</a>" return out } method getClassLink(c:String) is confidential { def filename = "{c}.html" var out := "<a href='" //first, check current module's class directory for filename if (io.exists("{settings.outputdir}/{outdir}/classes/{filename}")) then { if (isClass) then { out := out ++ "{filename}" } elseif (isType) then { out := out ++ "../classes/{filename}" } else { out := out ++ "classes/{filename}" } //if not found, check imported module directories } elseif (io.exists("{settings.outputdir}/imported/classes/{filename}")) then { if (isType || isClass) then { out := out ++ "../../imported/classes/{filename}" } else { out := out ++ "../imported/classes/{filename}" } //if not found, check gracelib classes } elseif (io.exists("{settings.outputdir}/gracelib/classes/{filename}")) then { if (isType || isClass) then { out := out ++ "../../gracelib/classes/{filename}" } else { out := out ++ "../gracelib/classes/{filename}" } } else { var dots := "" if (isClass || isType) then { dots := "../../" } else { dots := "../" } out := out ++ "{dots}404.html" } out := out ++ "'>{c}</a>" return out } method buildTemplate is confidential { var cursor := 0 var out := "<!-- generated by Gracedoc, v{settings.version} -- https://github.com/reid47/gracedoc -->\n" out := out ++ "<!DOCTYPE html>\n<html>" out := out ++ "<head>" out := out ++ "<title>{title} | GraceDocs</title>" out := out ++ "<meta charset=\"UTF-8\" />" var cssDir if (isClass || isType) then { cssDir := "../../gracedoc.css" } else { cssDir := "../gracedoc.css" } out := out ++ "<link rel=\"stylesheet\" href=\"{cssDir}\" />" out := out ++ "</head>" out := out ++ "<body>" out := out ++ "<div class='header'><span class='header-left'>{title}" cursor := out.size out := out ++ "</span><span class='header-right'>GraceDocs</span></div>" out := out ++ "<div class='container'>" headerSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "<section id='top-description'>" out := out ++ "<div class='top-box'>" cursor := out.size out := out ++ "</div>" out := out ++ "</section>" topDescSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "<section id='fields'>" out := out ++ "<h4>Fields</h4>" out := out ++ "<table>" out := out ++ "<tr><th></th><th>Field name</th><th>Type (if given)</th></tr>" cursor := out.size out := out ++ "</table>" out := out ++ "</section>" fieldsSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "<section id='methodtypes'>" out := out ++ "<h4>Added methods</h4>" out := out ++ "<table>" out := out ++ "<tr><th>Method signature</th><th>Return type</th></tr>" cursor := out.size out := out ++ "</table>" out := out ++ "</section>" methodtypesSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "<section id='types'>" out := out ++ "<h4>Types</h4>" out := out ++ "<table>" out := out ++ "<tr><th>Type name</th></tr>" cursor := out.size out := out ++ "</table>" out := out ++ "</section>" typesSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "<section id='classes'>" out := out ++ "<h4>Classes</h4>" out := out ++ "<table>" out := out ++ "<tr><th>Class name & constructor</th></tr>" cursor := out.size out := out ++ "</table>" out := out ++ "</section>" classesSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "<section id='methods'>" out := out ++ "<h4>Methods</h4>" out := out ++ "<table>" out := out ++ "<tr><th>Method signature</th><th>Return type</th></tr>" cursor := out.size out := out ++ "</table>" out := out ++ "</section>" methodsSection := section.withTemplate(out)andCursorAt(cursor) cursor := 0 out := "</div></body>" out := out ++ "</html>" footerSection := section.withTemplate(out)andCursorAt(cursor) } method build404 { var out := "<!-- generated by Gracedoc, v{settings.version} -- https://github.com/reid47/gracedoc -->\n" out := out ++ "<!DOCTYPE html>\n<html>" out := out ++ "<head><title>404 - Page not found | GraceDocs</title></head>" out := out ++ "<body><div id='message-404'>404 - Page not found</div></body>" out := out ++ "</html>" var file404 := io.open("{settings.outputdir}/404.html", "w") file404.write(autoindent(out)) file404.close } method buildindex { var out := "<!-- generated by Gracedoc, v{settings.version} -- https://github.com/reid47/gracedoc -->\n" out := out ++ "<!DOCTYPE html>\n<html lang=\"en\">" out := out ++ "<head>" out := out ++ "<title>GraceDocs</title>" out := out ++ "<link rel=\"stylesheet\" href=\"gracedoc.css\">" out := out ++ "</head>" out := out ++ "<body>" out := out ++ "<iframe id=\"frame-sidebar\" src=\"modules.html\" name=\"moduleFrame\"></iframe>" out := out ++ "<iframe id=\"frame-main\" src=\"\" name=\"mainFrame\"></iframe>" out := out ++ "</body>" out := out ++ "</html>" var fileindex := io.open("{settings.outputdir}/index.html", "w") fileindex.write(autoindent(out)) fileindex.close } method buildjs { var out := ‹function toggleContents(eltid) { var elt = document.getElementById('contents-'+eltid) var arrow = document.getElementById('arrow-button-'+eltid) if (elt.style.display == 'none') { elt.style.display = 'block'; arrow.innerHTML = '&#9660'; } else { elt.style.display = 'none'; arrow.innerHTML = '&#9654'; } }› var filejs := io.open("{settings.outputdir}/gracedoc.js", "w") filejs.write(out) filejs.close } method buildcss { var out := ‹@import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700); * { margin: 0px; padding: 0px; } body { font-size: 16px; font-family: 'Open Sans', Helvetica, Arial, sans-serif; } a, a:visited { color: #00d; } .header { height: 50px; line-height: 50px; padding: 0px 20px; font-weight: bold; background-color: rgb(0,80,105); border-bottom: 2px solid #333; font-size: 20px; color: #fff; } .header-left { float: left; } .header-right { float: right; } .description { font-style: italic; font-size: 14px; } .container { padding: 20px; } section { border: 1px solid #079; border-radius: 0px; } section > h4 { margin: 0px; background-color: rgb(80,160,185); padding: 5px 10px; } section + section { margin-top: 20px; } table { margin: 0px; width: 100%; border-collapse: collapse; table-layout: fixed; } th { text-align: left; background: rgb(130,200,215); color: rgb(0,80,105); font-size: 10px; padding: 5px 10px; border-bottom: 1px solid #079; } td { padding: 10px; word-wrap: break-word; } .row-odd { background-color: #eeeeee; } .row-odd + tr.description { background-color: #eeeeee; } .row-even { background-color: #ffffff; } .row-even + tr.description { background-color: #ffffff; } tr.description > td { padding-top: 0px; } .code, code { font-family: Monaco, monospace; } .description { font-size: 14px; width: 50%; } .parameter-type { font-family: Monaco, monospace; } .type-name { font-family: Monaco, monospace; font-weight: bold; } .method-name { font-weight: bold; } .class-name { font-weight: bold; } .identifier-name { font-family: Monaco, monospace; font-weight: bold; } /* MODULES LIST */ .list-container h5 { font-size: 16px; background-color: rgb(0,80,105); color: #ffffff; padding: 5px 10px; } .list-container h6 { font-size: 12px; margin: 0px; color: #000; padding: 0px 5px; } .list-container ul { padding: 5px 10px 10px 10px; } .list-container li { list-style-type: none; } iframe { border: none; } #frame-sidebar { position: absolute; left: 0; top: 0; width: 20%; height: 100%; } #frame-main { position: absolute; right: 0; top: 0; width: 80%; height: 100%; border-left: 4px solid #bbb } .contents-list { background: #e0e8f0; padding: 10px 5px 5px 5px; margin-left: 20px; margin-right: 20px; font-size: 14px; } .arrow-button-toggle { font-family: monospace; font-size: 14px; color: rgb(0,0,105); cursor: pointer; width: 20px; display: inline-block; } .top-box { word-wrap: break-word; margin: 20px; } .top-box hr { margin: 10px 0; border: 1px solid #079; } .headline { font-size: 18px; } .quiet { color: #888; font-size: 14px; }› var filecss := io.open("{settings.outputdir}/gracedoc.css", "w") filecss.write(out) filecss.close } method generate is public { if (settings.verbosity > 1) then { print "On {title} - starting to assemble HTML ({sys.cputime})" } var outfile var output := "" if (isClass) then { outfile := io.open("{settings.outputdir}/{outdir}/classes/{pageName}.html", "w") } elseif (isType) then { outfile := io.open("{settings.outputdir}/{outdir}/types/{pageName}.html", "w") } else { outfile := io.open("{settings.outputdir}/{outdir}/{pageName}.html", "w") } output := output ++ headerSection.html if (topDescSection.hasContent) then { output := output ++ topDescSection.html } if (fieldsSection.hasContent) then { fieldsSection.alphabetize output := output ++ fieldsSection.html } if (methodtypesSection.hasContent) then { methodtypesSection.alphabetize output := output ++ methodtypesSection.html } if (typesSection.hasContent) then { typesSection.alphabetize output := output ++ typesSection.html } if (classesSection.hasContent) then { classesSection.alphabetize output := output ++ classesSection.html } if (methodsSection.hasContent) then { methodsSection.alphabetize output := output ++ methodsSection.html } output := output ++ footerSection.html output := autoindent(output) outfile.write(output) outfile.close if (settings.verbosity > 1) then { print "On {title} - file written ({sys.cputime})" } } method visitMethodType(o) -> Boolean { if (isType == true) then { var t := "<tr class='placeholder'><td><code>" var n := "" for (o.signature) do { part -> t := t ++ "<span class='method-name'>" ++ part.name ++ "</span>" n := n ++ part.name if (part != o.signature.last) then { n := n ++ "()" } if (part.params.size > 0) then { t := t ++ "(" for (part.params) do { param -> if (param.dtype != false) then { t := t ++ "<span class='parameter-name'>" ++ param.nameString ++ "</span>" t := t ++ ":" if (param.dtype.kind == "identifier") then { t := t ++ getTypeLink(param.dtype.value) } elseif (param.dtype.kind == "generic") then { t := t ++ getTypeLink(param.dtype.value.value) ++ "&lt;" param.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } else { t := t ++ "<span class='parameter-name'>" ++ param.nameString ++ "</span>" } if ((part.params.size > 1) && (param != part.params.last)) then { t := t ++ ", " } } t := t ++ ")" } } t := t ++ "</code></td>" t := t ++ "<td><code>" if (o.rtype != false) then { if (o.rtype.kind == "identifier") then { t := t ++ getTypeLink(o.rtype.value) } elseif (o.rtype.kind == "generic") then { t := t ++ getTypeLink(o.rtype.value.value) ++ "&lt;" o.rtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } else { t := t ++ "Done" } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='2'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } methodtypesSection.addElement(n)withText(t) return false } else { return true } } method visitTypeDec(o) -> Boolean { if (isType == false) then { var t := "<tr class='placeholder'>" def n = o.name.value t := t ++ "<td class='type-name'>{getTypeLink(o.name.value)}" if (false != o.generics) then { t := t ++ "&lt;" for (o.generics.params) do { g -> t := t ++ g.nameString if (g != o.generics.params.last) then { t := t ++ ", " } } t := t ++ "&gt;" } t := t ++ "</td></tr>" def typeVis = graceDocVisitor.createFrom("{o.name.value}")outTo("{outdir}")as("type") o.accept(typeVis) typeVis.generate if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td>" t := t ++ "</tr>" } typesSection.addElement(n)withText(t) return false } else { var t := "<span class='headline'><b><code>{o.name.value}" if (false != o.generics) then { t := t ++ "&lt;" for (o.generics.params) do { g-> t := t ++ g.nameString if (g != o.generics.params.last) then { t := t ++ ", " } } t := t ++ "&gt;" } t := t ++ "</b> = " var temp := "" var ops := list.empty var tps := list.empty var node := o.value if (node.kind == "op") then { while {node.kind == "op"} do { ops.push(node.value) if ((node.left.kind == "identifier") && (node.right.kind == "identifier")) then { temp := "{getTypeLink(node.left.value)} {ops.pop} {getTypeLink(node.right.value)}" } elseif (node.right.kind == "identifier") then { tps.push(node.right.value) } elseif (node.left.kind == "identifier") then { temp := "{getTypeLink(node.left.value)} {ops.pop}" } elseif (node.left.kind == "member") then { temp := getTypeLink("{node.left.in.value}.{node.left.value}") ++ " {ops.pop}" } elseif (node.right.kind == "member") then { tps.push("{node.left.in.value}.{node.left.value}") } node := node.left } while {(tps.size > 0) && (ops.size > 0)} do { def p = tps.pop temp := "{temp} {ops.pop} {getTypeLink(p.value)}" } if (ops.size > 0) then { temp := "{temp} {ops.pop}" } t := t ++ temp ++ " type " t := t ++ "\{ <span class='quiet'>...added methods below...</span> \}" } elseif (node.kind == "typeliteral") then { t := t ++ temp ++ " type " t := t ++ "\{ <span class='quiet'>...added methods below...</span> \}" } elseif (node.kind == "identifier") then { t := t ++ " " ++ getTypeLink(node.value) if (node.generics != false) then { t := t ++ "&lt;" for (node.generics) do { g-> t := t ++ g.value if (g != node.generics.last) then { t := t ++ ", " } } t := t ++ "&gt;" } } elseif (node.kind == "member") then { t := t ++ getTypeLink("{node.in.value}.{node.value}") if (node.generics != false) then { t := t ++ "&lt;" for (node.generics) do { g-> t := t ++ g.value if (g != node.generics.last) then { t := t ++ ", " } } t := t ++ "&gt;" } } t := t ++ "</code></span>" t := t ++ "<hr />" if (o.comments.size > 0) then { t := t ++ "<div class='top-box-description'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</div>" } topDescSection.insert(t) return true } } method visitMethod(o) -> Boolean { if (settings.publicOnly && o.isConfidential) then { return false } var t := "<tr class='placeholder'><td><code>" var n := "" for (o.signature) do { part -> t := t ++ "<span class='method-name'>" ++ part.name ++ "</span>" n := n ++ part.name if (part != o.signature.last) then { n := n ++ "()" } if (part.params.size > 0) then { t := t ++ "(" for (part.params) do { param -> if (param.dtype != false) then { t := t ++ "<span class='parameter-name'>" ++ param.nameString ++ "</span>" t := t ++ ":<span class='parameter-type'>" if (param.dtype.kind == "identifier") then { t := t ++ getTypeLink(param.dtype.value) } elseif (param.dtype.kind == "generic") then { t := t ++ getTypeLink(param.dtype.value.value) ++ "&lt;" param.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } t := t ++ "</span>" //t := t ++ ":<span class='parameter-type'>" ++ getTypeLink(param.dtype.value) ++ "</span>" } else { t := t ++ "<span class='parameter-name'>" ++ param.nameString ++ "</span>" } if ((part.params.size > 1) && (param != part.params.last)) then { t := t ++ ", " } } t := t ++ ")" } } t := t ++ "</code></td>" t := t ++ "<td><code>" if (o.dtype != false) then { t := t ++ getTypeLink(o.dtype.value) } else { t := t ++ getTypeLink("Done") } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='2'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } methodsSection.addElement(n)withText(t) return false } method visitClass(o) -> Boolean { if (isClass == false) then { var t := "<tr class='placeholder'>" def n = o.name.value t := t ++ "<td><code><span class='class-name'>{getClassLink(o.name.value)}</span>" t := t ++ "." for(o.signature) do { part -> t := t ++ "<span class='method-name'>{part.name}</span>" if (part.params.size > 0) then { t := t ++ "(" for(part.params) do { param -> if (param.dtype != false) then { t := t ++ "<span class='parameter-name'>" ++ param.value ++ "</span>" t := t ++ ":<span class='parameter-type'>" ++ getTypeLink(param.dtype.value) ++ "</span>" } else { t := t ++ "<span class='parameter-name'>" ++ param.value ++ "</span>" } if ((part.params.size > 1) && (param != part.params.last)) then { t := t ++ ", " } } t := t ++ ")" } } if (o.dtype != false) then { t := t ++ " -> " if (o.dtype.kind == "identifier") then { t := t ++ getTypeLink(o.dtype.value) } elseif (o.dtype.kind == "generic") then { t := t ++ getTypeLink(o.dtype.value.value) ++ "&lt;" o.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } t := t ++ "</code></td></tr>" if(o.superclass != false) then { o.superclass.accept(self) } def classVis = graceDocVisitor.createFrom("{o.name.value}")outTo("{outdir}")as("class") o.accept(classVis) classVis.generate if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } classesSection.addElement(n)withText(t) return false } else { var t := "<span class='headline'><code><b>{o.name.value}</b>." for(o.signature) do { part -> t := t ++ "<b>{part.name}</b>" if (part.params.size > 0) then { t := t ++ "(" for(part.params) do { param -> if (param.dtype != false) then { t := t ++ param.value t := t ++ ":" ++ getTypeLink(param.dtype.value) } else { t := t ++ param.value } if ((part.params.size > 1) && (param != part.params.at(part.params.size))) then { t := t ++ ", " } } t := t ++ ")" } } if (o.dtype != false) then { t := t ++ " -> " if (o.dtype.kind == "identifier") then { t := t ++ getTypeLink(o.dtype.value) } elseif (o.dtype.kind == "generic") then { t := t ++ getTypeLink(o.dtype.value.value) ++ "&lt;" o.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } t := t ++ "</code></span><hr />" if (o.comments.size > 0) then { t := t ++ "<div class='top-box-description'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</div>" } topDescSection.insert(t) return true } } method visitDefDec(o) -> Boolean { if (isClass == true) then { if (!settings.publicOnly) then { def n = o.name.value var t := "<tr class='placeholder'><td><code>def</code></td><td class='identifier-name'>{o.name.value}" t := t ++ "</td><td><code>" if (o.dtype != false) then { if (o.dtype.kind == "identifier") then { t := t ++ getTypeLink(o.dtype.value) } elseif (o.dtype.kind == "generic") then { t := t ++ getTypeLink(o.dtype.value.value) ++ "&lt;" o.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='3'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } fieldsSection.addElement(n)withText(t) } else { //in publicOnly mode, readable defs should show up as getter methods if (o.isReadable) then { //FIXME: if isType, then ??? def n = o.name.value var t := "<tr class='placeholder'><td class='identifier-name'>{o.name.value}" t := t ++ "</td><td><code>" if (o.dtype != false) then { if (o.dtype.kind == "identifier") then { t := t ++ getTypeLink(o.dtype.value) } elseif (o.dtype.kind == "generic") then { t := t ++ getTypeLink(o.dtype.value.value) ++ "&lt;" o.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='2'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } methodsSection.addElement(n)withText(t) } } return false } else { if (!settings.publicOnly) then { def n = o.name.value var t := "<tr class='placeholder'><td><code>def</code></td><td class='identifier-name'>{o.name.value}" t := t ++ "</td><td><code>" if (o.dtype != false) then { if (o.dtype.kind == "identifier") then { t := t ++ getTypeLink(o.dtype.value) } elseif (o.dtype.kind == "generic") then { t := t ++ getTypeLink(o.dtype.value.value) ++ "&lt;" o.dtype.params.do { each -> t := "{t}{each.value}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='3'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } fieldsSection.addElement(n)withText(t) } else { //in publicOnly mode, readable defs should show up as getter methods if (o.isReadable) then { var t := "<tr class='placeholder'><td class='identifier-name'>{o.name.value}" def n = o.name.value t := t ++ "</td><td><code>" if (o.dtype != false) then { if (o.dtype.kind == "identifier") then { t := t ++ getTypeLink(o.dtype.value) } elseif (o.dtype.kind == "generic") then { t := t ++ getTypeLink(o.dtype.value.value) ++ "&lt;" o.dtype.params.do { each -> t := "{t}{getTypeLink(each.value)}" } separatedBy { t := t ++ ", " } t := t ++ "&gt;" } } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='2'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } methodsSection.addElement(n)withText(t) } } return false } } method visitVarDec(o) -> Boolean { if (isClass == true) then { if (!settings.publicOnly) then { def n = o.name.value var t := "<tr class='placeholder'><td><code>var</code></td><td class='identifier-name'>{o.name.value}" t := t ++ "</td><td><code>" if (o.dtype != false) then { t := t ++ "{getTypeLink(o.dtype.value)}" } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='3'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } fieldsSection.addElement(n)withText(t) } else { if (o.isReadable) then { var t := "<tr class='placeholder'><td class='identifier-name'>{o.name.value}" def n = o.name.value t := t ++ "</td><td>" if (o.dtype != false) then { t := t ++ "{getTypeLink(o.dtype.value)}" } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='2'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } methodsSection.addElement(n)withText(t) } if (o.isWritable) then { var t := "<tr class='placeholder'><td><code><span class='method-name'>{o.name.value}:=</span>" def n = "{o.name.value}:=" if (o.dtype != false) then { t := t ++ "(_:{getTypeLink(o.dtype.value)})" } t := t ++ "</code></td><td><code>Done</code></td></tr>" t := t ++ "<tr class='description'><td colspan='2'>Updates {o.name.value}</td></tr>" methodsSection.addElement(n)withText(t) } } return false } else { if (!settings.publicOnly) then { def n = o.name.value var t := "<tr class='placeholder'><td><code>var</code></td><td class='identifier-name'>{o.name.value}" t := t ++ "</td><td><code>" if (o.dtype != false) then { t := t ++ "{getTypeLink(o.dtype.value)}" } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='3'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } fieldsSection.addElement(n)withText(t) } else { if (o.isReadable) then { def n = o.name.value var t := "<tr class='placeholder'><td class='identifier-name'>{o.name.value}" t := t ++ "</td><td><code>" if (o.dtype != false) then { t := t ++ "{getTypeLink(o.dtype.value)}" } t := t ++ "</code></td></tr>" if (o.comments.size > 0) then { t := t ++ "<tr class='description'><td colspan='2'>" for (o.comments) do { c -> t := t ++ trim(c.value) ++ " " } t := t ++ "</td></tr>" } methodsSection.addElement(n)withText(t) } if (o.isWritable) then { def n = "{o.name.value}:=" var t := "<tr class='placeholder'><td><code><span class='method-name'>{o.name.value}:=</span>" if (o.dtype != false) then { t := t ++ "(_:{getTypeLink(o.dtype.value)})" } t := t ++ "</code></td><td><code>Done</code></td></tr>" t := t ++ "<tr class='description'><td colspan='2'>Updates {o.name.value}</td></tr>" methodsSection.addElement(n)withText(t) } } return false } } method visitInherits(o) -> Boolean { //if (isClass) then { //} else { return true //} } } parsearguments //var tokens var file var dbv var gdv var modulename //var values var counter var allmodules := io.listdir(settings.inputdir) //var allmodules := list.with(settings.inputdir) var allfilesparsed := dictionary.empty var parsedsomething := false //LEX AND PARSE ALL INPUT FILES counter := 1 for (allmodules) do { filename -> if (filename.endsWith(".grace")) then { file := io.open("{settings.inputdir}/{filename}", "r") //file := io.open("{settings.inputdir}", "r") //if (settings.verbosity > 0) then { print "On {filename} - lexing... ({sys.cputime})" } var tokens := lexer.new.lexfile(file) //if (settings.verbosity > 0) then { print "On {filename} - done lexing... ({sys.cputime})" } if (settings.verbosity > 0) then { print "On {filename} - parsing... ({sys.cputime})" } //allfilesparsed.at(counter)put(list.empty) //var values := parser.parse(tokens) allfilesparsed.at(counter)put(parser.parse(tokens)) if (settings.verbosity > 0) then { print "On {filename} - done parsing... ({sys.cputime})" } counter := counter + 1 parsedsomething := true file.close } } if (!parsedsomething) then { io.error.write "gracedoc: Input error - no Grace files found in the input directory." io.error.write " Either the directory doesn't exist, or it doesn't contain any files." io.error.write " Directories should be named relative to the ./minigrace executable." sys.exit(1) } //BUILD DIRECTORY STRUCTURE counter := 1 for (allmodules) do { filename -> if (filename.endsWith(".grace")) then { if (settings.verbosity > 0) then { print "On {filename} - building directories... ({sys.cputime})" } modulename := filename.substringFrom(1)to(filename.size - 6) var values := allfilesparsed.at(counter) dbv := directoryBuildingVisitor.createFrom(filename)outTo(modulename)as("module") for (values) do { v -> v.accept(dbv) //print(v.pretty(0)) } dbv.generate if (settings.verbosity > 0) then { print "On {filename} - directories built... ({sys.cputime})" } counter := counter + 1 } } //GENERATE ACTUAL HTML PAGES counter := 1 for (allmodules) do { filename -> if (filename.endsWith(".grace")) then { if (settings.verbosity > 0) then { print "On {filename} - generating GraceDocs... ({sys.cputime})" } modulename := filename.substringFrom(1)to(filename.size - 6) var values := allfilesparsed.at(counter) gdv := graceDocVisitor.createFrom(filename)outTo(modulename)as("module") for (values) do { v -> v.accept(gdv) } gdv.generate gdv.buildindex gdv.buildcss gdv.buildjs gdv.build404 if (settings.verbosity > 0) then { print "On {filename} - done! ({sys.cputime})" } counter := counter + 1 } }
Grace
4
smola/language-dataset
data/github.com/reid47/gracedoc/f21ab16e2e1e3b52a95bb8303608c5a7aa58c777/gracedoc.grace
[ "MIT" ]