max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
src/grammar/FooParser.g4
quantumsheep/llvm-antlr4-starter
10
383
<filename>src/grammar/FooParser.g4 parser grammar FooParser; options { tokenVocab = FooLexer; } instructions: instruction*; instruction: ToImplement;
Assembler/testMultitask.asm
Rohansi/LoonyVM
1
170274
<reponame>Rohansi/LoonyVM<filename>Assembler/testMultitask.asm include 'loonyvm.inc' ; setup first task mov r0, tasks mov [r0 + TASK.State], 1 mov [r0 + TASK.Regs.IP], task1 mov [r0 + TASK.Regs.SP], 0x70000 ; and second task add r0, sizeof.TASK mov [r0 + TASK.State], 1 mov [r0 + TASK.Regs.IP], task2 mov [r0 + TASK.Regs.SP], 0x77FFF ; set timer interrupt to 100hz mov r0, 1 mov r1, 100 int 1 ; enable timer mov r0, 0 mov r1, 1 int 1 ; enable keyboard mov r0, 0 mov r1, 1 int 2 ; enable interrupts ivt interruptTable sti ; switch to right stack mov sp, 0x70000 task1: invoke printString, msgPrompt invoke readString, nameBuff, 32 invoke_va printf, msgResponseFmt, nameBuff jmp task1 nameBuff: rb 32 msgPrompt: db 'what is your name? ', 0 msgResponseFmt: db 'hello %s!!', 10, 10, 0 task2: xor r3, r3 .draw: mov r1, termSizeX * termSizeY mov r2, 1 inc r3 rem r3, 255 @@: cmp r1, r1 jz .draw push r2 dec r2 div r2, 2 mov r4, r2 rem r4, termSizeX ; x = i % width mov r5, r2 div r5, termSizeX ; y = i / width pop r2 add r4, r3 add r5, r3 xor r4, r5 and r4, 01110000b or r4, 00001111b mov byte [r2 + termAddr], byte r4 dec r1 add r2, 2 jmp @b timerInterruptHandler: mov bp, sp ; save current task mov r0, [currTask] mul r0, sizeof.TASK add r0, tasks mov [r0 + TASK.Regs.R0], [bp + REGISTERS.R0] mov [r0 + TASK.Regs.R1], [bp + REGISTERS.R1] mov [r0 + TASK.Regs.R2], [bp + REGISTERS.R2] mov [r0 + TASK.Regs.R3], [bp + REGISTERS.R3] mov [r0 + TASK.Regs.R4], [bp + REGISTERS.R4] mov [r0 + TASK.Regs.R5], [bp + REGISTERS.R5] mov [r0 + TASK.Regs.R6], [bp + REGISTERS.R6] mov [r0 + TASK.Regs.R7], [bp + REGISTERS.R7] mov [r0 + TASK.Regs.R8], [bp + REGISTERS.R8] mov [r0 + TASK.Regs.R9], [bp + REGISTERS.R9] mov [r0 + TASK.Regs.BP], [bp + REGISTERS.BP] mov [r0 + TASK.Regs.Flags], [bp + REGISTERS.Flags] mov [r0 + TASK.Regs.IP], [bp + REGISTERS.IP] mov [r0 + TASK.Regs.SP], [bp + REGISTERS.SP] ; find next task mov r1, [currTask] .search: inc r1 add r0, sizeof.TASK rem r1, MAX_TASKS jnz @f mov r0, tasks @@: cmp byte [r0 + TASK.State], 0 je .search ; restore new task mov [bp + REGISTERS.R0], [r0 + TASK.Regs.R0] mov [bp + REGISTERS.R1], [r0 + TASK.Regs.R1] mov [bp + REGISTERS.R2], [r0 + TASK.Regs.R2] mov [bp + REGISTERS.R3], [r0 + TASK.Regs.R3] mov [bp + REGISTERS.R4], [r0 + TASK.Regs.R4] mov [bp + REGISTERS.R5], [r0 + TASK.Regs.R5] mov [bp + REGISTERS.R6], [r0 + TASK.Regs.R6] mov [bp + REGISTERS.R7], [r0 + TASK.Regs.R7] mov [bp + REGISTERS.R8], [r0 + TASK.Regs.R8] mov [bp + REGISTERS.R9], [r0 + TASK.Regs.R9] mov [bp + REGISTERS.BP], [r0 + TASK.Regs.BP] mov [bp + REGISTERS.Flags], [r0 + TASK.Regs.Flags] mov [bp + REGISTERS.IP], [r0 + TASK.Regs.IP] mov [bp + REGISTERS.SP], [r0 + TASK.Regs.SP] mov [currTask], r1 iret interruptTable: dd 0 ; cpu dd timerInterruptHandler dd kbInterruptHandler rd 29 currTask: dd 0 tasks: db sizeof.TASK * MAX_TASKS dup 0 MAX_TASKS = 4 struct REGISTERS R0 dd ? R1 dd ? R2 dd ? R3 dd ? R4 dd ? R5 dd ? R6 dd ? R7 dd ? R8 dd ? R9 dd ? BP dd ? Flags dd ? IP dd ? SP dd ? ends struct TASK State db ? Regs REGISTERS ends include 'lib/string.asm' include 'lib/printf.asm' include 'lib/term.asm' include 'lib/keyboard.asm'
tests/unit_tests/sponge_tests.adb
damaki/libkeccak
26
4139
<gh_stars>10-100 ------------------------------------------------------------------------------- -- Copyright (c) 2016, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * The name of the copyright holder may not be used to endorse or promote -- Products derived from this software without specific prior written -- permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY -- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with AUnit.Assertions; use AUnit.Assertions; with Keccak.Types; package body Sponge_Tests is procedure Set_Up(T : in out Test) is begin Sponge.Init(T.Ctx, Capacity); end Set_Up; -- Test that streaming works when absorbing data. -- -- This test takes a 512 byte message and breaks it up into equal-sized -- chunks (sometimes the last chunk is smaller) and absorbs it into the -- sponge using multiple calls to Absorb. The test checks that for each -- possible chunk size (1 .. 511 byte chunks) the Sponge always produces -- exactly the same output. procedure Test_Absorb_Streaming(T : in out Test) is use type Keccak.Types.Byte_Array; Input_Data : Keccak.Types.Byte_Array(0 .. 512); Baseline_Output : Keccak.Types.Byte_Array(0 .. 512); Output_Data : Keccak.Types.Byte_Array(0 .. 512); Num_Chunks : Natural; begin -- Setup the input data for I in Input_Data'Range loop Input_Data(I) := Keccak.Types.Byte(I mod 256); end loop; -- Get the baseline output by passing in the entire input in 1 call to Absorb Sponge.Absorb(T.Ctx, Input_Data, Input_Data'Length * 8); Sponge.Squeeze(T.Ctx, Baseline_Output); -- Break up the Input_Data into chunks of varying sizes, and check -- that the squeezed output is the same as the Baseline_Output. for Chunk_Size in Positive range 1 .. Input_Data'Length - 1 loop Sponge.Init(T.Ctx, Capacity); Num_Chunks := Input_Data'Length / Chunk_Size; for N in Natural range 0 .. Num_Chunks - 1 loop Sponge.Absorb(T.Ctx, Input_Data(N*Chunk_Size .. (N*Chunk_Size + Chunk_Size) - 1), Chunk_Size * 8); end loop; -- Last chunk, if necessary if Input_Data'Length mod Chunk_Size /= 0 then Sponge.Absorb(T.Ctx, Input_Data(Chunk_Size * (Input_Data'Length / Chunk_Size) .. Input_Data'Last), (Input_Data'Length mod Chunk_Size) * 8); end if; -- Get the output and compare it against the baseline Sponge.Squeeze(T.Ctx, Output_Data); Assert(Output_Data = Baseline_Output, "Streaming test failed for" & Positive'Image(Chunk_Size) & " byte chunks"); end loop; end Test_Absorb_Streaming; -- Test that streaming works when squeezing data. -- -- This test verifies that the sponge always outputs the same data sequence, -- regardless of how much data is output for each call to Squeeze. -- -- The test iterates through chunk sizes from 1 .. 511 bytes. For each chunk -- size the test squeezes 512 bytes of data. For example, for 2 byte chunks -- the test calls Squeeze 256 times to generate 512 bytes of output, and this -- output should be exactly the same as the 512 bytes generated from reading -- 1 bytes per call to Squeeze. procedure Test_Squeeze_Streaming(T : in out Test) is use type Keccak.Types.Byte_Array; Input_Data : Keccak.Types.Byte_Array(0 .. 512); Baseline_Output : Keccak.Types.Byte_Array(0 .. 512); Output_Data : Keccak.Types.Byte_Array(0 .. 512); Num_Chunks : Natural; begin -- Setup the input data for I in Input_Data'Range loop Input_Data(I) := Keccak.Types.Byte(I mod 256); end loop; -- Get the baseline output by passing in the entire input in 1 call to Absorb Sponge.Absorb(T.Ctx, Input_Data, Input_Data'Length * 8); Sponge.Squeeze(T.Ctx, Baseline_Output); -- Break up the Output_Data into chunks of varying sizes, and check -- that the squeezed output is the same as the Baseline_Output. for Chunk_Size in Positive range 1 .. Input_Data'Length - 1 loop Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Input_Data, Input_Data'Length * 8); Num_Chunks := Input_Data'Length / Chunk_Size; for N in Natural range 0 .. Num_Chunks - 1 loop Sponge.Squeeze(T.Ctx, Output_Data(N*Chunk_Size .. (N*Chunk_Size + Chunk_Size) - 1)); end loop; -- Last chunk, if necessary if Input_Data'Length mod Chunk_Size /= 0 then Sponge.Squeeze(T.Ctx, Output_Data(Chunk_Size * (Output_Data'Length / Chunk_Size) .. Output_Data'Last)); end if; -- Compare it against the baseline Assert(Output_Data = Baseline_Output, "Streaming test failed for" & Positive'Image(Chunk_Size) & " byte chunks"); end loop; end Test_Squeeze_Streaming; -- Test that Absorb_With_Suffix is equivalent to Absorb -- when the Suffix_Size is 0. procedure Test_Absorb_No_Suffix(T : in out Test) is use type Keccak.Types.Byte_Array; Input_Data : Keccak.Types.Byte_Array(0 .. 512); Baseline_Output : Keccak.Types.Byte_Array(0 .. 512); Output_Data : Keccak.Types.Byte_Array(0 .. 512); begin -- Setup the input data for I in Input_Data'Range loop Input_Data(I) := Keccak.Types.Byte(I mod 256); end loop; -- Test all possible bit-lengths in the range 1 .. 512 for I in Positive range 1 .. Input_Data'Length loop -- Generate the baseline output with Absorb Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Input_Data, I); Sponge.Squeeze(T.Ctx, Baseline_Output); -- Do the same with Append_With_Suffix, but squeeze to Output_Data Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(T.Ctx, Input_Data, I, 0, -- Suffix 0); -- Suffix_Size Sponge.Squeeze(T.Ctx, Output_Data); pragma Assert(Output_Data = Baseline_Output, "Failed with input data of" & Positive'Image(I) & " bits"); end loop; end Test_Absorb_No_Suffix; -- Test that Absorb_With_Suffix is equivalent to Absorb where the -- suffix bits are included in the message passed to Absorb. -- For example, an 8-bit message (2#0000_0000#) with 4 suffix bits (2#1111#) -- should produce identical output when called with the following pseudo-code: -- Absorb_With_Suffix(Message => 2#0000_0000#, -- Suffix => 2#1111#); -- or -- Absorb(Message => 2#0000_0000_1111#); procedure Test_Suffix_Bits(T : in out Test) is use type Keccak.Types.Byte_Array; Suffix : constant Keccak.Types.Byte := 16#FF#; Message_Without_Suffix : Keccak.Types.Byte_Array(1 .. 1) := (1 => 16#00#); Message_With_Suffix : Keccak.Types.Byte_Array(1 .. 2) := (1 => 16#00#, 2 => Suffix); Digest_1 : Keccak.Types.Byte_Array(1 .. 32); Digest_2 : Keccak.Types.Byte_Array(1 .. 32); begin -- Test all suffix bit lengths (range 0 .. 8) for I in Natural range 0 .. 8 loop Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Message_Without_Suffix, Bit_Length => 8, Suffix => Suffix, Suffix_Len => I); Sponge.Squeeze(T.Ctx, Digest_1); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(Ctx => T.Ctx, Data => Message_With_Suffix, Bit_Length => 8 + I); Sponge.Squeeze(T.Ctx, Digest_2); Assert(Digest_1 = Digest_2, "Computed digests do not match with suffix length: " & Natural'Image(I)); end loop; end Test_Suffix_Bits; -- Test that Absorbing 0 bits does not affect the output. procedure Test_Null_Absorb(T : in out Test) is use type Keccak.Types.Byte_Array; Expected_Digest : Keccak.Types.Byte_Array(1 .. 32); Actual_Digest : Keccak.Types.Byte_Array(1 .. 32); Empty_Array : Keccak.Types.Byte_Array(1 .. 0) := (others => 0); begin Sponge.Init(T.Ctx, Capacity); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Empty_Array, 0); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Absorb had an unexpected effect on the output"); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Empty_Array, Bit_Length => 0, Suffix => 0, Suffix_Len => 0); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Absorb_With_Suffix had an unexpected effect on the output"); end Test_Null_Absorb; -- Test that Absorb_With_Suffix correctly absorbs the suffix bits when -- the message is empty. -- -- The behaviour should be identical to calling Absorb where the message -- contains the suffix bits. procedure Test_Absorb_Suffix_Only(T : in out Test) is use type Keccak.Types.Byte_Array; Suffix : constant Keccak.Types.Byte := 16#FF#; Message : constant Keccak.Types.Byte_Array(1 .. 1) := (1 => Suffix); Empty_Message : constant Keccak.Types.Byte_Array(1 .. 0) := (others => 0); Expected_Digest : Keccak.Types.Byte_Array(1 .. 32); Actual_Digest : Keccak.Types.Byte_Array(1 .. 32); begin Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Message, 4); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Empty_Message, Bit_Length => 0, Suffix => Suffix, Suffix_Len => 4); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Expected_Digest = Actual_Digest, "Suffix bits were not absorbed correctly"); end Test_Absorb_Suffix_Only; -- Test that suffix bits are correctly packed into non-multiple-of-8 message -- sizes. procedure Test_Suffix_Packing(T : in out Test) is use type Keccak.Types.Byte_Array; Message_With_Suffix_1 : Keccak.Types.Byte_Array(1 .. 2) := (1 => 2#0000_0000#, 2 => 2#1111_0000#); Message_Without_Suffix_1 : Keccak.Types.Byte_Array(1 .. 2) := (1 => 2#0000_0000#, 2 => 2#0000#); Message_With_Suffix_2 : Keccak.Types.Byte_Array(1 .. 3) := (1 => 2#0000_0000#, 2 => 2#1100_0000#, 3 => 2#11#); Message_Without_Suffix_2 : Keccak.Types.Byte_Array(1 .. 2) := (1 => 2#0000_0000#, 2 => 2#0000_00#); Suffix : Keccak.Types.Byte := 2#1111#; Expected_Digest : Keccak.Types.Byte_Array(1 .. 32); Actual_Digest : Keccak.Types.Byte_Array(1 .. 32); begin -- Case 1, where the suffix bits fit into the last byte of the message. Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Message_With_Suffix_1, 16); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Message_Without_Suffix_1, Bit_Length => 12, Suffix => Suffix, Suffix_Len => 4); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Wrong output for message: 0000_0000_0000_1111"); -- Case 2, where the suffix bits are spilled across two bytes Sponge.Init(T.Ctx, Capacity); Sponge.Absorb(T.Ctx, Message_With_Suffix_2, 18); Sponge.Squeeze(T.Ctx, Expected_Digest); Sponge.Init(T.Ctx, Capacity); Sponge.Absorb_With_Suffix(Ctx => T.Ctx, Message => Message_Without_Suffix_2, Bit_Length => 14, Suffix => Suffix, Suffix_Len => 4); Sponge.Squeeze(T.Ctx, Actual_Digest); Assert(Actual_Digest = Expected_Digest, "Wrong output for message: 0000_0000_0000_0011_11"); end Test_Suffix_Packing; end Sponge_Tests;
library/02_functions_batch1/unknown_10005a70.asm
SamantazFox/dds140-reverse-engineering
1
168814
10005a70: ff 74 24 04 push DWORD PTR [esp+0x4] 10005a74: e8 d1 ff ff ff call 0x10005a4a 10005a79: 59 pop ecx 10005a7a: ff 74 24 04 push DWORD PTR [esp+0x4] 10005a7e: ff 15 6c d0 00 10 call DWORD PTR ds:0x1000d06c 10005a84: cc int3
unittests/ASM/Primary/Primary_86.asm
cobalt2727/FEX
628
169884
<filename>unittests/ASM/Primary/Primary_86.asm %ifdef CONFIG { "RegData": { "RAX": "0xFFFFFFFFFFFFFF48", "RBX": "0x41424344454647FF" }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rdx, 0xe0000000 mov rax, 0x4142434445464748 mov [rdx + 8 * 0], rax mov rax, 0x5152535455565758 mov [rdx + 8 * 1], rax mov rax, -1 xchg byte [rdx + 8 * 0], al mov rbx, [rdx + 8 * 0] hlt
include/bits_types_u_fpos64_t_h.ads
docandrew/troodon
5
14108
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with bits_types_h; with bits_types_u_mbstate_t_h; package bits_types_u_fpos64_t_h is -- The tag name of this struct is _G_fpos64_t to preserve historic -- C++ mangled names for functions taking fpos_t and/or fpos64_t -- arguments. That name should not be used in new code. type u_G_fpos64_t is record uu_pos : aliased bits_types_h.uu_off64_t; -- /usr/include/bits/types/__fpos64_t.h:12 uu_state : aliased bits_types_u_mbstate_t_h.uu_mbstate_t; -- /usr/include/bits/types/__fpos64_t.h:13 end record with Convention => C_Pass_By_Copy; -- /usr/include/bits/types/__fpos64_t.h:10 subtype uu_fpos64_t is u_G_fpos64_t; -- /usr/include/bits/types/__fpos64_t.h:14 end bits_types_u_fpos64_t_h;
alloy4fun_models/trashltl/models/18/hszrntuGzvRQ4Ltrf.als
Kaixi26/org.alloytools.alloy
0
4784
open main pred idhszrntuGzvRQ4Ltrf_prop19 { all f : Protected | f in Trash and f not in Protected until f in Protected } pred __repair { idhszrntuGzvRQ4Ltrf_prop19 } check __repair { idhszrntuGzvRQ4Ltrf_prop19 <=> prop19o }
oeis/115/A115970.asm
neoneye/loda-programs
11
9265
; A115970: Expansion of 1/(4*sqrt(1-4*x) - 3). ; Submitted by <NAME> ; 1,8,72,656,5992,54768,500688,4577568,41851560,382641200,3498428272,31985610720,292439802256,2673735097184,24445577182368,223502416896576,2043450657688872,18682977401318064,170815793235313968,1561744394748426336,14278805892823025712,130549082441165811744,1193591610862697402208,10912837584925824747456,99774515061786900989712,912224137706291775737568,8340334973309111153713248,76254491184519453573295808,697183919401241251469086240,6374252977382475730058216640,58278884364638632683713236288 mov $4,$0 add $0,1 lpb $0 sub $0,1 mov $3,$4 bin $3,$1 add $1,1 add $3,$2 mul $2,2 mul $3,6 add $2,$3 add $4,1 lpe mov $0,$3 div $0,6
src/statistics.adb
thindil/steamsky
80
7210
<gh_stars>10-100 -- Copyright 2016-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Characters.Handling; use Ada.Characters.Handling; with Goals; use Goals; with Ships; use Ships; with Config; use Config; package body Statistics is procedure UpdateDestroyedShips(ShipName: Unbounded_String) is Updated: Boolean := False; ShipIndex: Unbounded_String; begin Proto_Ships_Loop : for I in Proto_Ships_List.Iterate loop if Proto_Ships_List(I).Name = ShipName then ShipIndex := Proto_Ships_Container.Key(I); GameStats.Points := GameStats.Points + (Proto_Ships_List(I).Combat_Value / 10); exit Proto_Ships_Loop; end if; end loop Proto_Ships_Loop; if ShipIndex = Null_Unbounded_String then return; end if; Destroyed_Ships_Loop : for DestroyedShip of GameStats.DestroyedShips loop if DestroyedShip.Index = ShipIndex then DestroyedShip.Amount := DestroyedShip.Amount + 1; Updated := True; exit Destroyed_Ships_Loop; end if; end loop Destroyed_Ships_Loop; if not Updated then GameStats.DestroyedShips.Append (New_Item => (Index => ShipIndex, Amount => 1)); end if; end UpdateDestroyedShips; procedure ClearGameStats is begin GameStats.DestroyedShips.Clear; GameStats.BasesVisited := 1; GameStats.MapVisited := 1; GameStats.DistanceTraveled := 0; GameStats.CraftingOrders.Clear; GameStats.AcceptedMissions := 0; GameStats.FinishedMissions.Clear; GameStats.FinishedGoals.Clear; GameStats.KilledMobs.Clear; GameStats.Points := 0; end ClearGameStats; procedure UpdateFinishedGoals(Index: Unbounded_String) is Updated: Boolean := False; begin Find_Goal_Index_Loop : for Goal of Goals_List loop if Goal.Index = Index then GameStats.Points := GameStats.Points + (Goal.Amount * Goal.Multiplier); exit Find_Goal_Index_Loop; end if; end loop Find_Goal_Index_Loop; Update_Finished_Goals_Loop : for FinishedGoal of GameStats.FinishedGoals loop if FinishedGoal.Index = Index then FinishedGoal.Amount := FinishedGoal.Amount + 1; Updated := True; exit Update_Finished_Goals_Loop; end if; end loop Update_Finished_Goals_Loop; if not Updated then Add_Finished_Goal_Loop : for Goal of Goals_List loop if Goal.Index = Index then GameStats.FinishedGoals.Append (New_Item => (Index => Goal.Index, Amount => 1)); exit Add_Finished_Goal_Loop; end if; end loop Add_Finished_Goal_Loop; end if; end UpdateFinishedGoals; procedure UpdateFinishedMissions(MType: Unbounded_String) is Updated: Boolean := False; begin Update_Finished_Missions_Loop : for FinishedMission of GameStats.FinishedMissions loop if FinishedMission.Index = MType then FinishedMission.Amount := FinishedMission.Amount + 1; Updated := True; exit Update_Finished_Missions_Loop; end if; end loop Update_Finished_Missions_Loop; if not Updated then GameStats.FinishedMissions.Append (New_Item => (Index => MType, Amount => 1)); end if; GameStats.Points := GameStats.Points + 50; end UpdateFinishedMissions; procedure UpdateCraftingOrders(Index: Unbounded_String) is Updated: Boolean := False; begin Update_Crafting_Loop : for CraftingOrder of GameStats.CraftingOrders loop if CraftingOrder.Index = Index then CraftingOrder.Amount := CraftingOrder.Amount + 1; Updated := True; exit Update_Crafting_Loop; end if; end loop Update_Crafting_Loop; if not Updated then GameStats.CraftingOrders.Append (New_Item => (Index => Index, Amount => 1)); end if; GameStats.Points := GameStats.Points + 5; end UpdateCraftingOrders; procedure UpdateKilledMobs (Mob: Member_Data; FractionName: Unbounded_String) is Updated: Boolean := False; begin Get_Attribute_Points_Loop : for Attribute of Mob.Attributes loop GameStats.Points := GameStats.Points + Attribute.Level; end loop Get_Attribute_Points_Loop; Get_Skill_Points_Loop : for Skill of Mob.Skills loop GameStats.Points := GameStats.Points + Skill.Level; end loop Get_Skill_Points_Loop; Update_Killed_Mobs_Loop : for KilledMob of GameStats.KilledMobs loop if To_Lower(To_String(KilledMob.Index)) = To_String(FractionName) then KilledMob.Amount := KilledMob.Amount + 1; Updated := True; exit Update_Killed_Mobs_Loop; end if; end loop Update_Killed_Mobs_Loop; if not Updated then GameStats.KilledMobs.Append (New_Item => (Index => To_Unbounded_String (To_Upper(Slice(FractionName, 1, 1)) & Slice(FractionName, 2, Length(FractionName))), Amount => 1)); end if; end UpdateKilledMobs; function GetGamePoints return Natural is MalusIndexes: constant array(Positive range <>) of Positive := (2, 4, 5, 6); DifficultyValues: constant array(1 .. 7) of Bonus_Type := (New_Game_Settings.Enemy_Damage_Bonus, New_Game_Settings.Player_Damage_Bonus, New_Game_Settings.Enemy_Melee_Damage_Bonus, New_Game_Settings.Player_Melee_Damage_Bonus, New_Game_Settings.Experience_Bonus, New_Game_Settings.Reputation_Bonus, New_Game_Settings.Upgrade_Cost_Bonus); PointsBonus, Value: Float := 0.0; begin Get_Game_Points_Loop : for I in DifficultyValues'Range loop Value := Float(DifficultyValues(I)); Update_Game_Points_Loop : for J in MalusIndexes'Range loop if I = MalusIndexes(J) then if Value < 1.0 then Value := 1.0 + ((1.0 - Value) * 4.0); elsif Value > 1.0 then Value := 1.0 - Value; end if; exit Update_Game_Points_Loop; end if; end loop Update_Game_Points_Loop; PointsBonus := PointsBonus + Value; end loop Get_Game_Points_Loop; PointsBonus := PointsBonus / Float(DifficultyValues'Length); if PointsBonus < 0.01 then PointsBonus := 0.01; end if; return Natural(Float(GameStats.Points) * PointsBonus); end GetGamePoints; end Statistics;
test/Fail/Issue3074.agda
shlevy/agda
1,989
7461
module _ where postulate A : Set data Box : Set where box : A → Box unbox : Box → A unbox (box {x}) = x
programs/oeis/017/A017118.asm
neoneye/loda
22
11882
; A017118: a(n) = (8*n + 4)^6. ; 4096,2985984,64000000,481890304,2176782336,7256313856,19770609664,46656000000,98867482624,192699928576,351298031616,606355001344,1000000000000,1586874322944,2436396322816,3635215077376,5289852801024,7529536000000,10509215371264,14412774445056,19456426971136,25892303048704,34012224000000,44151665987584,56693912375296,72074394832896,90785223184384,113379904000000,140478247931904,172771465793536,211027453382656,256096265048064,308915776000000,370517533364224,442032795979776,524698762940416,619864990879744,729000000000000,853698068844544,995686217814016,1156831381426176,1339147769319424,1544804416000000,1776132919332864,2035635367776256,2325992456359936,2650071791407104,3010936384000000,3411853332189184,3856302691946496,4347986536861696,4890838206582784,5489031744000000,6146991521173504,6869402054004736,7661218005651456,8527674378686464,9474296896000000,10506912570445824,11631660463230976,12855002631049216,14183735261958144,15625000000000000,17186295458566144,18875488922505216,20700828238974976,22670953897037824,24794911296000000,27082163202494464,29542602396307456,32186564504948736,35024841026965504,38068692544000000,41329862121590784,44820588898717696,48553621866090496,52542233833181184,56800235584000000,61341990221615104,66182427701415936,71337059553120256,76821993791524864,82653950016000000,88850274698727424,95428956661682176,102408642742358016,109808653648236544,117649000000000000,125950398563487744,134734288670396416,144022848827723776,153839013515956224,164206490176000000,175149776384856064,186694177220038656,198865822812737536,211691686089723904,225199600704000000,239418279154192384,254377331092688896 mul $0,8 add $0,4 pow $0,6
RecursiveTypes/Substitution.agda
nad/codata
1
11791
<filename>RecursiveTypes/Substitution.agda ------------------------------------------------------------------------ -- Substitutions ------------------------------------------------------------------------ module RecursiveTypes.Substitution where open import Data.Fin.Substitution open import Data.Fin.Substitution.Lemmas import Data.Fin.Substitution.List as ListSubst open import Data.Nat open import Data.List open import Data.Vec as Vec open import Relation.Binary.PropositionalEquality as PropEq using (_≡_; refl; sym; cong₂) open PropEq.≡-Reasoning open import Relation.Binary.Construct.Closure.ReflexiveTransitive using (Star; ε; _◅_; _▻_) open import RecursiveTypes.Syntax -- Code for applying substitutions. module TyApp {T : ℕ → Set} (l : Lift T Ty) where open Lift l hiding (var) -- Applies a substitution to a recursive type. infixl 8 _/_ _/_ : ∀ {m n} → Ty m → Sub T m n → Ty n ⊥ / ρ = ⊥ ⊤ / ρ = ⊤ var x / ρ = lift (Vec.lookup ρ x) σ ⟶ τ / ρ = (σ / ρ) ⟶ (τ / ρ) μ σ ⟶ τ / ρ = μ (σ / ρ ↑) ⟶ (τ / ρ ↑) open Application (record { _/_ = _/_ }) using (_/✶_) -- Some lemmas about _/_. ⊥-/✶-↑✶ : ∀ k {m n} (ρs : Subs T m n) → ⊥ /✶ ρs ↑✶ k ≡ ⊥ ⊥-/✶-↑✶ k ε = refl ⊥-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (⊥-/✶-↑✶ k ρs) refl ⊤-/✶-↑✶ : ∀ k {m n} (ρs : Subs T m n) → ⊤ /✶ ρs ↑✶ k ≡ ⊤ ⊤-/✶-↑✶ k ε = refl ⊤-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (⊤-/✶-↑✶ k ρs) refl ⟶-/✶-↑✶ : ∀ k {m n σ τ} (ρs : Subs T m n) → σ ⟶ τ /✶ ρs ↑✶ k ≡ (σ /✶ ρs ↑✶ k) ⟶ (τ /✶ ρs ↑✶ k) ⟶-/✶-↑✶ k ε = refl ⟶-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (⟶-/✶-↑✶ k ρs) refl μ⟶-/✶-↑✶ : ∀ k {m n σ τ} (ρs : Subs T m n) → μ σ ⟶ τ /✶ ρs ↑✶ k ≡ μ (σ /✶ ρs ↑✶ suc k) ⟶ (τ /✶ ρs ↑✶ suc k) μ⟶-/✶-↑✶ k ε = refl μ⟶-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (μ⟶-/✶-↑✶ k ρs) refl tySubst : TermSubst Ty tySubst = record { var = var; app = TyApp._/_ } open TermSubst tySubst hiding (var) -- σ [0≔ τ ] replaces all occurrences of variable 0 in σ with τ. infix 8 _[0≔_] _[0≔_] : ∀ {n} → Ty (suc n) → Ty n → Ty n σ [0≔ τ ] = σ / sub τ -- The unfolding of a fixpoint. unfold[μ_⟶_] : ∀ {n} → Ty (suc n) → Ty (suc n) → Ty n unfold[μ σ ⟶ τ ] = σ ⟶ τ [0≔ μ σ ⟶ τ ] -- Substitution lemmas. tyLemmas : TermLemmas Ty tyLemmas = record { termSubst = tySubst ; app-var = refl ; /✶-↑✶ = Lemma./✶-↑✶ } where module Lemma {T₁ T₂} {lift₁ : Lift T₁ Ty} {lift₂ : Lift T₂ Ty} where open Lifted lift₁ using () renaming (_↑✶_ to _↑✶₁_; _/✶_ to _/✶₁_) open Lifted lift₂ using () renaming (_↑✶_ to _↑✶₂_; _/✶_ to _/✶₂_) /✶-↑✶ : ∀ {m n} (ρs₁ : Subs T₁ m n) (ρs₂ : Subs T₂ m n) → (∀ k x → var x /✶₁ ρs₁ ↑✶₁ k ≡ var x /✶₂ ρs₂ ↑✶₂ k) → ∀ k t → t /✶₁ ρs₁ ↑✶₁ k ≡ t /✶₂ ρs₂ ↑✶₂ k /✶-↑✶ ρs₁ ρs₂ hyp k ⊥ = begin ⊥ /✶₁ ρs₁ ↑✶₁ k ≡⟨ TyApp.⊥-/✶-↑✶ _ k ρs₁ ⟩ ⊥ ≡⟨ sym (TyApp.⊥-/✶-↑✶ _ k ρs₂) ⟩ ⊥ /✶₂ ρs₂ ↑✶₂ k ∎ /✶-↑✶ ρs₁ ρs₂ hyp k ⊤ = begin ⊤ /✶₁ ρs₁ ↑✶₁ k ≡⟨ TyApp.⊤-/✶-↑✶ _ k ρs₁ ⟩ ⊤ ≡⟨ sym (TyApp.⊤-/✶-↑✶ _ k ρs₂) ⟩ ⊤ /✶₂ ρs₂ ↑✶₂ k ∎ /✶-↑✶ ρs₁ ρs₂ hyp k (var x) = hyp k x /✶-↑✶ ρs₁ ρs₂ hyp k (σ ⟶ τ) = begin σ ⟶ τ /✶₁ ρs₁ ↑✶₁ k ≡⟨ TyApp.⟶-/✶-↑✶ _ k ρs₁ ⟩ (σ /✶₁ ρs₁ ↑✶₁ k) ⟶ (τ /✶₁ ρs₁ ↑✶₁ k) ≡⟨ cong₂ _⟶_ (/✶-↑✶ ρs₁ ρs₂ hyp k σ) (/✶-↑✶ ρs₁ ρs₂ hyp k τ) ⟩ (σ /✶₂ ρs₂ ↑✶₂ k) ⟶ (τ /✶₂ ρs₂ ↑✶₂ k) ≡⟨ sym (TyApp.⟶-/✶-↑✶ _ k ρs₂) ⟩ σ ⟶ τ /✶₂ ρs₂ ↑✶₂ k ∎ /✶-↑✶ ρs₁ ρs₂ hyp k (μ σ ⟶ τ) = begin μ σ ⟶ τ /✶₁ ρs₁ ↑✶₁ k ≡⟨ TyApp.μ⟶-/✶-↑✶ _ k ρs₁ ⟩ μ (σ /✶₁ ρs₁ ↑✶₁ suc k) ⟶ (τ /✶₁ ρs₁ ↑✶₁ suc k) ≡⟨ cong₂ μ_⟶_ (/✶-↑✶ ρs₁ ρs₂ hyp (suc k) σ) (/✶-↑✶ ρs₁ ρs₂ hyp (suc k) τ) ⟩ μ (σ /✶₂ ρs₂ ↑✶₂ suc k) ⟶ (τ /✶₂ ρs₂ ↑✶₂ suc k) ≡⟨ sym (TyApp.μ⟶-/✶-↑✶ _ k ρs₂) ⟩ μ σ ⟶ τ /✶₂ ρs₂ ↑✶₂ k ∎ open TermLemmas tyLemmas public hiding (var) module // where private open module LS = ListSubst lemmas₄ public hiding (_//_) -- _//_ is redefined in order to make it bind weaker than -- RecursiveTypes.Subterm._∗, which binds weaker than _/_. infixl 6 _//_ _//_ : ∀ {m n} → List (Ty m) → Sub Ty m n → List (Ty n) _//_ = LS._//_
src/libtcod-maps-lines.adb
csb6/libtcod-ada
0
506
with Interfaces.C, Interfaces.C.Extensions, Ada.Unchecked_Conversion; package body Libtcod.Maps.Lines is use bresenham_h, Interfaces.C, Interfaces.C.Extensions; type Int_Ptr is access all int; type X_Pos_Ptr is access all X_Pos; type Y_Pos_Ptr is access all Y_Pos; function X_Ptr_To_Int_Ptr is new Ada.Unchecked_Conversion (Source => X_Pos_Ptr, Target => Int_Ptr); function Y_Ptr_To_Int_Ptr is new Ada.Unchecked_Conversion (Source => Y_Pos_Ptr, Target => Int_Ptr); function Line_Cb_To_TCOD_Cb is new Ada.Unchecked_Conversion (Source => Line_Callback, Target => TCOD_line_listener_t); --------------- -- make_line -- --------------- function make_line(start_x : X_Pos; start_y : Y_Pos; end_x : X_Pos; end_y : Y_Pos) return Line is begin return l : Line do TCOD_line_init_mt(int(start_x), int(start_y), int(end_x), int(end_y), l.data'Access); end return; end make_line; --------------- -- copy_line -- --------------- procedure copy_line(a : Line; b : out Line) is begin b.data := a.data; end copy_line; ---------- -- step -- ---------- function step(l : aliased in out Line; x : aliased in out X_Pos; y : aliased in out Y_Pos) return Boolean is (Boolean(TCOD_line_step_mt(X_Ptr_To_Int_Ptr(x'Unchecked_Access), Y_Ptr_To_Int_Ptr(y'Unchecked_Access), l.data'Access))); ---------------- -- visit_line -- ---------------- function visit_line(start_x : X_Pos; start_y : Y_Pos; end_x : X_Pos; end_y : Y_Pos; cb : Line_Callback) return Boolean is (Boolean(TCOD_line(int(start_x), int(start_y), int(end_x), int(end_y), Line_Cb_To_TCOD_Cb(cb)))); end Libtcod.Maps.Lines;
src/BinaryDataDecoders.Text.Json/JsonPath/Parser/JsonPath.g4
mwwhited/BinaryDataDecoders
5
6257
<filename>src/BinaryDataDecoders.Text.Json/JsonPath/Parser/JsonPath.g4 grammar JsonPath; start : path EOF ; path : pathBase sequence | function ; pathBase : ROOT | RELATIVE ; sequence : sequenceItem sequence? ; sequenceItem : '.'? ( WILDCARD //.* | identity // .item or ./item['bracketChain'] | bracket // .[...] ir [...] | filter // .[?(...)] ir [?(...)] | function // .function(...) ) | DESCENDANTS // .. ; bracket : '[' WILDCARD ']' | '[' NUMBER (',' NUMBER)* ']' | '[' string (',' string)* ']' | '[' range ']' | '[' function ']' ; filter : '[' '?(' query ')' ']' ; range : rangeStart=NUMBER? ':' rangeEnd=NUMBER? (':' rangeStep=NUMBER)?; operand : path | string | NUMBER ; query : path #queryPath | relationLeft=operand RELATIONAL relationRight=operand #queryRelational | relationLeft=query LOGICAL relationRight=query #queryLogical ; identity : IDENTITY ; string : QUOTED_STRING ; function : identity '()' | identity '(' functionParameter (',' functionParameter)* ')' ; functionParameter : operand | pathBase | DECIMAL ; fragment ESCAPED_QUOTE : '\\\''; QUOTED_STRING : '\'' ( ESCAPED_QUOTE | ~('\n'|'\r') )*? '\''; LOGICAL : '&&' | '||' ; RELATIONAL : '==' | '!=' | '<' | '<=' | '>' | '>=' //| '=~' ; PATH_SEPERATOR : '.'; WILDCARD : '*'; DESCENDANTS : '..'; RELATIVE : '@'; ROOT : '$'; IDENTITY : [a-zA-Z][a-zA-Z0-9]* ; NUMBER : '0' | '-'? [1-9][0-9]* ; DECIMAL : ('0' | '-'? [1-9][0-9]*) '.' [0-9]+; WS : [ \t\n\r]+ -> skip ;
programs/oeis/182/A182214.asm
karttu/loda
1
10807
<reponame>karttu/loda ; A182214: Bondage number of the Cartesian product graph G = C_n X K_2. ; 3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3,2,2,4,3 mov $1,$0 add $1,6 mul $1,3 mod $1,4 trn $1,1 add $1,2
libsrc/_DEVELOPMENT/fcntl/c/sdcc_ix/write.asm
meesokim/z88dk
0
4121
<reponame>meesokim/z88dk ; ssize_t write(int fd, const void *buf, size_t nbyte) SECTION code_fcntl PUBLIC _write EXTERN l0_write_callee _write: pop af pop hl pop de pop bc push bc push de push hl push af jp l0_write_callee
src/stars/tests/floatTest.asm
kevintmcdonnell/stars
4
101220
<filename>src/stars/tests/floatTest.asm .data c: .double 1.8733 .text main: li $t2, 2 mtc1 $t2, $f14 li $v0, 10 syscall
samples/bean.ads
jquorning/ada-el
6
9431
----------------------------------------------------------------------- -- bean - A simple bean example -- Copyright (C) 2009, 2010 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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. ----------------------------------------------------------------------- with EL.Objects; with Util.Beans.Basic; with Util.Beans.Methods; with Ada.Strings.Unbounded; package Bean is use Ada.Strings.Unbounded; type Person is new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with private; type Person_Access is access all Person'Class; function Create_Person (First_Name, Last_Name : String; Age : Natural) return Person_Access; -- Get the value identified by the name. function Get_Value (From : Person; Name : String) return EL.Objects.Object; -- Set the value identified by the name. procedure Set_Value (From : in out Person; Name : in String; Value : in EL.Objects.Object); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in Person) return Util.Beans.Methods.Method_Binding_Array_Access; -- function Save (P : in Person; Name : in Unbounded_String) return Unbounded_String; function Print (P : in Person; Title : in String) return String; function Compute (B : Util.Beans.Basic.Bean'Class; P1 : EL.Objects.Object) return EL.Objects.Object; -- Function to format a string function Format (Arg : EL.Objects.Object) return EL.Objects.Object; procedure Free (Object : in out Person_Access); private type Person is new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record Last_Name : Unbounded_String; First_Name : Unbounded_String; Age : Natural; end record; end Bean;
Integer8.agda
righ1113/Agda
0
13447
<reponame>righ1113/Agda module Integer8 where open import Data.Nat open import Data.Nat.Properties open import Data.Product open import Relation.Binary.PropositionalEquality as PropEq -- ---------- record ---------- record IsSemiGroup (A : Set) (_∙_ : A → A → A) : Set where field assoc : ∀ x y z → (x ∙ y) ∙ z ≡ x ∙ (y ∙ z) record IsMonoid (A : Set) (_∙_ : A → A → A) (e : A) : Set where field isSemiGroup : IsSemiGroup A _∙_ identity : (∀ x → e ∙ x ≡ x) × (∀ x → x ∙ e ≡ x) record IsGroup (A : Set) (_∙_ : A → A → A) (e : A) (iF : A → A) : Set where field isMonoid : IsMonoid A _∙_ e inv : (∀ x → (iF x) ∙ x ≡ e) × (∀ x → x ∙ (iF x) ≡ e) record IsAbelianGroup (A : Set) (_∙_ : A → A → A) (e : A) (iF : A → A) : Set where field isGroup : IsGroup A _∙_ e iF comm : ∀ x y → x ∙ y ≡ y ∙ x record IsRing (A : Set) (_⊕_ _⊗_ : A → A → A) (eP eT : A) (iF : A → A) : Set where field ⊕isAbelianGroup : IsAbelianGroup A _⊕_ eP iF ⊗isMonoid : IsMonoid A _⊗_ eT isDistR : (x y z : A) → (x ⊕ y) ⊗ z ≡ (x ⊗ z) ⊕ (y ⊗ z) isDistL : (x y z : A) → x ⊗ (y ⊕ z) ≡ (x ⊗ y) ⊕ (x ⊗ z) -- ---------------------------- -- ---------- practice nat ---------- ℕ+-isSemiGroup : IsSemiGroup ℕ _+_ ℕ+-isSemiGroup = record { assoc = ℕ+-assoc } where ℕ+-assoc : ∀ x y z → (x + y) + z ≡ x + (y + z) ℕ+-assoc zero y z = refl ℕ+-assoc (suc x) y z = cong suc (ℕ+-assoc x y z) ℕ+0-isMonoid : IsMonoid ℕ _+_ 0 ℕ+0-isMonoid = record { isSemiGroup = ℕ+-isSemiGroup ; identity = (0+x≡x , x+0≡x) } where 0+x≡x : ∀ x → 0 + x ≡ x 0+x≡x x = refl x+0≡x : ∀ x → x + 0 ≡ x x+0≡x zero = refl x+0≡x (suc x) = cong suc (x+0≡x x) -- ------------------------- -- ---------- Int ---------- data ℤ : Set where O : ℤ I : ℕ → ℕ → ℤ postulate zeroZ : (x : ℕ) → I x x ≡ O zeroZ₂ : (x y : ℕ) → I (x + y) (y + x) ≡ O -- plusInt _++_ : ℤ → ℤ → ℤ O ++ O = O O ++ X = X X ++ O = X I x y ++ I z w = I (x + z) (y + w) -- productInt _**_ : ℤ → ℤ → ℤ O ** O = O O ** _ = O _ ** O = O I x y ** I z w = I (x * z + y * w) (x * w + y * z) -- ------------------------- -- ---------- Int + ---------- ℤ++-isSemiGroup : IsSemiGroup ℤ _++_ ℤ++-isSemiGroup = record { assoc = ℤ++-assoc } where open IsSemiGroup ℤ++-assoc : ∀ x y z → (x ++ y) ++ z ≡ x ++ (y ++ z) ℤ++-assoc O O O = refl ℤ++-assoc O O (I x x₁) = refl ℤ++-assoc O (I x x₁) O = refl ℤ++-assoc O (I x x₁) (I x₂ x₃) = refl ℤ++-assoc (I x x₁) O O = refl ℤ++-assoc (I x x₁) O (I x₂ x₃) = refl ℤ++-assoc (I x x₁) (I x₂ x₃) O = refl ℤ++-assoc (I x x₁) (I x₂ x₃) (I x₄ x₅) = cong₂ I ((assoc ℕ+-isSemiGroup) x x₂ x₄) ((assoc ℕ+-isSemiGroup) x₁ x₃ x₅) ℤ++O-isMonoid : IsMonoid ℤ _++_ O ℤ++O-isMonoid = record { isSemiGroup = ℤ++-isSemiGroup ; identity = (O++x≡x , x++O≡x) } where O++x≡x : (x : ℤ) → (O ++ x) ≡ x O++x≡x O = refl O++x≡x (I x x₁) = refl x++O≡x : (x : ℤ) → (x ++ O) ≡ x x++O≡x O = refl x++O≡x (I x x₁) = refl invℤ : ℤ → ℤ invℤ O = O invℤ (I x x₁) = I x₁ x ℤ++Oinvℤ-isGroup : IsGroup ℤ _++_ O invℤ ℤ++Oinvℤ-isGroup = record { isMonoid = ℤ++O-isMonoid ; inv = (leftInv , rightInv) } where leftInv : (x : ℤ) → (invℤ x ++ x) ≡ O leftInv O = refl leftInv (I x x₁) = zeroZ₂ x₁ x rightInv : (x : ℤ) → (x ++ invℤ x) ≡ O rightInv O = refl rightInv (I x x₁) = zeroZ₂ x x₁ ℤ++Oinvℤ-isAbelianGroup : IsAbelianGroup ℤ _++_ O invℤ ℤ++Oinvℤ-isAbelianGroup = record { isGroup = ℤ++Oinvℤ-isGroup ; comm = ℤ++Oinvℤ-Comm } where ℤ++Oinvℤ-Comm : (x y : ℤ) → (x ++ y) ≡ (y ++ x) ℤ++Oinvℤ-Comm O O = refl ℤ++Oinvℤ-Comm O (I x x₁) = refl ℤ++Oinvℤ-Comm (I x x₁) O = refl ℤ++Oinvℤ-Comm (I x x₁) (I x₂ x₃) = cong₂ I (+-comm x x₂) (+-comm x₁ x₃) -- --------------------------- -- ---------- Int * ---------- ℤ**-isSemiGroup : IsSemiGroup ℤ _**_ ℤ**-isSemiGroup = record { assoc = ℤ**-assoc } where ℤ**-assoc : ∀ x y z → (x ** y) ** z ≡ x ** (y ** z) ℤ**-assoc O O O = refl ℤ**-assoc O O (I x x₁) = refl ℤ**-assoc O (I x x₁) O = refl ℤ**-assoc O (I x x₁) (I x₂ x₃) = refl ℤ**-assoc (I x x₁) O O = refl ℤ**-assoc (I x x₁) O (I x₂ x₃) = refl ℤ**-assoc (I x x₁) (I x₂ x₃) O = refl ℤ**-assoc (I x x₁) (I x₂ x₃) (I x₄ x₅) = cong₂ I (ℤ**-assoc₁ x x₁ x₂ x₃ x₄ x₅) (ℤ**-assoc₁ x x₁ x₂ x₃ x₅ x₄) where open PropEq.≡-Reasoning open IsSemiGroup ℤ**-assoc₁ : ∀ x y z u v w → (x * z + y * u) * v + (x * u + y * z) * w ≡ x * (z * v + u * w) + y * (z * w + u * v) ℤ**-assoc₁ x y z u v w = begin (x * z + y * u) * v + (x * u + y * z) * w ≡⟨ cong (\ t → (t + (x * u + y * z) * w)) (*-distribʳ-+ v (x * z) (y * u)) ⟩ x * z * v + y * u * v + (x * u + y * z) * w ≡⟨ cong (\ t → (x * z * v + y * u * v + t)) (*-distribʳ-+ w (x * u) (y * z)) ⟩ x * z * v + y * u * v + (x * u * w + y * z * w) ≡⟨ +-assoc (x * z * v) (y * u * v) (x * u * w + y * z * w) ⟩ x * z * v + (y * u * v + (x * u * w + y * z * w)) ≡⟨ cong (\ t → ((x * z * v) + t)) (+-comm (y * u * v) (x * u * w + y * z * w)) ⟩ x * z * v + ((x * u * w + y * z * w) + y * u * v) ≡⟨ sym (+-assoc (x * z * v) (x * u * w + y * z * w) (y * u * v)) ⟩ x * z * v + (x * u * w + y * z * w) + y * u * v ≡⟨ sym (cong (\ t → (t + y * u * v)) ((assoc ℕ+-isSemiGroup) (x * z * v) (x * u * w) (y * z * w))) ⟩ x * z * v + x * u * w + y * z * w + y * u * v ≡⟨ cong (\ t → t + x * u * w + y * z * w + y * u * v) (*-assoc x z v) ⟩ x * (z * v) + x * u * w + y * z * w + y * u * v ≡⟨ cong (\ t → x * (z * v) + t + y * z * w + y * u * v) (*-assoc x u w) ⟩ x * (z * v) + x * (u * w) + y * z * w + y * u * v ≡⟨ cong (\ t → x * (z * v) + x * (u * w) + t + y * u * v) (*-assoc y z w) ⟩ x * (z * v) + x * (u * w) + y * (z * w) + y * u * v ≡⟨ cong (\ t → x * (z * v) + x * (u * w) + y * (z * w) + t) (*-assoc y u v) ⟩ x * (z * v) + x * (u * w) + y * (z * w) + y * (u * v) ≡⟨ sym (cong (\ t → (t + y * (z * w) + y * (u * v))) (*-distribˡ-+ x (z * v) (u * w))) ⟩ x * (z * v + u * w) + y * (z * w) + y * (u * v) ≡⟨ +-assoc (x * (z * v + u * w)) (y * (z * w)) (y * (u * v)) ⟩ x * (z * v + u * w) + (y * (z * w) + y * (u * v)) ≡⟨ sym (cong (\ t → (x * (z * v + u * w) + t)) (*-distribˡ-+ y (z * w) (u * v))) ⟩ x * (z * v + u * w) + y * (z * w + u * v) ∎ ℤ**1-isMonoid : IsMonoid ℤ _**_ (I 1 0) ℤ**1-isMonoid = record { isSemiGroup = ℤ**-isSemiGroup ; identity = (1**x≡x , x**1≡x) } where 1**x≡x : (x : ℤ) → (I 1 0 ** x) ≡ x 1**x≡x O = refl 1**x≡x (I x x₁) = cong₂ I (x+z+z≡x x) (x+z+z≡x x₁) where x+z+z≡x : (x : ℕ) → x + 0 + 0 ≡ x x+z+z≡x zero = refl x+z+z≡x (suc x) = cong suc (x+z+z≡x x) x**1≡x : (x : ℤ) → (x ** I 1 0) ≡ x x**1≡x O = refl x**1≡x (I x x₁) = cong₂ I (x*1+x*0≡x x x₁) (x*0+x*1=x x x₁) where x*1+x*0≡x : (x x₁ : ℕ) → x * 1 + x₁ * 0 ≡ x x*1+x*0≡x zero zero = refl x*1+x*0≡x zero (suc x₁) = x*1+x*0≡x zero x₁ x*1+x*0≡x (suc x) zero = cong suc (x*1+x*0≡x x zero) x*1+x*0≡x (suc x) (suc x₁) = x*1+x*0≡x (suc x) x₁ x*0+x*1=x : (x x₁ : ℕ) → x * 0 + x₁ * 1 ≡ x₁ x*0+x*1=x zero zero = refl x*0+x*1=x zero (suc x₁) = cong suc (x*0+x*1=x zero x₁) x*0+x*1=x (suc x) zero = x*0+x*1=x x zero x*0+x*1=x (suc x) (suc x₁) = x*0+x*1=x x (suc x₁) -- --------------------------- -- ---------- Int + * ---------- ℤ++0invℤ-**1-isRing : IsRing ℤ _++_ _**_ O (I 1 0) invℤ ℤ++0invℤ-**1-isRing = record { ⊕isAbelianGroup = ℤ++Oinvℤ-isAbelianGroup ; ⊗isMonoid = ℤ**1-isMonoid ; isDistR = ℤdistR ; isDistL = ℤdistL } where ℤdistR : (x y z : ℤ) → (x ++ y) ** z ≡ (x ** z) ++ (y ** z) ℤdistR O O O = refl ℤdistR O O (I x x₁) = refl ℤdistR O (I x x₁) O = refl ℤdistR O (I x x₁) (I x₂ x₃) = refl ℤdistR (I x x₁) O O = refl ℤdistR (I x x₁) O (I x₂ x₃) = refl ℤdistR (I x x₁) (I x₂ x₃) O = refl ℤdistR (I x x₁) (I x₂ x₃) (I x₄ x₅) = cong₂ I (ℤdistR₁ x x₂ x₄ x₁ x₃ x₅) (ℤdistR₁ x x₂ x₅ x₁ x₃ x₄) where open PropEq.≡-Reasoning open IsSemiGroup ℤdistR₁ : (x y z u v w : ℕ) → (x + y) * z + (u + v) * w ≡ x * z + u * w + (y * z + v * w) ℤdistR₁ x y z u v w = begin (x + y) * z + (u + v) * w ≡⟨ cong (\ t → t + (u + v) * w) (*-distribʳ-+ z x y) ⟩ x * z + y * z + (u + v) * w ≡⟨ cong (\ t → (x * z + y * z + t)) (*-distribʳ-+ w u v) ⟩ x * z + y * z + (u * w + v * w) ≡⟨ +-assoc (x * z) (y * z) (u * w + v * w) ⟩ x * z + (y * z + (u * w + v * w)) ≡⟨ cong (\ t → x * z + t) (+-comm (y * z) (u * w + v * w)) ⟩ x * z + ((u * w + v * w) + y * z) ≡⟨ cong (\ t → x * z + t) ((assoc ℕ+-isSemiGroup) (u * w) (v * w) (y * z)) ⟩ x * z + (u * w + (v * w + y * z)) ≡⟨ cong (\ t → x * z + (u * w + t)) (+-comm (v * w) (y * z)) ⟩ x * z + (u * w + (y * z + v * w)) ≡⟨ sym ((assoc ℕ+-isSemiGroup) (x * z) (u * w) (y * z + v * w)) ⟩ x * z + u * w + (y * z + v * w) ∎ ℤdistL : (x y z : ℤ) → x ** (y ++ z) ≡ (x ** y) ++ (x ** z) ℤdistL O O O = refl ℤdistL O O (I x x₁) = refl ℤdistL O (I x x₁) O = refl ℤdistL O (I x x₁) (I x₂ x₃) = refl ℤdistL (I x x₁) O O = refl ℤdistL (I x x₁) O (I x₂ x₃) = refl ℤdistL (I x x₁) (I x₂ x₃) O = refl ℤdistL (I x x₁) (I x₂ x₃) (I x₄ x₅) = cong₂ I (ℤdistL₁ x x₁ x₂ x₃ x₄ x₅) (ℤdistL₁ x x₁ x₃ x₂ x₅ x₄) where open PropEq.≡-Reasoning open IsSemiGroup ℤdistL₁ : (x y z u v w : ℕ) → x * (z + v) + y * (u + w) ≡ x * z + y * u + (x * v + y * w) ℤdistL₁ x y z u v w = begin x * (z + v) + y * (u + w) ≡⟨ cong (\ t → t + y * (u + w)) (*-distribˡ-+ x z v) ⟩ x * z + x * v + y * (u + w) ≡⟨ cong (\ t → x * z + x * v + t) (*-distribˡ-+ y u w) ⟩ x * z + x * v + (y * u + y * w) ≡⟨ +-assoc (x * z) (x * v) (y * u + y * w) ⟩ x * z + (x * v + (y * u + y * w)) ≡⟨ sym (cong (\ t → x * z + t) ((assoc ℕ+-isSemiGroup) (x * v) (y * u) (y * w))) ⟩ x * z + ((x * v + y * u) + y * w) ≡⟨ cong (\ t → x * z + (t + y * w)) (+-comm (x * v) (y * u)) ⟩ x * z + ((y * u + x * v) + y * w) ≡⟨ cong (\ t → x * z + t) ((assoc ℕ+-isSemiGroup) (y * u) (x * v) (y * w)) ⟩ x * z + (y * u + (x * v + y * w)) ≡⟨ sym ((assoc ℕ+-isSemiGroup) (x * z) (y * u) (x * v + y * w)) ⟩ x * z + y * u + (x * v + y * w) ∎ -- --------------------------- -- (-1) * (-1) = 1 minus : I 0 1 ** I 0 1 ≡ I 1 0 minus = refl
programs/oeis/109/A109493.asm
neoneye/loda
22
91405
; A109493: a(n) = 7^((n^2 - n)/2). ; 1,1,7,343,117649,282475249,4747561509943,558545864083284007,459986536544739960976801,2651730845859653471779023381601 bin $0,2 mov $1,7 pow $1,$0 mov $0,$1
oeis/249/A249601.asm
neoneye/loda-programs
11
243851
<gh_stars>10-100 ; A249601: Decimal expansion of 1/phi + 1/phi^3 + 1/phi^5 + 1/phi^7, where phi is the Golden Ratio. ; Submitted by <NAME> ; 9,7,8,7,1,3,7,6,3,7,4,7,7,9,1,8,1,2,2,9,6,3,2,3,5,2,1,6,7,8,4,0,0,4,7,2,1,2,6,4,9,2,7,7,5,9,2,1,0,2,0,1,0,4,8,4,4,4,2,1,0,7,6,8,1,0,4,6,9,7,1,9,1,9,6,9,5,1,4,4,3,8,5,1,3,5,1,2,8,7,9,7,7,2 add $0,1 mov $3,$0 mul $3,4 lpb $3 sub $2,118108 add $5,$2 add $1,$5 add $1,$2 add $2,$1 mul $1,2 sub $3,1 mul $5,2 lpe mul $1,21 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
resources/asm/na/actorlistloader_overlay11.asm
SkyTemple/ppmdu
37
101575
; For use with ARMIPS v0.7d ; By: <EMAIL> ; 2016/09/17 ; For Explorers of Sky North American ONLY! ; ------------------------------------------------------------------------------ ; Copyright © 2016 <NAME> <<EMAIL>> ; This work is free. You can redistribute it and/or modify it under the ; terms of the Do What The Fuck You Want To Public License, Version 2, ; as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. ; ------------------------------------------------------------------------------ ;Meant to be included inside the overlay_0011.bin file! .relativeinclude on .nds .arm ;------------------------------------- ; 0x22F7E78 Hook ;------------------------------------- .org 0x22F7F04 .area 28 ;ldr r7,=20A7FF0h ;mov r12,0Ch ldr r1,=2321974h ;Don't Change this! ;"GroundLives Locate id %3d kind %3d index %3d" mov r2,r9 ;Don't Change this! str r4,[r13] ;Don't Change this! ;smlabb r4,r3,r12,r7 mov r0,r3 bl ActorAccessor mov r4,r0 mov r0,1h ;Don't Change this! .endarea .org 0x22F83E0 ;Can replace address to actor table in datapool .area 4 .pool .fill (0x22F83E0 + 4) - .,0 .endarea ;------------------------------------- ; 0x22F8C18 Hook ;------------------------------------- .org 0x22F8C68 .area 4 nop ;022F8C68 E59FB1F4 ldr r11,=20A7FF0h .endarea .org 0x22F8CD0 .area 12 mov r0,r1 ;022F8CD0 E3A0000C mov r0,0Ch bl ActorAccessor ;022F8CD4 E1600081 smulbb r0,r1,r0 ldrsh r0,[r0] ;022F8CD8 E19B00F0 ldrsh r0,[r11,r0] .endarea .org 0x22F8E64 ;Can replace address to actor table in datapool .area 4 .pool .fill (0x22F8E64 + 4) - .,0 .endarea
ffight/lcs/boss/17.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
88020
copyright zengfr site:http://github.com/zengfr/romhack 003CCE move.b #$1, ($17,A3) 003CCE[FF9AA6] 003CD4 move.b ($13,A6), ($69,A3) [boss+17] 004114 clr.b ($17,A6) [1p+42, boss+42, enemy+42] 004118 clr.b ($3,A6) 007360 move.b #$6, ($17,A3) [1p+17] 007366 ori.b #$1, ($68,A1) [boss+17, enemy+17] 0075B8 move.b #$6, ($17,A3) [boss+17, enemy+17] 03DAE6 beq $3daea [boss+17] 03E004 bne $3e00a [boss+17] 03E0AC bne $3e0dc [boss+17] 03E97A beq $3e97e [boss+17] 03EB64 bne $3eb94 [boss+17] copyright zengfr site:http://github.com/zengfr/romhack
bin/getSong.scpt
bluegill/DiscordMusicStatus
0
2997
global currentApplication -- very hacky, couldn't think of a better way to do it -- todo: use node to parse everything if application "iTunes" is running then set currentApplication to "itunes" tell application "iTunes" if player state is playing then set currentTrack to current track tell currentTrack set songTitle to name set songArtist to album artist end tell return {application:currentApplication, title:songTitle, artist:songArtist} end if end tell end if if application "Safari" is running then tell application "Safari" repeat with x from 1 to number of windows repeat with y from 1 to number of tabs in window x set windowTitle to name of tab y of window x if "youtube.com" is in URL of tab y of window x then set currentApplication to "youtube" return my parseTitle(windowTitle) exit repeat end if if "soundcloud.com" is in URL of tab y of window x then set currentApplication to "soundcloud" return my parseTitle(windowTitle) exit repeat end if end repeat end repeat end tell end if if application "Google Chrome" is running then tell application "Google Chrome" repeat with x from 1 to number of windows repeat with y from 1 to number of tabs in window x set windowTitle to title of tab y of window x if "youtube.com" is in URL of tab y of window x then set currentApplication to "youtube" return my parseTitle(windowTitle) exit repeat end if if "soundcloud.com" is in URL of tab y of window x then set currentApplication to "soundcloud" return my parseTitle(windowTitle) exit repeat end if end repeat end repeat end tell end if on parseTitle(windowTitle) if windowTitle contains " - YouTube" then set songData to my split(windowTitle, " - YouTube") set songTitle to item 1 of songData return {application:currentApplication, title:songTitle, artist:""} else if windowTitle contains " by " then set songData to my split(windowTitle, " by ") set songTitle to item 1 of songData set songArtist to item 2 of songData return {application:currentApplication, title:songTitle, artist:songArtist} else if windowTitle contains " in " then set songData to my split(windowTitle, " in ") set songTitle to item 1 of songData return {application:currentApplication, title:songTitle, artist:""} end if return "none" end parseTitle on split(theString, theDelimiter) set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to theDelimiter set theArray to every text item of theString set AppleScript's text item delimiters to oldDelimiters return theArray end split "none"
src/wavefiles_gtk.ads
silentTeee/ada_wavefiles_gtk_app
0
26598
<filename>src/wavefiles_gtk.ads ------------------------------------------------------------------------------- -- -- WAVEFILES GTK APPLICATION -- -- Main Application -- -- The MIT License (MIT) -- -- Copyright (c) 2017 <NAME> -- -- 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 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. ------------------------------------------------------------------------------- with Gtk.Window; with Gtk.Box; package WaveFiles_Gtk is procedure Create; private procedure Destroy_Window; function Get_Window return not null access Gtk.Window.Gtk_Window_Record'Class; function Get_VBox return not null access Gtk.Box.Gtk_Vbox_Record'Class; procedure Set_Wavefile_Info (Info : String); end WaveFiles_Gtk;
2021-2022-sem1/lab09/demo/demo.asm
adinasm/iocla-demos
0
94897
%include "../utils/printf32.asm" section .data len: dd 5 fmt_len: db "%d", 10, 0 fmt_sum: db "%hd", 10, 0 v: db 1, 2, 3, 4, 5 section .text extern printf global main ; https://docs.google.com/presentation/d/1BwDVE_Qo0oo9WduuorB09m3k3QPXAQATZ-7yiqhxnuw/edit?usp=sharing ; short get_sum(char *v, int len); get_sum: push ebp mov ebp, esp ; short sum = 0; (sum e variabila locala) sub esp, 2 mov word [ebp - 2], 0 ; sau [esp] ; [ebp + 4] - adresa de retur mov ebx, [ebp + 8] ; v mov ecx, [ebp + 12] ; len xor edx, edx add_val: mov dl, [ebx + ecx - 1] add [ebp - 2], dx loop add_val mov ax, [ebp - 2] leave ; echiv: ; mov esp, ebp ; pop ebp ret ; pop eip ; cdecl ; - parametrii se pun pe stiva ; - functia apelanta pune param ep stiva si tot ea ii scoate de acolo ; - valoarea de retur: al (8b), ax (16b), eax (32b), (sau pe stiva daca nu incape intr-un registru) main: push ebp mov ebp, esp ; printf("%d\n", len); push dword [len] ; len push fmt_len ; fmt_len call printf add esp, 8 push dword [len] push v call get_sum ; pune pe stiva adresa de retur (adresa urm instr == add esp, 8) ; jmp get_sum add esp, 8 ; printf("%hd\n", ax); push ax push fmt_sum call printf add esp, 6 leave ret
programs/oeis/131/A131063.asm
neoneye/loda
22
19533
<filename>programs/oeis/131/A131063.asm ; A131063: Triangle read by rows: T(n,k) = 5*binomial(n,k) - 4 for 0 <= k <= n. ; 1,1,1,1,6,1,1,11,11,1,1,16,26,16,1,1,21,46,46,21,1,1,26,71,96,71,26,1,1,31,101,171,171,101,31,1,1,36,136,276,346,276,136,36,1,1,41,176,416,626,626,416,176,41,1,1,46,221,596,1046,1256,1046,596,221,46,1,1,51,271,821,1646,2306,2306,1646,821,271,51,1,1,56,326,1096,2471,3956,4616,3956,2471,1096,326,56,1,1,61,386,1426,3571,6431,8576,8576,6431 lpb $0 add $1,1 sub $0,$1 lpe bin $1,$0 sub $1,1 mul $1,10 add $1,2 div $1,2 mov $0,$1
1A/S5/PIM/tps/tp4/dates.adb
MOUDDENEHamza/ENSEEIHT
4
7816
-- Implantation d'un module Dates très simplifié. with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; package body Dates is procedure Initialiser ( Date : out T_Date ; Jour : in Integer ; Mois : in T_Mois ; Annee : in Integer ) is begin Date.Jour := Jour; Date.Mois := Mois; Date.Annee := Annee; end Initialiser; -- Afficher un entier sur 2 positons au moins (avec des zéros -- supplémentaires si nécessaires) -- -- Paramètres : -- Nombre : le nombre à afficher -- -- Nécessite : -- Nombre >= 0 -- procedure Afficher_Deux_Positions (Nombre : in Integer) with Pre => Nombre >= 0 is begin Put (Nombre / 10, 1); Put (Nombre mod 10, 1); end Afficher_Deux_Positions; procedure Afficher (Date : in T_Date) is begin Afficher_Deux_Positions (Date.Jour); Put ('/'); Afficher_Deux_Positions (T_Mois'pos (Date.Mois) + 1); Put ('/'); Afficher_Deux_Positions (Date.Annee / 100); Afficher_Deux_Positions (Date.Annee mod 100); end Afficher; function Le_Jour (Date : in T_Date) return Integer is begin return Date.Jour; end Le_Jour; function Le_Mois(Date : in T_Date) return T_Mois is begin return Date.Mois; end Le_Mois; function L_Annee (Date : in T_Date) return Integer is begin return Date.Annee; end L_Annee; end Dates;
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_32_1105.asm
ljhsiun2/medusa
9
3048
.global s_prepare_buffers s_prepare_buffers: push %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1c13, %rax nop nop nop nop nop xor $24505, %r9 mov (%rax), %dx nop add $64915, %r8 lea addresses_WT_ht+0x17a86, %rsi lea addresses_UC_ht+0x55a1, %rdi clflush (%rdi) nop nop and %rbp, %rbp mov $41, %rcx rep movsw and $8083, %r8 lea addresses_WC_ht+0xcca1, %rax xor $1129, %rcx mov (%rax), %ebp nop nop nop nop nop and %rcx, %rcx lea addresses_A_ht+0x11409, %rsi lea addresses_UC_ht+0x10d89, %rdi nop nop nop inc %r9 mov $125, %rcx rep movsw nop nop nop nop nop sub $37655, %r8 lea addresses_WT_ht+0x147a1, %rsi lea addresses_WC_ht+0x1d7a1, %rdi nop nop nop nop nop and $22521, %rdx mov $14, %rcx rep movsq nop nop add $60985, %r8 lea addresses_WT_ht+0x17971, %rsi lea addresses_UC_ht+0x27a1, %rdi nop sub $37479, %r8 mov $37, %rcx rep movsb nop nop nop nop nop mfence lea addresses_normal_ht+0xd521, %r8 nop nop nop nop nop add $57011, %r9 movb $0x61, (%r8) nop cmp %rcx, %rcx lea addresses_D_ht+0x1b883, %r8 nop nop nop nop nop inc %rdi movb $0x61, (%r8) nop add $56833, %rbp lea addresses_WT_ht+0xada1, %r8 add %rsi, %rsi vmovups (%r8), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rbp xor $2696, %rdi lea addresses_WT_ht+0x18da1, %rcx nop nop nop nop sub $27371, %rdi mov (%rcx), %rbp xor $23065, %r8 lea addresses_A_ht+0x51a1, %rsi sub %rbp, %rbp mov $0x6162636465666768, %rcx movq %rcx, %xmm0 vmovups %ymm0, (%rsi) nop xor $48256, %rdx lea addresses_WC_ht+0x1db21, %rcx nop nop nop nop nop and $11054, %rdx mov $0x6162636465666768, %rbp movq %rbp, %xmm6 movups %xmm6, (%rcx) nop nop nop nop nop dec %rdx lea addresses_UC_ht+0xe8a1, %rdi and $994, %r9 movb $0x61, (%rdi) nop and $61869, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r8 push %rbx push %rdi push %rdx push %rsi // Store lea addresses_PSE+0x131a1, %rsi xor %rdx, %rdx movw $0x5152, (%rsi) nop add $40918, %r13 // Store mov $0x4bc9310000000da1, %rdx nop nop nop add %rbx, %rbx movw $0x5152, (%rdx) nop nop nop xor %rbx, %rbx // Store mov $0xb21, %r13 nop nop nop nop nop add $31642, %rdi mov $0x5152535455565758, %rbx movq %rbx, %xmm2 vmovups %ymm2, (%r13) nop nop nop nop nop dec %rsi // Store lea addresses_A+0x7621, %rdx nop nop nop xor $59692, %r13 mov $0x5152535455565758, %rdi movq %rdi, (%rdx) nop and %rsi, %rsi // Faulty Load mov $0x4bc9310000000da1, %rdx nop nop and %rdi, %rdi movntdqa (%rdx), %xmm5 vpextrq $1, %xmm5, %r8 lea oracles, %r14 and $0xff, %r8 shlq $12, %r8 mov (%r14,%r8,1), %r8 pop %rsi pop %rdx pop %rdi pop %rbx pop %r8 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'00': 32} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
src/main/antlr4/me/saharnooby/luajssyntax/LuaJSSyntax.g4
lofcz/lua-js-syntax
9
380
grammar LuaJSSyntax; program : statement* EOF ; block : '{' statement* '}' ; statement : ';' # Semicolon | block # BlockStatement | 'let' namelist ('=' explist)? # LocalVariableDeclaration | varlist '=' explist # GlobalVariableDeclaration | var assignmentOperator exp # AssginmentOperator | var nameAndArgs # FunctionCall | NAME ':' # LabelDeclaration | 'break' # Break | 'continue' # Continue | 'goto' NAME # Goto | 'return' explist? # Return | 'if' '(' exp ')' statement ('else' statement)? # If | 'while' '(' exp ')' statement # While | 'do' statement 'while' '(' exp ')' # DoWhile | 'for' '(' init=statement? ';' exp? ';' after=statement? ')' body=statement # For | 'for' '(' namelist 'in' exp ')' statement # ForIn | 'for' '(' NAME (',' NAME)? 'of' exp ')' statement # ForOf | 'function' funcname '(' namelist? ')' block # FunctionDeclaration | 'try' block 'catch' '(' NAME ')' block # TryCatch | 'throw' exp # Throw | var '++' # Increment | var '--' # Decrement ; exp : '(' exp ')' # ParenthesisExpression | ('nil' | 'true' | 'false') # Literal | number # NumberLiteral | string # StringLiteral | var # VarExpression | var nameAndArgs # FunctionCallExpression | table # TableExpression | list # ListExpression | 'function' '(' namelist? ')' block # FunctionLiteral | ('(' namelist? ')' | NAME) '=>' (exp | block) # ArrowFunctionLiteral | op=('!' | '-' | '~' | '#') exp # UnaryOperator | <assoc=right> exp op='**' exp # PowerOperator | exp op=('*' | '/' | '%') exp # MulDivModOperator | exp op=('+' | '-') exp # AddSubOperator | exp op=('<<' | '>>') exp # BitwiseShift | exp op='&' exp # BitwiseAnd | exp op='^' exp # BitwiseXor | exp op='|' exp # BitwiseOr | <assoc=right> exp op='..' exp # ConcatOperator | exp op=('<' | '>' | '<=' | '>=' | '!=' | '==') exp # ComparisonOperator | exp op='&&' exp # AndOperator | exp op='||' exp # OrOperator | <assoc=right> exp '?' exp ':' exp # TernaryOperator ; table : '{' entries? '}' ; list : '[' elements? ']' ; assignmentOperator : '*=' | '/=' | '%=' | '+=' | '-=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '..=' | '**=' ; funcname : (NAME '::')? NAME ; namelist : NAME (',' NAME)* ; explist : exp (',' exp)* ; entries : entry (',' entry)* ','? ; entry : (NAME | key_expr) ':' exp ; key_expr : '[' exp ']' ; elements : exp (',' exp)* ','? ; var : (NAME | '(' exp ')' varSuffix) varSuffix* ; varSuffix : nameAndArgs* ('[' exp ']' | '.' NAME) ; nameAndArgs : ('::' NAME)? args ; args : '(' explist? ')' ; varlist : var (',' var)* ; number : INT | HEX | FLOAT | HEX_FLOAT ; string : NORMALSTRING | CHARSTRING ; NAME : [a-zA-Z_][a-zA-Z_0-9]* ; INT : Digit+ ; HEX : '0' [xX] HexDigit+ ; FLOAT : Digit+ '.' Digit* ExponentPart? | '.' Digit+ ExponentPart? | Digit+ ExponentPart ; HEX_FLOAT : '0' [xX] HexDigit+ '.' HexDigit* HexExponentPart? | '0' [xX] '.' HexDigit+ HexExponentPart? | '0' [xX] HexDigit+ HexExponentPart ; fragment Digit : [0-9] ; fragment HexDigit : [0-9a-fA-F] ; fragment ExponentPart : [eE] [+-]? Digit+ ; fragment HexExponentPart : [pP] [+-]? Digit+ ; NORMALSTRING : '"' ( EscapeSequence | ~('\\'|'"') )* '"' ; CHARSTRING : '\'' ( EscapeSequence | ~('\''|'\\') )* '\'' ; fragment EscapeSequence : '\\' [abfnrtvz"'\\] | '\\' '\r'? '\n' | DecimalEscape | HexEscape | UtfEscape ; fragment DecimalEscape : '\\' Digit | '\\' Digit Digit | '\\' [0-2] Digit Digit ; fragment HexEscape : '\\' 'x' HexDigit HexDigit ; fragment UtfEscape : '\\' 'u' HexDigit HexDigit HexDigit HexDigit ; COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; LINE_COMMENT : '//' ( | ~('\r'|'\n') ~('\r'|'\n')* ) ('\r\n'|'\r'|'\n'|EOF) -> channel(HIDDEN) ; WS : [ \t\u000C\r\n]+ -> skip ;
oeis/067/A067358.asm
neoneye/loda-programs
11
102537
; A067358: Imaginary part of (5+12i)^n. ; Submitted by <NAME> ; 0,12,120,-828,-28560,-145668,3369960,58317492,13651680,-9719139348,-99498527400,647549275812,23290743888720,123471611274972,-2701419604443960,-47880898349909868,-22269070348069440,7869181117654073292,82455284065364468280,-505338768229893703548 mul $0,2 mov $2,1 lpb $0 sub $0,1 mov $1,$2 add $3,$2 mul $2,3 sub $2,$3 mul $3,4 add $3,$1 lpe mov $0,$3 div $0,30 mul $0,12
Relation/Nullary/Discrete/Properties.agda
oisdk/agda-playground
6
11178
<reponame>oisdk/agda-playground<gh_stars>1-10 {-# OPTIONS --cubical --safe #-} module Relation.Nullary.Discrete.Properties where open import Relation.Nullary.Discrete open import Relation.Nullary.Stable.Properties using (Stable≡→isSet) open import Relation.Nullary.Decidable.Properties using (Dec→Stable; isPropDec) open import HLevels open import Level open import Path Discrete→isSet : Discrete A → isSet A Discrete→isSet d = Stable≡→isSet (λ x y → Dec→Stable (x ≡ y) (d x y)) isPropDiscrete : isProp (Discrete A) isPropDiscrete f g i x y = isPropDec (Discrete→isSet f x y) (f x y) (g x y) i
test/LibSucceed/Issue4312.agda
cruhland/agda
1
5784
<reponame>cruhland/agda {-# OPTIONS --without-K --safe #-} open import Level record Category (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where eta-equality infix 4 _≈_ _⇒_ infixr 9 _∘_ field Obj : Set o _⇒_ : Obj → Obj → Set ℓ _≈_ : ∀ {A B} → (A ⇒ B) → (A ⇒ B) → Set e _∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C) CommutativeSquare : ∀ {A B C D} → (f : A ⇒ B) (g : A ⇒ C) (h : B ⇒ D) (i : C ⇒ D) → Set _ CommutativeSquare f g h i = h ∘ f ≈ i ∘ g infix 10 _[_,_] _[_,_] : ∀ {o ℓ e} → (C : Category o ℓ e) → (X : Category.Obj C) → (Y : Category.Obj C) → Set ℓ _[_,_] = Category._⇒_ module Inner {x₁ x₂ x₃} (CC : Category x₁ x₂ x₃) where open import Level private variable o ℓ e o′ ℓ′ e′ o″ ℓ″ e″ : Level open import Data.Product using (_×_; Σ; _,_; curry′; proj₁; proj₂; zip; map; <_,_>; swap) zipWith : ∀ {a b c p q r s} {A : Set a} {B : Set b} {C : Set c} {P : A → Set p} {Q : B → Set q} {R : C → Set r} {S : (x : C) → R x → Set s} (_∙_ : A → B → C) → (_∘_ : ∀ {x y} → P x → Q y → R (x ∙ y)) → (_*_ : (x : C) → (y : R x) → S x y) → (x : Σ A P) → (y : Σ B Q) → S (proj₁ x ∙ proj₁ y) (proj₂ x ∘ proj₂ y) zipWith _∙_ _∘_ _*_ (a , p) (b , q) = (a ∙ b) * (p ∘ q) syntax zipWith f g h = f -< h >- g record Functor (C : Category o ℓ e) (D : Category o′ ℓ′ e′) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where eta-equality private module C = Category C private module D = Category D field F₀ : C.Obj → D.Obj F₁ : ∀ {A B} (f : C [ A , B ]) → D [ F₀ A , F₀ B ] Product : (C : Category o ℓ e) (D : Category o′ ℓ′ e′) → Category (o ⊔ o′) (ℓ ⊔ ℓ′) (e ⊔ e′) Product C D = record { Obj = C.Obj × D.Obj ; _⇒_ = C._⇒_ -< _×_ >- D._⇒_ ; _≈_ = C._≈_ -< _×_ >- D._≈_ ; _∘_ = zip C._∘_ D._∘_ } where module C = Category C module D = Category D Bifunctor : Category o ℓ e → Category o′ ℓ′ e′ → Category o″ ℓ″ e″ → Set _ Bifunctor C D E = Functor (Product C D) E private module CC = Category CC open CC infix 4 _≅_ record _≅_ (A B : Obj) : Set (x₂) where field from : A ⇒ B to : B ⇒ A private variable X Y Z W : Obj f g h : X ⇒ Y record Monoidal : Set (x₁ ⊔ x₂ ⊔ x₃) where infixr 10 _⊗₀_ _⊗₁_ field ⊗ : Bifunctor CC CC CC module ⊗ = Functor ⊗ open Functor ⊗ _⊗₀_ : Obj → Obj → Obj _⊗₀_ = curry′ F₀ -- this is also 'curry', but a very-dependent version _⊗₁_ : X ⇒ Y → Z ⇒ W → X ⊗₀ Z ⇒ Y ⊗₀ W f ⊗₁ g = F₁ (f , g) field associator : (X ⊗₀ Y) ⊗₀ Z ≅ X ⊗₀ (Y ⊗₀ Z) module associator {X} {Y} {Z} = _≅_ (associator {X} {Y} {Z}) -- for exporting, it makes sense to use the above long names, but for -- internal consumption, the traditional (short!) categorical names are more -- convenient. However, they are not symmetric, even though the concepts are, so -- we'll use ⇒ and ⇐ arrows to indicate that private α⇒ = associator.from α⇐ = λ {X} {Y} {Z} → associator.to {X} {Y} {Z} field assoc-commute-from : CommutativeSquare ((f ⊗₁ g) ⊗₁ h) α⇒ α⇒ (f ⊗₁ (g ⊗₁ h)) assoc-commute-to : CommutativeSquare (f ⊗₁ (g ⊗₁ h)) α⇐ α⇐ ((f ⊗₁ g) ⊗₁ h)
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vect8.adb
best08618/asylo
7
29216
-- { dg-do compile } -- { dg-options "-w" } package body Vect8 is function Foo (V : Vec) return Vec is Ret : Vec; begin Ret (1) := V (1) + V (2); Ret (2) := V (1) - V (2); return Ret; end; end Vect8;
src/tom/library/sl/ada/sequencestrategy.adb
rewriting/tom
36
30639
with VisitFailurePackage, VisitablePackage, EnvironmentPackage; use VisitFailurePackage, VisitablePackage, EnvironmentPackage; package body SequenceStrategy is ---------------------------------------------------------------------------- -- Object implementation ---------------------------------------------------------------------------- overriding function toString(o: Sequence) return String is begin return "Sequence()"; end; ---------------------------------------------------------------------------- -- Strategy implementation ---------------------------------------------------------------------------- overriding function visitLight(str:access Sequence; any: ObjectPtr; i: access Introspector'Class) return ObjectPtr is op : ObjectPtr := visitLight( StrategyPtr(str.arguments(FIRST)), any, i); begin return visitLight(StrategyPtr(str.arguments(SECOND)), op, i); end; overriding function visit(str: access Sequence; i: access Introspector'Class) return Integer is status : Integer := visit(StrategyPtr(str.arguments(FIRST)), i); begin if status = EnvironmentPackage.SUCCESS then return visit(StrategyPtr(str.arguments(SECOND)), i); else return status; end if; end; ---------------------------------------------------------------------------- procedure makeSequence(s : in out Sequence; str1, str2 : StrategyPtr) is begin initSubterm(s, str1, str2); end; function make(str1, str2: StrategyPtr) return StrategyPtr is ns : StrategyPtr := null; begin if str2 = null then return str1; else ns := new Sequence; makeSequence(Sequence(ns.all), str1, str2); return ns; end if; end; function newSequence(str1, str2: StrategyPtr) return StrategyPtr is begin return SequenceStrategy.make(str1,str2); end; ---------------------------------------------------------------------------- end SequenceStrategy;
test/Succeed/Issue2759.agda
cruhland/agda
1,989
1140
<gh_stars>1000+ -- Andreas, 2017-09-16, issue #2759 -- Allow empty declaration blocks in the parser. open import Agda.Builtin.Nat x0 = zero mutual x1 = suc x0 abstract x2 = suc x1 private x3 = suc x2 instance x4 = suc x3 macro x5 = suc x4 postulate x6 = suc x5 -- Expected: 6 warnings about empty blocks mutual postulate -- Empty postulate block. abstract private instance macro -- Empty macro block. -- Empty blocks are also tolerated in lets and lambdas. _ = λ (let abstract ) → let abstract in Set _ = λ (let field ) → let field in Set _ = λ (let instance ) → let instance in Set _ = λ (let macro ) → let macro in Set _ = λ (let mutual ) → let mutual in Set _ = λ (let postulate) → let postulate in Set _ = λ (let private ) → let private in Set
.github/idt.asm
Amankhan-ally/theunbelievables
0
100750
[extern _idt] idtDescriptor: dw 4095 dq _idt %macro PUSHALL 0 push rax push rcx push rdx push r8 push r9 push r10 push r11 %endmacro %macro POPALL 0 pop r11 pop r10 pop r9 pop r8 pop rdx pop rcx pop rax %endmacro [extern isr1_handler] isr1: PUSHALL call isr1_handler POPALL iretq GLOBAL isr1 LoadIDT: lidt[idtDescriptor] sti ret GLOBAL LoadIDT
programs/oeis/233/A233905.asm
karttu/loda
0
82012
<filename>programs/oeis/233/A233905.asm ; A233905: a(2n) = a(n), a(2n+1) = a(n) + n, with a(0)=0. ; 0,0,0,1,0,2,1,4,0,4,2,7,1,7,4,11,0,8,4,13,2,12,7,18,1,13,7,20,4,18,11,26,0,16,8,25,4,22,13,32,2,22,12,33,7,29,18,41,1,25,13,38,7,33,20,47,4,32,18,47,11,41,26,57,0,32,16,49,8,42,25,60,4,40,22,59,13,51,32,71,2,42,22,63,12,54,33,76,7,51,29,74,18,64,41,88,1,49,25,74,13,63,38,89,7,59,33,86,20,74,47,102,4,60,32,89,18,76,47,106,11,71,41,102,26,88,57,120,0,64,32,97,16,82,49,116,8,76,42,111,25,95,60,131,4,76,40,113,22,96,59,134,13,89,51,128,32,110,71,150,2,82,42,123,22,104,63,146,12,96,54,139,33,119,76,163,7,95,51,140,29,119,74,165,18,110,64,157,41,135,88,183,1,97,49,146,25,123,74,173,13,113,63,164,38,140,89,192,7,111,59,164,33,139,86,193,20,128,74,183,47,157,102,213,4,116,60,173,32,146,89,204,18,134,76,193,47,165,106,225,11,131,71,192,41,163,102,225,26,150 lpb $0,1 lpb $0,1 div $0,2 mul $0,2 add $1,$0 lpe div $0,2 lpe div $1,2
Mid-Term/Solution/5.asm
afra-tech/CSE331L-Section-1-Fall20-NSU
0
166288
org 100H A DB 1,1,2,2,3,3 B DB 6 DUP(?) MOV DX, OFFSET A MOV BX, OFFSET B MOV CX, 6 loopcopy: MOV AL, [A] MOV [B], AL INC DX INC BX LOOP loopcopy ret
array_utils/tests/src/array_utils-test_cases.adb
jgrivera67/projects-with-amy
0
28070
with AUnit.Assertions; package body Array_Utils.Test_Cases is Test_Array : constant Array_Type (1 .. 8) := (10, 20, 30, 40, 50, 60, 70, 80); procedure Test_Linear_Search_Element_Found_First_Entry (T : in out Test_Case) is pragma Unreferenced (T); begin AUnit.Assertions.Assert (Linear_Search (Test_Array, 10) = Test_Array'First, "Entry not found at expected location"); end Test_Linear_Search_Element_Found_First_Entry; procedure Test_Linear_Search_Element_Found_Last_Entry (T : in out Test_Case) is pragma Unreferenced (T); begin AUnit.Assertions.Assert (Linear_Search (Test_Array, 80) = Test_Array'Last, "Entry not found at expected location"); end Test_Linear_Search_Element_Found_Last_Entry; procedure Test_Linear_Search_Element_Found_Middle_Entry (T : in out Test_Case) is pragma Unreferenced (T); begin AUnit.Assertions.Assert (Linear_Search (Test_Array, 40) = 4, "Entry not found at expected location"); end Test_Linear_Search_Element_Found_Middle_Entry; procedure Test_Linear_Search_Element_Not_Found (T : in out Test_Case) is pragma Unreferenced (T); begin AUnit.Assertions.Assert (Linear_Search (Test_Array, 45) = 0, "Entry should not have been found"); end Test_Linear_Search_Element_Not_Found; -- TODO: Add unit tests for Binary_Search end Array_Utils.Test_Cases;
4-high/gel/applet/demo/distributed/gel_demo_services.adb
charlie5/lace
20
4635
with gel_demo_Server; package body gel_demo_Services is function World return gel.remote.World.view is begin return gel_demo_Server.the_server_World.all'access; end World; end gel_demo_Services;
agda-stdlib/README/Debug/Trace.agda
DreamLinuxer/popl21-artifact
5
16222
<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- An example showing how the Debug.Trace module can be used ------------------------------------------------------------------------ {-# OPTIONS --without-K #-} module README.Debug.Trace where ------------------------------------------------------------------------ -- Sometimes compiled code can contain bugs. -- Whether caused by the compiler or present in the source code already, they -- can be hard to track. A primitive debugging technique is to strategically -- insert calls to tracing functions which will display their String argument -- upon evaluation. open import Data.String.Base using (_++_) open import Debug.Trace -- We can for instance add tracing messages to make sure an invariant is -- respected or check in which order evaluation takes place in the backend -- (which can inform our decision to use, or not, strictness primitives). -- In the following example, we define a division operation on natural numbers -- using the original dividend as the termination measure. We: -- 1. check in the base case that when the fuel runs out then the updated dividend -- is already zero. -- 2. wrap the calls to _∸_ and go in respective calls to trace to see when all -- of these thunks are forced: are we building a big thunk in go's second -- argument or evaluating it as we go? open import Data.Maybe.Base open import Data.Nat.Base open import Data.Nat.Show using (show) div : ℕ → ℕ → Maybe ℕ div m zero = nothing div m n = just (go m m) where -- invariants: m ≤ fuel -- result : m / n go : (fuel : ℕ) (m : ℕ) → ℕ go zero m = trace ("Invariant: " ++ show m ++ " should be zero.") zero go (suc fuel) m = let m' = trace ("Thunk for step " ++ show fuel ++ " forced") (m ∸ n) in trace ("Recursive call for step " ++ show fuel) (suc (go fuel m')) -- To observe the behaviour of this code, we need to compile it and run it. -- To run it, we need a main function. We define a very basic one: run div, -- and display its result if the run was successful. -- We add two calls to trace to see when div is evaluated and when the returned -- number is forced (by a call to show). open import IO main = let r = trace "Call to div" (div 4 2) j = λ n → trace "Forcing the result wrapped in just." (putStrLn (show n)) in run (maybe′ j (return _) r) -- We get the following trace where we can see that checking that the -- maybe-solution is just-headed does not force the natural number. Once forced, -- we observe that we indeed build a big thunk on go's second argument (all the -- recursive calls happen first and then we force the thunks one by one). -- Call to div -- Forcing the result wrapped in just. -- Recursive call for step 3 -- Recursive call for step 2 -- Recursive call for step 1 -- Recursive call for step 0 -- Thunk for step 0 forced -- Thunk for step 1 forced -- Thunk for step 2 forced -- Thunk for step 3 forced -- Invariant: 0 should be zero. -- 4 -- We also notice that the result is incorrect: 4/2 is 2 and not 4. We quickly -- notice that (div m (suc n)) will perform m recursive calls no matter what. -- And at each call it will put add 1. We can fix this bug by adding a new first -- equation to go: -- go fuel zero = zero -- Running the example again we observe that because we now need to check -- whether go's second argument is zero, the function is more strict: we see -- that recursive calls and thunk forcings are interleaved. -- Call to div -- Forcing the result wrapped in just. -- Recursive call for step 3 -- Thunk for step 3 forced -- Recursive call for step 2 -- Thunk for step 2 forced -- 2
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr26.adb
best08618/asylo
7
19557
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr26.adb<gh_stars>1-10 -- { dg-do compile } -- { dg-options "-gnatws" } package body Discr26 is function F1 return My_T1 is R: My_T1; begin return R; end; procedure Proc is begin if F1.D = 0 then raise Program_Error; end if; end; end Discr26;
source/asis/asis-gela-overloads-types.adb
faelys/gela-asis
4
29762
<gh_stars>1-10 ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Asis.Elements; with Asis.Gela.Utils; with Asis.Gela.Errors; with Asis.Expressions; with Asis.Definitions; with Asis.Declarations; with Asis.Gela.Replace; with Asis.Gela.Overloads.Attr; with Ada.Unchecked_Deallocation; with XASIS.Types; with XASIS.Utils; package body Asis.Gela.Overloads.Types is -- use Asis.Elements; use XASIS.Utils; use Asis.Gela.Classes; generic with function Pass (Item : Type_Info) return Boolean; Xor_Logic : in Boolean := False; procedure Constrain_To (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element); function Is_Tagged_Non_Limited (Info : Type_Info) return Boolean; function Has_Type (Item : Up_Interpretation; Mark : Classes.Type_Info) return Boolean; --------- -- Add -- --------- procedure Add (Container : in out Stored_Set; Item : in Stored_Interpretation) is begin R.Append (Container.List, Item); Container.Length := Container.Length + 1; end Add; --------- -- Add -- --------- procedure Add (Container : in out Up_Interpretation_Set; Item : in Up_Interpretation) is begin L.Append (Container.Items.all, Item); Container.Length := Container.Length + 1; end Add; -------------------- -- Check_Implicit -- -------------------- procedure Check_Implicit (Set : in out Implicit_Set; Store : in out Stored_Sets; Element : in out Asis.Element; Down : in out Down_Interpretation) is use Implicit_Nodes; use Asis.Gela.Replace; Index : Cursor := First (Set.all); Node : Implicit_Node; Found : Boolean := False; St : Stored_Set; Stored : Stored_Interpretation; begin if Down.Kind /= An_Expression then return; end if; while Has_Element (Index) loop Node := Implicit_Nodes.Element (Index); if Is_Equal (Node.Key, Element) then if not Found and then Is_Expected_Type (Node.Return_Type, Down.Expression_Type) then Found := True; if Node.Is_Call then Expression_To_Function_Call (Element); St := Create; Stored.Kind := A_Function_Call; Stored.Result_Type := Node.Return_Type; Stored.Down := Node.Down; Add (St, Stored); Put (Store, Element, St); else -- implicit dereference Down := To_Down_Interpretation (Node.Down); end if; end if; Delete (Set.all, Index); else Index := Next (Index); end if; end loop; end Check_Implicit; ---------------- -- Check_Name -- ---------------- function Check_Name (Name : Up_Interpretation) return Boolean is begin case Name.Kind is when An_Identifier => raise Internal_Error; when A_Declaration => return Check_Callable_Name (Name.Declaration); when A_Family_Member | A_Subprogram_Reference | An_Attribute_Function | A_Prefixed_View => return True; when An_Expression => return Is_Subprogram_Access (Name.Expression_Type); when others => return False; end case; end Check_Name; ------------------ -- Constrain_To -- ------------------ procedure Constrain_To (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) is Item : Up_Interpretation; Passed : Boolean; Index : L.Cursor; begin Expand_Expression (Set, Impl, Element); Index := L.First (Set.Items.all); while L.Has_Element (Index) loop Item := L.Element (Index); Passed := False; case Item.Kind is when An_Expression => Passed := Xor_Logic xor Pass (Item.Expression_Type); when An_Identifier => raise Internal_Error; when A_Box => Passed := not Xor_Logic; when A_Declaration | A_Prefixed_View | A_Family_Member | A_Range | A_String_Type | A_Procedure_Call | A_Subprogram_Reference | A_General_Access | An_Object_Access | A_Subprogram_Access | An_Array_Aggregate | A_Subaggregate | A_Record_Aggregate | An_Extension_Aggregate | An_Attribute_Function | A_Boolean | A_Type | A_Skip => null; end case; if Passed then Index := L.Next (Index); else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end loop; Set.Index := 0; end Constrain_To; ------------------------------- -- Constrain_To_Access_Types -- ------------------------------- procedure Constrain_To_Access is new Constrain_To (Is_Access); procedure Constrain_To_Access_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Access; -------------------------------- -- Constrain_To_Boolean_Types -- -------------------------------- procedure Constrain_To_Boolean is new Constrain_To (Is_Boolean); procedure Constrain_To_Boolean_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Boolean; ------------------------ -- Constrain_To_Calls -- ------------------------ procedure Constrain_To_Calls (Set : in out Up_Interpretation_Set) is function Is_Procedure (Decl : Asis.Declaration) return Boolean is use Asis.Elements; begin case Declaration_Kind (Decl) is when A_Procedure_Declaration | A_Procedure_Body_Declaration | A_Procedure_Renaming_Declaration | An_Entry_Declaration => return True; when others => return False; end case; end Is_Procedure; Item : Up_Interpretation; Index : L.Cursor; begin Resolve_Identifier (Set); Index := L.First (Set.Items.all); while L.Has_Element (Index) loop Item := L.Element (Index); if Item.Kind = A_Procedure_Call then Index := L.Next (Index); elsif Item.Kind = A_Declaration and then Parameterless (Item.Declaration) and then Is_Procedure (Item.Declaration) then Index := L.Next (Index); elsif Item.Kind = A_Family_Member and then XASIS.Utils.Is_Entry_Family (Item.Declaration) and then Is_Empty_Profile (Get_Profile (Item.Declaration)) then Index := L.Next (Index); elsif Item.Kind = A_Prefixed_View and then Is_Empty_Profile (Get_Profile (Item)) and then Is_Procedure (Item.Declaration) then Index := L.Next (Index); else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end loop; Set.Index := 0; end Constrain_To_Calls; --------------------------------- -- Constrain_To_Discrete_Types -- --------------------------------- procedure Constrain_To_Discrete is new Constrain_To (Is_Discrete); procedure Constrain_To_Discrete_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Discrete; -------------------------------- -- Constrain_To_Integer_Types -- -------------------------------- procedure Constrain_To_Integer is new Constrain_To (Is_Integer); procedure Constrain_To_Integer_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Integer; ------------------------------------ -- Constrain_To_Non_Limited_Types -- ------------------------------------ procedure Constrain_To_Non_Limited is new Constrain_To (Is_Limited, True); procedure Constrain_To_Non_Limited_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Non_Limited; -------------------------------- -- Constrain_To_Numeric_Types -- -------------------------------- procedure Constrain_To_Numeric is new Constrain_To (Is_Numeric); procedure Constrain_To_Numeric_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Numeric; ------------------------------ -- Constrain_To_Real_Types -- ------------------------------ procedure Constrain_To_Real is new Constrain_To (Is_Real); procedure Constrain_To_Real_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Real; ------------------------------- -- Constrain_To_Tagged_Types -- ------------------------------- procedure Constrain_To_Tagged is new Constrain_To (Is_Tagged); procedure Constrain_To_Tagged_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Tagged; ------------------------------------------- -- Constrain_To_Tagged_Non_Limited_Types -- ------------------------------------------- procedure Constrain_To_Tagged_Non_Limited is new Constrain_To (Is_Tagged_Non_Limited); procedure Constrain_To_Tagged_Non_Limited_Types (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) renames Constrain_To_Tagged_Non_Limited; ------------------------ -- Constrain_To_Range -- ------------------------ procedure Constrain_To_Range (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element; Tipe : in Classes.Type_Info) is Item : Up_Interpretation; Index : L.Cursor := L.First (Set.Items.all); begin while L.Has_Element (Index) loop Item := L.Element (Index); if Item.Kind = A_Range and then Is_Expected_Type (Item.Range_Type, Tipe) then Index := L.Next (Index); else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end loop; Set.Index := 0; end Constrain_To_Range; --------------------------------- -- Constrain_To_Discrete_Range -- --------------------------------- procedure Constrain_To_Discrete_Range (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) is Item : Up_Interpretation; Index : L.Cursor := L.First (Set.Items.all); begin while L.Has_Element (Index) loop Item := L.Element (Index); if Item.Kind = A_Range and then Is_Discrete (Item.Range_Type) then Index := L.Next (Index); else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end loop; Set.Index := 0; end Constrain_To_Discrete_Range; ----------------------------------- -- Constrain_To_Expected_Profile -- ----------------------------------- procedure Constrain_To_Expected_Profile (Set : in out Up_Interpretation_Set; Profile : in Asis.Declaration; Place : in Asis.Element; Empty : in Boolean := False) is use Asis.Gela.Utils; use Asis.Declarations; function Get_Name (Element : Asis.Element) return Asis.Defining_Name is begin if Element_Kind (Element.all) = A_Statement then return Accept_Entry_Direct_Name (Profile.all); else return Names (Profile) (1); end if; end Get_Name; Name : constant Asis.Element := Get_Name (Profile); Item : Up_Interpretation; Index : L.Cursor; begin Resolve_Identifier (Set); Index := L.First (Set.Items.all); while L.Has_Element (Index) loop Item := L.Element (Index); if ((Item.Kind = A_Declaration or Item.Kind = A_Prefixed_View) and then not XASIS.Utils.Is_Entry_Family (Item.Declaration)) or (Item.Kind = A_Family_Member and then XASIS.Utils.Is_Entry_Family (Item.Declaration)) then declare List : constant Asis.Defining_Name_List := Names (Item.Declaration); begin if (List'Length > 0 and then Are_Type_Conformant (Name, List (1), Place, Right_Is_Prefixed_View => Item.Kind = A_Prefixed_View)) or else (Empty and then Get_Profile (Item.Declaration)'Length = 0) then Index := L.Next (Index); else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end; else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end loop; Set.Index := 0; end Constrain_To_Expected_Profile; ----------------------- -- Constrain_To_Type -- ----------------------- procedure Constrain_To_Type (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element; Tipe : in Type_Info) is Item : Up_Interpretation; Index : L.Cursor; begin Expand_Expression (Set, Impl, Element); Index := L.First (Set.Items.all); while L.Has_Element (Index) loop Item := L.Element (Index); if Has_Type (Item, Tipe) then Index := L.Next (Index); else L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; end if; end loop; Set.Index := 0; end Constrain_To_Type; ------------ -- Create -- ------------ function Create return Implicit_Set is begin return new Implicit_Nodes.List; end Create; ------------ -- Create -- ------------ function Create return Up_Interpretation_Set is begin return (new L.List, 0, 0, L.No_Element); end Create; ------------ -- Create -- ------------ function Create return Stored_Set is begin return new Stored_Set_Node; end Create; ------------ -- Create -- ------------ function Create return Stored_Sets is begin return new S.List; end Create; ----------------- -- Dereference -- ----------------- function Dereference (Tipe : Type_Info) return Up_Interpretation is begin if Is_Subprogram_Access (Tipe) then return (A_Subprogram_Reference, Tipe); elsif Is_Object_Access (Tipe) then return Up_Expression (Destination_Type (Tipe)); else raise Internal_Error; end if; end Dereference; ------------- -- Destroy -- ------------- procedure Destroy (Set : in out Implicit_Set) is use Implicit_Nodes; procedure Free is new Ada.Unchecked_Deallocation (List, Implicit_Set); begin Clear (Set.all); Free (Set); end Destroy; ------------- -- Destroy -- ------------- procedure Destroy (Set : in out Up_Interpretation_Set) is procedure Free is new Ada.Unchecked_Deallocation (L.List, L_List_Access); begin L.Clear (Set.Items.all); Free (Set.Items); end Destroy; ------------- -- Destroy -- ------------- procedure Destroy (Set : in out Stored_Set) is procedure Free is new Ada.Unchecked_Deallocation (Stored_Set_Node, Stored_Set); procedure Free is new Ada.Unchecked_Deallocation (Type_Infos, Type_Infos_Access); Stored : Stored_Interpretation; begin for I in 1 .. Length (Set) loop Get (Set, I, Stored); if Stored.Real_Types /= null then Free (Stored.Real_Types); end if; end loop; R.Clear (Set.List); Free (Set); end Destroy; ------------- -- Destroy -- ------------- procedure Destroy (Set : in out Stored_Sets) is procedure Free is new Ada.Unchecked_Deallocation (S.List, Stored_Sets); begin S.Clear (Set.all); Free (Set); end Destroy; --------------------- -- Expand_Implicit -- --------------------- procedure Expand_Implicit (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element; Dereference : in Boolean; Force : in Boolean := False) is use Asis.Elements; use Asis.Expressions; procedure Add_Expr (Tipe : Type_Info; Old : Boolean := False; Call : Boolean := False; Down : Up_Interpretation := (Kind => A_Skip)) is begin if Dereference and then Is_Object_Access (Tipe) then declare Dest : constant Type_Info := Destination_Type (Tipe); Node : Implicit_Node; begin Add (Set, Up_Expression (Dest)); Node.Key := Element; if Call then Node.Down := Down; else Node.Down := Up_Expression (Tipe); end if; Node.Return_Type := Dest; Node.Is_Call := Call; Implicit_Nodes.Append (Impl.all, Node); if Force then return; end if; end; end if; if not Old then Add (Set, Up_Expression (Tipe)); if Call then declare Node : Implicit_Node; begin Node.Key := Element; Node.Down := Down; Node.Return_Type := Tipe; Node.Is_Call := True; Implicit_Nodes.Append (Impl.all, Node); end; end if; end if; end Add_Expr; procedure Add_Decl (Decl : in Asis.Declaration; Keep : out Boolean) is Subtipe : Asis.Definition; Tipe : Type_Info := Type_Of_Declaration (Decl, Element); begin if not Is_Not_Type (Tipe) then Add_Expr (Tipe); Keep := False; elsif Parameterless (Decl) then Subtipe := Get_Result_Subtype (Decl); if not Assigned (Subtipe) then -- Parameterless procedure Keep := True; else Tipe := Type_From_Indication (Subtipe, Element); Add_Expr (Tipe, Call => True, Down => (A_Declaration, Decl)); if Force then Keep := False; else Keep := True; end if; end if; else Keep := True; end if; end Add_Decl; Index : L.Cursor := L.First (Set.Items.all); Count : Positive := 1; Last : Natural := Length (Set); Item : Up_Interpretation; Keep : Boolean; begin while Count <= Last loop Item := L.Element (Index); if Item.Kind = An_Identifier then L.Delete (Set.Items.all, Index); Last := Last - 1; Set.Length := Set.Length - 1; declare Decl : Asis.Declaration; List : constant Asis.Defining_Name_List := Corresponding_Name_Definition_List (Item.Identifier); begin for I in List'Range loop Decl := Enclosing_Element (List (I)); Add_Decl (Decl, Keep); if Keep then Add (Set, (A_Declaration, Decl)); end if; end loop; end; elsif Item.Kind = A_Declaration then Add_Decl (Item.Declaration, Keep); if Keep then Index := L.Next (Index); Count := Count + 1; else L.Delete (Set.Items.all, Index); Last := Last - 1; Set.Length := Set.Length - 1; end if; elsif Item.Kind = An_Expression then Add_Expr (Item.Expression_Type, Old => True); Index := L.Next (Index); Count := Count + 1; elsif Item.Kind = A_Subprogram_Reference or Item.Kind = A_Prefixed_View then if Is_Empty_Profile (Get_Profile (Item)) then declare Result : constant Up_Interpretation := Get_Result_Profile (Item, Element); begin if Result.Kind = An_Expression then Add_Expr (Result.Expression_Type, Call => True, Down => Item); end if; end; end if; Index := L.Next (Index); Count := Count + 1; else Index := L.Next (Index); Count := Count + 1; end if; end loop; Set.Index := 0; end Expand_Implicit; ------------------- -- Expand_Prefix -- ------------------- procedure Expand_Prefix (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) is begin Expand_Implicit (Set, Impl, Element, True); end Expand_Prefix; -------------------------- -- Expand_Function_Call -- -------------------------- procedure Expand_Expression (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element) is begin Expand_Implicit (Set, Impl, Element, False); end Expand_Expression; ----------------------------- -- Expand_Attribute_Prefix -- ----------------------------- procedure Expand_Attribute_Prefix (Set : in out Up_Interpretation_Set; Impl : in out Implicit_Set; Element : in Asis.Element; Dereference : in Boolean := True) is begin Expand_Implicit (Set, Impl, Element, Dereference, True); end Expand_Attribute_Prefix; --------- -- Get -- --------- procedure Get (Set : in out Up_Interpretation_Set; Index : in Positive; Item : out Up_Interpretation) is begin if Index not in 1 .. Set.Length then raise Constraint_Error; elsif Set.Index = 0 then Set.Index := 1; Set.Pos := L.First (Set.Items.all); end if; loop if Set.Index = Index then Item := L.Element (Set.Pos); return; elsif Set.Index = Set.Length then Set.Index := 1; Set.Pos := L.First (Set.Items.all); else Set.Index := Set.Index + 1; Set.Pos := L.Next (Set.Pos); end if; end loop; end Get; --------- -- Get -- --------- procedure Get (Set : in out Stored_Set; Index : in Positive; Item : out Stored_Interpretation) is begin if Index not in 1 .. Set.Length then raise Constraint_Error; elsif Set.Index = 0 then Set.Index := 1; Set.Pos := R.First (Set.List); end if; loop if Set.Index = Index then Item := R.Element (Set.Pos); return; elsif Set.Index = Set.Length then Set.Index := 1; Set.Pos := R.First (Set.List); else Set.Index := Set.Index + 1; Set.Pos := R.Next (Set.Pos); end if; end loop; end Get; --------- -- Get -- --------- procedure Get (Set : in Stored_Sets; Key : in Asis.Element; Item : out Stored_Set) is Next : aliased Stored_Set; begin Item := null; while S.Iterate (Set.all, Next'Access) loop if Asis.Elements.Is_Equal (Next.Key, Key) then if Item = null then S.Delete_First (Set.all, Item); else S.Delete_Next (Set.all, Item, Next); end if; Item := Next; return; end if; Item := Next; end loop; raise Internal_Error; end Get; -------------- -- Get_Next -- -------------- function Get_Next (Left : Stored_Set) return Stored_Set is begin return Left.Next; end Get_Next; ------------------------ -- Get_Parameter_Type -- ------------------------ function Get_Parameter_Type (Name : Up_Interpretation; Profile : Asis.Parameter_Specification_List; Index : List_Index; Place : Asis.Element) return Classes.Type_Info is Tipe : Classes.Type_Info; begin if XASIS.Utils.Is_Parameter_Specification (Profile (Index)) then Tipe := Type_Of_Declaration (Profile (Index), Place); else Tipe := Type_From_Declaration (Profile (Index), Place); if Name.Kind = An_Attribute_Function and then (Name.Attr_Kind = A_Read_Attribute or Name.Attr_Kind = A_Write_Attribute or Name.Attr_Kind = An_Input_Attribute or Name.Attr_Kind = An_Output_Attribute) then if Index = 1 then Set_Class_Wide (Tipe); Set_Access (Tipe, True); elsif Name.Class_Wide then Set_Class_Wide (Tipe); end if; end if; end if; return Tipe; end Get_Parameter_Type; ----------------- -- Get_Profile -- ----------------- function Get_Profile (Name : Up_Interpretation) return Asis.Parameter_Specification_List is use Asis.Definitions; use Asis.Declarations; begin case Name.Kind is when A_Declaration | A_Family_Member => return XASIS.Utils.Get_Profile (Name.Declaration); when An_Expression => if Is_Subprogram_Access (Name.Expression_Type) then return Subprogram_Parameters (Name.Expression_Type); else raise Internal_Error; end if; when A_Subprogram_Reference => if Is_Subprogram_Access (Name.Access_Type) then return Subprogram_Parameters (Name.Access_Type); else raise Internal_Error; end if; when An_Attribute_Function => return Attr.Get_Profile (Name.Prefix, Name.Attr_Kind); when A_Prefixed_View => declare List : constant Asis.Parameter_Specification_List := XASIS.Utils.Get_Profile (Name.Declaration); Result : constant Asis.Parameter_Specification_List (1 .. List'Length - 1) := List (2 .. List'Last); begin if Names (List (1))'Length > 1 then raise Unimplemented; end if; return Result; end; when others => raise Internal_Error; end case; end Get_Profile; ------------------------ -- Get_Result_Profile -- ------------------------ function Get_Result_Profile (Name : Up_Interpretation; Place : Asis.Element) return Up_Interpretation is use Asis.Elements; use Asis.Definitions; use Asis.Declarations; Result : Up_Interpretation; begin case Name.Kind is when A_Declaration | A_Prefixed_View => case Declaration_Kind (Name.Declaration) is when A_Function_Declaration | A_Function_Body_Declaration | A_Function_Renaming_Declaration | A_Function_Body_Stub | A_Function_Instantiation | A_Formal_Function_Declaration => Result := Up_Expression ( Type_From_Indication ( Get_Result_Subtype (Name.Declaration), Place)); when A_Procedure_Declaration | A_Procedure_Body_Declaration | A_Procedure_Renaming_Declaration | An_Entry_Declaration | A_Procedure_Body_Stub | A_Procedure_Instantiation | A_Formal_Procedure_Declaration => Result := (Kind => A_Procedure_Call); when others => raise Internal_Error; end case; when A_Family_Member => Result := (Kind => A_Procedure_Call); when An_Expression => if Is_Procedure_Access (Name.Expression_Type) then Result := (Kind => A_Procedure_Call); elsif Is_Function_Access (Name.Expression_Type) then Result := Up_Expression ( Function_Result_Type (Name.Expression_Type)); else raise Internal_Error; end if; when A_Subprogram_Reference => if Is_Procedure_Access (Name.Access_Type) then Result := (Kind => A_Procedure_Call); elsif Is_Function_Access (Name.Access_Type) then Result := Up_Expression ( Function_Result_Type (Name.Access_Type)); else raise Internal_Error; end if; when An_Attribute_Function => return Attr.Get_Result_Profile (Name.Prefix, Name.Attr_Kind, Name.Class_Wide, Place); when others => raise Internal_Error; end case; return Result; end Get_Result_Profile; -------------- -- Get_Type -- -------------- function Get_Type (Set : Up_Interpretation_Set; Mark : Type_Info) return Up_Interpretation is Item : Up_Interpretation; Index : L.Cursor := L.First (Set.Items.all); begin while L.Has_Element (Index) loop Item := L.Element (Index); if Has_Type (Item, Mark) then return Item; end if; Index := L.Next (Index); end loop; raise Internal_Error; end Get_Type; ------------------------ -- Has_Interpretation -- ------------------------ function Has_Interpretation (Set : Up_Interpretation_Set; Item : Asis.Element) return Boolean is use Asis.Gela.Errors; begin if Length (Set) = 0 then Report (Item, Error_No_Interprentation); return False; elsif Length (Set) > 1 then Report (Item, Error_Ambiguous_Interprentation); end if; return True; end Has_Interpretation; -------------- -- Has_Type -- -------------- function Has_Type (Item : Up_Interpretation; Mark : Type_Info) return Boolean is begin case Item.Kind is when An_Expression => if Is_Expected_Type (Item.Expression_Type, Mark) then return True; end if; when A_String_Type => if Is_String (Mark) then return True; end if; when A_General_Access => if Is_General_Access (Mark) then return True; end if; when A_Subprogram_Access => if Is_Subprogram_Access (Mark) and then Conform_Access_Type (Item.Profile, Mark) then return True; end if; when An_Array_Aggregate => if Is_Array (Mark) then return True; end if; when A_Record_Aggregate => if not Is_Limited (Mark) and then (Is_Untagged_Record (Mark) or else Is_Tagged (Mark)) then return True; end if; when An_Extension_Aggregate => if not Is_Limited (Mark) and then Is_Tagged (Mark) then return True; end if; when A_Boolean => if Is_Boolean (Mark) then return True; end if; when An_Object_Access => if Is_Object_Access (Mark) and then Is_Covered (Item.Object_Type, Destination_Type (Mark)) then return True; end if; when others => null; end case; return False; end Has_Type; -------------- -- Has_Type -- -------------- function Has_Type (Set : Up_Interpretation_Set; Mark : Type_Info) return Boolean is Item : Up_Interpretation; Index : L.Cursor := L.First (Set.Items.all); begin while L.Has_Element (Index) loop Item := L.Element (Index); if Has_Type (Item, Mark) then return True; end if; Index := L.Next (Index); end loop; return False; end Has_Type; ----------- -- Image -- ----------- function Image (Set : Up_Interpretation_Set) return Wide_String is use type W.Unbounded_Wide_String; Result : Unbounded_Wide_String; Index : L.Cursor := L.First (Set.Items.all); New_Line : constant Wide_String := (1 => Wide_Character'Val (10)); begin for I in 1 .. Length (Set) loop if I /= 1 then Result := Result & New_Line; end if; Result := Result & Positive'Wide_Image (I) & " " & Image (L.Element (Index)); Index := L.Next (Index); end loop; return W.To_Wide_String (Result); end Image; ----------- -- Image -- ----------- function Image (Object : Interpretation) return Wide_String is -- use Asis.Elements; Kind : constant Wide_String := Interpretation_Kinds'Wide_Image (Object.Kind) & " "; begin case Object.Kind is when An_Expression => return Kind & Debug_Image (Object.Expression_Type); when An_Identifier => return Kind & Debug_Image (Object.Identifier); when A_Declaration | A_Family_Member => return Kind & Debug_Image (Object.Declaration); when A_Subprogram_Access => return Kind & Debug_Image (Object.Profile); when An_Object_Access => return Kind & Debug_Image (Object.Object_Type); when A_Subprogram_Reference => return Kind & Debug_Image (Object.Access_Type); when A_Range => return Kind & Debug_Image (Object.Range_Type); when A_Type => return Kind & Debug_Image (Object.Type_Info); when A_Subaggregate => return Kind & Debug_Image (Object.Array_Type) & Asis.List_Index'Wide_Image (Object.Deep); when An_Attribute_Function => return Kind & Debug_Image (Object.Prefix) & " " & Asis.Attribute_Kinds'Wide_Image (Object.Attr_Kind); when others => return Kind; end case; end Image; --------------------------- -- Is_Tagged_Non_Limited -- --------------------------- function Is_Tagged_Non_Limited (Info : Type_Info) return Boolean is begin return Is_Tagged (Info) and then not Is_Limited (info); end Is_Tagged_Non_Limited; ------------ -- Length -- ------------ function Length (Set : Up_Interpretation_Set) return Natural is begin return Set.Length; end Length; ------------ -- Length -- ------------ function Length (Set : Stored_Set) return Natural is begin return Set.Length; end Length; --------- -- Put -- --------- procedure Put (Set : in out Stored_Sets; Key : in Asis.Element; Item : in Stored_Set) is begin Item.Key := Key; S.Prepend (Set.all, Item); end Put; ------------------------ -- Resolve_Identifier -- ------------------------ procedure Resolve_Identifier (Set : in out Up_Interpretation_Set) is use Asis.Elements; use Asis.Expressions; Index : L.Cursor := L.First (Set.Items.all); Item : Up_Interpretation; begin while L.Has_Element (Index) loop Item := L.Element (Index); if Item.Kind = An_Identifier then L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; declare List : constant Asis.Defining_Name_List := Corresponding_Name_Definition_List (Item.Identifier); begin for I in List'Range loop Add (Set, (A_Declaration, Enclosing_Element (List (I)))); end loop; end; else Index := L.Next (Index); end if; end loop; Set.Index := 0; end Resolve_Identifier; --------------------- -- Select_Prefered -- --------------------- procedure Select_Prefered (Set : in out Up_Interpretation_Set) is Has_Root_Int : Boolean := False; Has_Root_Real : Boolean := False; Decl : Asis.Declaration; Index : L.Cursor := L.First (Set.Items.all); Item : Up_Interpretation; Tipe : Type_Info; begin while L.Has_Element (Index) loop Item := L.Element (Index); if Item.Kind = An_Expression or Item.Kind = A_Range then if Item.Kind = An_Expression then Tipe := Item.Expression_Type; else Tipe := Item.Range_Type; end if; Decl := Get_Declaration (Tipe); if Is_Equal (Decl, XASIS.Types.Root_Integer) then Has_Root_Int := True; elsif Is_Equal (Decl, XASIS.Types.Root_Real) then Has_Root_Real := True; end if; end if; Index := L.Next (Index); end loop; if not Has_Root_Int and not Has_Root_Real then return; end if; Index := L.First (Set.Items.all); while L.Has_Element (Index) loop Item := L.Element (Index); if Item.Kind = An_Expression or Item.Kind = A_Range then if Item.Kind = An_Expression then Tipe := Item.Expression_Type; else Tipe := Item.Range_Type; end if; Decl := Get_Declaration (Tipe); if Is_Equal (Decl, XASIS.Types.Root_Integer) then Index := L.Next (Index); elsif Has_Root_Int and then Is_Integer (Tipe) then L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; elsif Is_Equal (Decl, XASIS.Types.Root_Real) then Index := L.Next (Index); elsif Has_Root_Real and then Is_Real (Tipe) then L.Delete (Set.Items.all, Index); Set.Length := Set.Length - 1; else Index := L.Next (Index); end if; else Index := L.Next (Index); end if; end loop; Set.Index := 0; end Select_Prefered; -------------- -- Set_Next -- -------------- procedure Set_Next (Left, Next : Stored_Set) is begin Left.Next := Next; end Set_Next; ---------------------------- -- To_Down_Interpretation -- ---------------------------- function To_Down_Interpretation (Item : Up_Interpretation) return Down_Interpretation is begin if Item.Kind in Up_Only_Kinds then raise Internal_Error; end if; return Down_Interpretation (Item); end To_Down_Interpretation; ------------------- -- Up_Expression -- ------------------- function Up_Expression (Expression_Type : Asis.Element; Place : Asis.Element) return Up_Interpretation is use Asis.Elements; Tipe : Type_Info; begin case Element_Kind (Expression_Type) is when A_Declaration => case Declaration_Kind (Expression_Type) is when An_Ordinary_Type_Declaration | A_Private_Type_Declaration | A_Formal_Type_Declaration | A_Subtype_Declaration => Tipe := Type_From_Declaration (Expression_Type, Place); when others => raise Unimplemented; end case; when A_Definition => case Definition_Kind (Expression_Type) is when A_Type_Definition | A_Subtype_Indication | A_Discrete_Subtype_Definition => Tipe := Type_From_Indication (Expression_Type, Place); when others => raise Unimplemented; end case; when An_Expression => case Expression_Kind (Expression_Type) is when An_Identifier | A_Selected_Component | An_Attribute_Reference => Tipe := Type_From_Subtype_Mark (Expression_Type, Place); when others => raise Unimplemented; end case; when others => raise Unimplemented; end case; return (An_Expression, Tipe); end Up_Expression; ------------------- -- Up_Expression -- ------------------- function Up_Expression (Info : Type_Info) return Up_Interpretation is begin return (An_Expression, Info); end Up_Expression; end Asis.Gela.Overloads.Types; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the <NAME>, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd3015e.ada
best08618/asylo
7
24381
<reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd3015e.ada<gh_stars>1-10 -- CD3015E.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT WHEN THERE IS NO ENUMERATION CLAUSE FOR THE PARENT -- TYPE IN A GENERIC UNIT, THE DERIVED TYPE CAN BE USED CORRECTLY -- IN ORDERING RELATIONS, INDEXING ARRAYS, AND IN GENERIC -- INSTANTIATIONS. -- HISTORY -- DHH 10/05/87 CREATED ORIGINAL TEST -- DHH 03/30/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA' AND ADDED -- CHECK FOR REPRESENTATION CLAUSE. -- RJW 03/20/90 MODIFIED CHECK FOR ARRAY INDEXING. -- THS 09/18/90 REVISED WORDING ON FAILURE ERROR MESSAGE. WITH REPORT; USE REPORT; WITH ENUM_CHECK; -- CONTAINS A CALL TO 'FAILED'. PROCEDURE CD3015E IS BEGIN TEST ("CD3015E", "CHECK THAT WHEN THERE " & "IS NO ENUMERATION CLAUSE FOR THE PARENT " & "TYPE IN A GENERIC UNIT, THE " & "DERIVED TYPE CAN BE USED CORRECTLY IN " & "ORDERING RELATIONS, INDEXING ARRAYS, AND IN " & "GENERIC INSTANTIATIONS"); DECLARE GENERIC PACKAGE GENPACK IS TYPE MAIN IS (RED,BLUE,YELLOW,'R','B','Y'); TYPE HUE IS NEW MAIN; FOR HUE USE (RED => 1, BLUE => 6, YELLOW => 11, 'R' => 16, 'B' => 22, 'Y' => 30); TYPE BASE IS ARRAY(HUE) OF INTEGER; COLOR,BASIC : HUE; BARRAY : BASE; T : INTEGER := 1; TYPE INT1 IS RANGE 1 .. 30; FOR INT1'SIZE USE HUE'SIZE; PROCEDURE CHECK_1 IS NEW ENUM_CHECK(HUE, INT1); GENERIC TYPE ENUM IS (<>); PROCEDURE CHANGE(X,Y : IN OUT ENUM); END GENPACK; PACKAGE BODY GENPACK IS PROCEDURE CHANGE(X,Y : IN OUT ENUM) IS T : ENUM; BEGIN T := X; X := Y; Y := T; END CHANGE; PROCEDURE PROC IS NEW CHANGE(HUE); BEGIN BASIC := RED; COLOR := HUE'SUCC(BASIC); IF (COLOR < BASIC OR BASIC >= 'R' OR 'Y' <= COLOR OR COLOR > 'B') THEN FAILED("ORDERING RELATIONS ARE INCORRECT"); END IF; PROC(BASIC,COLOR); IF COLOR /= RED THEN FAILED("VALUES OF PARAMETERS TO INSTANCE OF " & "GENERIC UNIT NOT CORRECT AFTER CALL"); END IF; FOR I IN HUE LOOP BARRAY(I) := IDENT_INT(T); T := T + 1; END LOOP; IF (BARRAY (RED) /= 1 OR BARRAY (BLUE) /= 2 OR BARRAY (YELLOW) /= 3 OR BARRAY ('R') /= 4 OR BARRAY ('B') /= 5 OR BARRAY ('Y') /= 6) THEN FAILED("INDEXING ARRAY FAILURE"); END IF; CHECK_1 (YELLOW, 11, "HUE"); END GENPACK; PACKAGE P IS NEW GENPACK; BEGIN NULL; END; RESULT; END CD3015E;
libsrc/oz/ozmisc/ozquiet.asm
grancier/z180
0
5071
<gh_stars>0 ; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by <NAME> ; by <NAME> - Oct. 2003 ; ; ; void ozquiet() ; ; ------ ; $Id: ozquiet.asm,v 1.3 2016/06/28 14:48:17 dom Exp $ ; SECTION code_clib PUBLIC ozquiet PUBLIC _ozquiet EXTERN ozclick EXTERN ozclick_setting ozquiet: _ozquiet: xor a out (16h),a ; turn off note ld a,(ozclick_setting) or a ret z ld hl,1 push hl call ozclick pop hl ret
Task/Abundant,-deficient-and-perfect-number-classifications/Ada/abundant,-deficient-and-perfect-number-classifications.ada
LaudateCorpus1/RosettaCodeData
1
4200
<filename>Task/Abundant,-deficient-and-perfect-number-classifications/Ada/abundant,-deficient-and-perfect-number-classifications.ada with Ada.Text_IO, Generic_Divisors; procedure ADB_Classification is function Same(P: Positive) return Positive is (P); package Divisor_Sum is new Generic_Divisors (Result_Type => Natural, None => 0, One => Same, Add => "+"); type Class_Type is (Deficient, Perfect, Abundant); function Class(D_Sum, N: Natural) return Class_Type is (if D_Sum < N then Deficient elsif D_Sum = N then Perfect else Abundant); Cls: Class_Type; Results: array (Class_Type) of Natural := (others => 0); package NIO is new Ada.Text_IO.Integer_IO(Natural); package CIO is new Ada.Text_IO.Enumeration_IO(Class_Type); begin for N in 1 .. 20_000 loop Cls := Class(Divisor_Sum.Process(N), N); Results(Cls) := Results(Cls)+1; end loop; for Class in Results'Range loop CIO.Put(Class, 12); NIO.Put(Results(Class), 8); Ada.Text_IO.New_Line; end loop; Ada.Text_IO.Put_Line("--------------------"); Ada.Text_IO.Put("Sum "); NIO.Put(Results(Deficient)+Results(Perfect)+Results(Abundant), 8); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line("===================="); end ADB_Classification;
programs/oeis/112/A112532.asm
jmorken/loda
1
24048
<reponame>jmorken/loda<filename>programs/oeis/112/A112532.asm ; A112532: First differences of [0, A047970]. ; 1,1,3,9,29,101,379,1525,6549,29889,144419,736241,3947725,22201549,130624587,802180701,5131183301,34121977865,235486915507,1683925343929,12458499203901,95237603403381,751291094637083,6108883628141189 mov $12,$0 mov $14,2 lpb $14 mov $0,$12 sub $14,1 add $0,$14 sub $0,1 mov $8,$0 mov $10,2 lpb $10 clr $0,8 mov $0,$8 sub $10,1 add $0,$10 mov $1,1 lpb $0 mov $3,$1 add $1,1 pow $3,$0 sub $0,1 add $5,$3 lpe mov $1,$5 mov $11,$10 lpb $11 mov $9,$1 sub $11,1 lpe lpe lpb $8 mov $8,0 sub $9,$1 lpe mov $1,$9 mov $15,$14 lpb $15 mov $13,$1 sub $15,1 lpe lpe lpb $12 mov $12,0 sub $13,$1 lpe mov $1,$13
src/haip_controller/Debug/IOX.dxe.asm
Maracars/haip_controller
0
245046
<gh_stars>0 .section/data .executable_name; .global __executable_name; .BYTE __executable_name[] = 'IOX.dxe', 0;
programs/oeis/120/A120159.asm
neoneye/loda
22
82204
; A120159: a(1)=15; a(n)=floor((47+sum(a(1) to a(n-1)))/3). ; 15,20,27,36,48,64,85,114,152,202,270,360,480,640,853,1137,1516,2022,2696,3594,4792,6390,8520,11360,15146,20195,26927,35902,47870,63826,85102,113469,151292,201723,268964,358618,478158,637544,850058,1133411 mov $1,2 lpb $0 sub $0,1 add $1,1 mul $1,4 add $1,41 div $1,3 lpe div $1,3 add $1,15 mov $0,$1
programs/oeis/199/A199972.asm
karttu/loda
0
6822
<gh_stars>0 ; A199972: a(n) = the sum of GCQ_B(n, k) for 1 <= k <= n (see definition in comments). ; 0,0,4,9,19,29,41,55,71,89,109,131,155,181,209,239,271,305,341,379,419,461,505,551,599,649,701,755,811,869,929,991,1055,1121,1189,1259,1331,1405,1481,1559,1639,1721,1805,1891,1979,2069 mov $2,$0 mov $4,$0 lpb $2,1 lpb $4,1 add $3,$2 mov $4,1 lpe mov $1,$3 add $3,$2 sub $2,1 mov $4,$1 sub $4,2 lpe
oeis/005/A005431.asm
neoneye/loda-programs
11
95476
<reponame>neoneye/loda-programs ; A005431: Embeddings of n-bouquet in sphere. ; Submitted by <NAME> ; 1,1,4,40,672,16128,506880,19768320,922521600,50185175040,3120605429760,218442380083200,17004899126476800,1457562782269440000,136427876420419584000,13847429456672587776000,1515071693494765486080000,177768412036719150366720000,22267832665652188309094400000,2966075311064871482771374080000,418640343904584717854016798720000,62415469454865357934598868172800000,9801942420477116211294396166963200000,1617320499378724174863575367548928000000,279731753572544133284403995571262586880000 mov $1,$0 seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). sub $1,1 lpb $1 mul $0,$1 mul $0,2 sub $1,1 lpe
oeis/060/A060882.asm
neoneye/loda-programs
11
26244
; A060882: a(n) = n-th primorial (A002110) minus next prime. ; Submitted by <NAME> ; -1,-1,1,23,199,2297,30013,510491,9699667,223092841,6469693199,200560490093,7420738134769,304250263527167,13082761331669983,614889782588491357,32589158477190044671,1922760350154212639009,117288381359406970983203,7858321551080267055879019,557940830126698960967415317,40729680599249024150621323391,3217644767340672907899084554047,267064515689275851355624017992701,23768741896345550770650537601358213,2305567963945518424753102147331755969,232862364358497360900063316880507362967 mov $1,2 mov $6,$0 cmp $6,0 add $0,$6 mov $2,2 lpb $0 mov $3,$2 mov $5,$1 lpb $3 add $2,1 mov $4,$1 gcd $4,$2 cmp $4,1 cmp $4,0 sub $3,$4 lpe sub $0,1 add $2,1 mul $1,$2 lpe sub $5,$2 mov $0,$5
oeis/052/A052982.asm
neoneye/loda-programs
11
12759
; A052982: Expansion of ( 1-x ) / ( 1-2*x-2*x^2+x^4 ). ; Submitted by <NAME> ; 1,1,4,10,27,73,196,528,1421,3825,10296,27714,74599,200801,540504,1454896,3916201,10541393,28374684,76377258,205587683,553388489,1489577660,4009555040,10792677717,29051077025,78197931824,210488462658,566580111247,1525086070785 mov $1,1 mov $4,-1 lpb $0 sub $0,1 add $2,$1 add $4,1 add $3,$4 add $1,$3 add $4,$2 add $3,$4 sub $4,$3 sub $2,$4 add $3,$2 add $3,$4 lpe mov $0,$1
src/kafka-topic.ads
Latence-Technologies/Kafka-Ada
0
16125
<filename>src/kafka-topic.ads -- -- Provides kafka functionality to interact with Topics -- package Kafka.Topic is -- -- Creates a handle for a given topic. Does not perform the admin command -- to create a topic -- -- librdkafka equivalent: rd_kafka_topic_new -- function Create_Topic_Handle(Handle : Handle_Type; Topic : String; Config : Topic_Config_Type) return Topic_Type; -- -- Creates a handle for a given topic. Does not perform the admin command -- to create a topic -- -- librdkafka equivalent: rd_kafka_topic_new -- function Create_Topic_Handle(Handle : Handle_Type; Topic : String) return Topic_Type; -- -- Destroys the specified topic handle -- -- librdkafka equivalent: rd_kafka_topic_destroy -- procedure Destroy_Topic_Handle(Topic : Topic_Type) with Import => True, Convention => C, External_Name => "rd_kafka_topic_destroy"; -- -- Returns the name of a given topic -- -- librdkafka equivalent: rd_kafka_topic_name -- function Get_Name(Topic : Topic_Type) return String; -- -- Returns the opaque for a given topic -- -- librdkafka equivalent: rd_kafka_topic_opaque -- function Get_Opaque(Topic : Topic_Type) return System.Address with Import => True, Convention => C, External_Name => "rd_kafka_topic_opaque"; private function rd_kafka_topic_new(Handle : Handle_Type; Topic : chars_ptr; Config : Topic_Config_Type) return Topic_Type with Import => True, Convention => C, External_Name => "rd_kafka_topic_new"; function rd_kafka_topic_name(Topic : Topic_Type) return chars_ptr with Import => True, Convention => C, External_Name => "rd_kafka_topic_name"; end Kafka.Topic;
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sccz80/fma.asm
Frodevan/z88dk
0
171815
<filename>libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sccz80/fma.asm SECTION code_fp_math16 PUBLIC f16_fma EXTERN cm16_sccz80_fma defc f16_fma = cm16_sccz80_fma ; SDCC bridge for Classic IF __CLASSIC PUBLIC _f16_fma EXTERN cm16_sdcc_fma defc _f16_fma = cm16_sdcc_fma ENDIF
alloy4fun_models/trainstlt/models/4/sPq6DgQx9fyFExid8.als
Kaixi26/org.alloytools.alloy
0
745
<reponame>Kaixi26/org.alloytools.alloy open main pred idsPq6DgQx9fyFExid8_prop5 { } pred __repair { idsPq6DgQx9fyFExid8_prop5 } check __repair { idsPq6DgQx9fyFExid8_prop5 <=> prop5o }
oeis/021/A021233.asm
neoneye/loda-programs
11
245057
<filename>oeis/021/A021233.asm ; A021233: Decimal expansion of 1/229. ; Submitted by Jon Maiga ; 0,0,4,3,6,6,8,1,2,2,2,7,0,7,4,2,3,5,8,0,7,8,6,0,2,6,2,0,0,8,7,3,3,6,2,4,4,5,4,1,4,8,4,7,1,6,1,5,7,2,0,5,2,4,0,1,7,4,6,7,2,4,8,9,0,8,2,9,6,9,4,3,2,3,1,4,4,1,0,4,8,0,3,4,9,3,4,4,9,7,8,1,6,5,9,3,8,8,6 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 div $2,23 mul $3,10 lpe mov $0,$2 mod $0,10
oeis/066/A066066.asm
neoneye/loda-programs
11
98882
<filename>oeis/066/A066066.asm ; A066066: a(n) = prime(2*n) - 2*prime(n). ; Submitted by <NAME>(s2) ; -1,1,3,5,7,11,9,15,15,13,17,15,19,21,19,25,21,29,29,31,35,35,33,45,35,37,45,49,53,55,39,49,43,59,51,57,59,57,63,63,63,71,61,71,69,81,69,57,67,83,91,91,95,91,87,87,81,99,93,97,107,97,87,97,107,109,95,95,93,111,115,109,105,111,105,115,109,117,127,123,115,129,121,131,135,135,135,135,139,143,157,139,135,141,153,157,163,151,167,141 mov $1,$0 seq $0,40 ; The prime numbers. mul $0,2 mul $1,2 add $1,1 seq $1,40 ; The prime numbers. sub $1,$0 mov $0,$1
unittests/ASM/X87_F64/D9_05_F64.asm
Seas0/FEX
0
95036
%ifdef CONFIG { "Env": { "FEX_X87REDUCEDPRECISION" : "1" } } %endif mov rdx, 0xe0000000 ; Just to ensure execution fldcw [rdx] hlt
oeis/209/A209084.asm
neoneye/loda-programs
11
173240
<reponame>neoneye/loda-programs ; A209084: a(n) = 2*a(n-1) + 4*a(n-2) with n>1, a(0)=0, a(1)=4. ; Submitted by <NAME>(s2) ; 0,4,8,32,96,320,1024,3328,10752,34816,112640,364544,1179648,3817472,12353536,39976960,129368064,418643968,1354760192,4384096256,14187233280,45910851584,148570636288,480784678912,1555851902976,5034842521600,16293092655104,52725555396608,170623481413632,552149184413696,1786792294481920,5782181326618624,18711531831164928,60551788968804352,195949705262268416,634106566399754240,2052011953848582144,6640450173296181248,21488948161986691072,69539697017158107136,225035186682262978560 mov $1,2 pow $1,$0 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. mul $1,2 mul $0,$1
libtool/src/gmp-6.1.2/mpn/alpha/sqr_diag_addlsh1.asm
kroggen/aergo
1,602
27689
dnl Alpha mpn_sqr_diag_addlsh1. dnl Copyright 2013 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C EV4: ? C EV5: 10.2 C EV6: 4.5 C Ideally, one-way code could run at 9 c/l (limited by mulq+umulh) on ev5 and C about 3.75 c/l on ev6. Two-way code could run at about 3.25 c/l on ev6. C Algorithm: We allow ourselves to propagate carry to a product high word C without worrying for carry out, since (B-1)^2 = B^2-2B+1 has a high word of C B-2, i.e, will not spill. We propagate carry similarly to a product low word C since the problem value B-1 is a quadratic non-residue mod B, but our C products are squares. define(`rp', `r16') define(`tp', `r17') define(`up', `r18') define(`n', `r19') ASM_START() PROLOGUE(mpn_sqr_diag_addlsh1) ldq r0, 0(up) bis r31, r31, r21 bis r31, r31, r3 mulq r0, r0, r7 stq r7, 0(rp) umulh r0, r0, r6 lda n, -1(n) ALIGN(16) L(top): ldq r0, 8(up) lda up, 8(up) ldq r8, 0(tp) ldq r20, 8(tp) mulq r0, r0, r7 lda tp, 16(tp) sll r8, 1, r23 srl r8, 63, r22 or r21, r23, r23 sll r20, 1, r24 addq r3, r6, r6 C cannot carry per comment above or r22, r24, r24 addq r23, r6, r21 umulh r0, r0, r6 cmpult r21, r23, r1 addq r1, r7, r7 C cannot carry per comment above stq r21, 8(rp) addq r24, r7, r22 stq r22, 16(rp) lda n, -1(n) cmpult r22, r7, r3 srl r20, 63, r21 lda rp, 16(rp) bne n, L(top) addq r3, r6, r6 C cannot carry per comment above addq r21, r6, r21 stq r21, 8(rp) ret r31, (r26), 1 EPILOGUE() ASM_END()
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2790.asm
ljhsiun2/medusa
9
167595
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r15 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x7af0, %rsi lea addresses_WC_ht+0xa0b0, %rdi sub %r15, %r15 mov $68, %rcx rep movsl nop nop nop nop nop xor $34774, %r13 lea addresses_D_ht+0x18ff0, %r12 nop and $62547, %r8 mov $0x6162636465666768, %rdi movq %rdi, %xmm1 and $0xffffffffffffffc0, %r12 movaps %xmm1, (%r12) dec %rcx lea addresses_WT_ht+0x10df0, %rsi lea addresses_normal_ht+0x160b8, %rdi clflush (%rdi) nop nop nop nop nop and $15109, %rbp mov $69, %rcx rep movsw nop nop nop xor %rcx, %rcx lea addresses_A_ht+0x17b0, %rsi lea addresses_WC_ht+0x14550, %rdi nop nop nop nop nop cmp %r13, %r13 mov $88, %rcx rep movsb cmp $61854, %r15 lea addresses_D_ht+0xe5f0, %r12 nop nop cmp $50877, %rsi movw $0x6162, (%r12) nop nop nop nop nop xor $54249, %r8 lea addresses_WT_ht+0xd3f0, %r12 nop nop nop nop nop dec %rbp movb (%r12), %r13b nop nop nop nop nop and $35950, %r13 lea addresses_normal_ht+0xbb50, %rdi nop nop nop nop sub $45548, %r13 movw $0x6162, (%rdi) nop nop nop sub $1450, %r12 lea addresses_A_ht+0x132f0, %rsi lea addresses_UC_ht+0x4c01, %rdi nop nop nop nop cmp %r8, %r8 mov $25, %rcx rep movsl nop nop nop nop nop sub %rcx, %rcx lea addresses_WC_ht+0x7bf0, %rsi lea addresses_WC_ht+0x52ca, %rdi nop nop nop nop nop and %rbp, %rbp mov $6, %rcx rep movsq nop nop nop nop dec %r13 lea addresses_UC_ht+0xd0c, %rsi lea addresses_A_ht+0xdb30, %rdi clflush (%rdi) nop nop nop nop nop add %r12, %r12 mov $7, %rcx rep movsw nop nop xor $58234, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r15 push %r9 push %rbp push %rdx // Store lea addresses_D+0x8f0, %rbp nop nop nop nop nop xor %r15, %r15 mov $0x5152535455565758, %rdx movq %rdx, (%rbp) nop nop nop cmp $3851, %r15 // Faulty Load lea addresses_RW+0x1bdf0, %rdx nop xor %r12, %r12 mov (%rdx), %r15 lea oracles, %r11 and $0xff, %r15 shlq $12, %r15 mov (%r11,%r15,1), %r15 pop %rdx pop %rbp pop %r9 pop %r15 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_RW', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': True, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
kDevice16.asm
satadriver/LiunuxOS_t
0
165271
.386p ;why use32 disassemblly error? Kernel16 Segment public para use16 assume cs:Kernel16 __initDevices proc call __initSysTimer call __initCmosRlt16 call __initMousePort call __init8259 call __enableA20 call __initNMI ret __initDevices endp ;端口70H的位7控制NMI ;bit7 = 0,open NMI,else mask NMI ;enable NMI ;mov al,0 ;out 70h,al __initCmosRlt16 proc mov al,0ah out 70h,al ;normal devision,0110 = ABOUT 15ms interruption period,RS must set to invoke a interrupt mov al,0aah out 71h,al mov al,0bh out 70h,al ;daylight savings time updates ,not BCD, 24h format,all interruption occurred mov al,7ah out 71h,al ;These bits store the date of month alarm value. If set to 000000b, then a don’t care state is assumed. The host must configure the date alarm for these bits to do anything mov al,0dh out 70h,al mov al,0 out 71h,al ret __initCmosRlt16 endp ;cmos manual: ;0 秒 ;1 秒报警 ;2 分 ;3 分报警 ;4 时 ;5 时报警 ;6 星期 ;7 日 ;8 月 ;9 年 ;A 状态寄存器A ;B 状态寄存器B ;C 状态寄存器C ;D 状态寄存器D ;E 诊断状态字节(0 正常) ;F 停止状态字节(0 有市电) ;10 软盘驱动器类型(位7-4:A驱,位3-0:B驱 1-360KB;2-1.2MB;6-1.44MB;7-720KB) ;11 保留 ;12 硬盘驱动器类型(位7-4:C驱,位3-0:D驱) ;13 保留 ;14 设备字节(软驱数目,显示器类型,协处理器) ;15 基本存储器低字节 ;16 基本存储器高字节 ;17 扩展存储器低字节 ;18 扩展存储器高字节 ;19 硬盘类型字节(低于15为0) ;1A—2D 保留 ;2E—2F CMOS校验和(10-2D各字节和) ;30 扩充存储器低字节 ;31 扩充存储器高字节 ;32 日期世纪字节(19H:19世纪) ;33 信息标志 ;34—3F 保留(34-0:没有密码;35-3F-密码位置) __sendMouseCmd proc push dx mov dl,al call __waitPs2In16 ;next command send to mouse,not kbd or genenral command mov al,0d4h out 64h,al call __waitPs2In16 mov al,dl out 60h,al ;任何时候收到一个来自于60h端口的合法命令或合法数据之后,都回复一个FAh call __waitPs2Out16 in al,60h cmp al,0fah pop dx ret __sendMouseCmd endp __initMousePort proc call __waitPs2In16 ;disable keyboard mov al,0adh out 64h,al call __waitPs2In16 ;enable mouse interface mov al,0a8h out 64h,al ;Enable Data Reporting mov al,0f4h call __sendMouseCmd call __waitPs2In16 ;准备写入8042芯片的Command Byte;下一个通过60h写入的字节将会被放入Command Byte mov al,60h out 64h,al call __waitPs2In16 ;set control register:scan code set 2,enable kbd and mouse interruptions,self check ok mov al,47h out 60h,al ;任何时候收到一个来自于60h端口的合法命令或合法数据之后,都回复一个FAh call __waitPs2Out16 in al,60h cmp al,0fah call __waitPs2In16 ;enable keyboard mov al,0aeh out 64h,al ret __initMousePort endp __waitPs2Out16 proc in al,64h test al,1 jz __waitPs2Out16 ret __waitPs2Out16 endp __waitPs2In16 proc in al,64h test al,2 jnz __waitPs2In16 ret __waitPs2In16 endp ;d6 d7 select timer,00 = 40h,01=41h,02 = 42h ;d4 d5 mode: ;11 read read/write low byte first,than read/write high byte ;00 lock the counter,then could read it ;d1 d2 d3 select work mode ;d0 bcd or binary,0=binary,1=bcd __initSysTimer proc cli ;timer0,real time interruption mov al,36h out 43h,al mov al,0 ;0000 = 10000h,about 55ms tricker once ;first low 8 bits,then high 8 bits ;1.1931816MHZ 1193181.6/23864 = 50hz = 20ms ;mov ax,23864 ;闪烁抖动显卡刷新率锁到85Hz以上就行 ;75-85 mov ax,11932 ;mov eax,0 out 40h,al mov al,ah out 40h,al ;timer1,memory flush mov al,76h out 43h,al mov ax,0 out 41h,al mov al,ah out 41h,al ;time2,speaker(control from port 61h) mov al,0b6h out 43h,al mov ax,0 out 42h,al mov al,ah out 42h,al ret __initSysTimer endp ;61h NMI Status and Control Register __initNMI proc ;bit3:IOCHK NMI Enable (INE): When set, IOCHK# NMIs are disabled and cleared. When cleared, IOCHK# NMIs are enabled. ;bit2:SERR# NMI Enable (SNE): When set, SERR# NMIs are disabled and cleared. When cleared, SERR# NMIs are enabled. ;bit1:Speaker Data Enable (SDE): When this bit is a 0, the SPKR output is a 0. ;When this bit is a 1, the SPKR output is equivalent to the Counter 2 OUT signal value. ;bit 0:Timer Counter 2 Enable (TC2E): When cleared, counter 2 counting is disabled. When set, counting is enabled. in al,61h mov al,3 out 61h,al ret __initNMI endp __readTimerCounter proc mov al,36h out 43h,al in al,40h mov ah,al in al,40h xchg ah,al ret __readTimerCounter endp ;icw1-icw4 ;icw1 use 20h,a0h,icw2-icw4 use 21h and 0a1h __init8259 proc cli push eax push edx in al,21h mov ah,al in al,0a1h xchg ah,al mov ds:[_rmMode8259Mask],ax ;icw1 mov al,11h out 20h,al out 0a0h,al ;icw2 mov al,ICW2_MASTER_INT_NO out 21h,al mov al,ICW2_SLAVE_INT_NO out 0a1h,al ;icw3 mov al,4 out 21h,al mov al,2 out 0a1h,al ;icw4 ;bit4= sfnm,0代表优先级从0到7,只有更高优先级才可以嵌套,同级以及以下不理会 ;bit1 = 1,aeoi,auto end interruption,else we need to send 20h to 20h(or 0a0h) to terminate this interruption ;bit0 =1,8086 mov al,1 out 21h,al MOV AL,1 out 0a1h,al ;ocw1 ;set interruption mask mov al,0 ;IRQ2 must be enabled! or al,40h out 21h,al mov al,0h or al,0c0h out 0a1h,al ;ELCR1—Master Edge/Level Control Register 4D0h ;ELCR2—Slave Edge/Level Control Register 4D1h ;In edge mode, (bit cleared), the interrupt is recognized by a low to high transition. ;In level mode (bit set), the interrupt is recognized by a high level. ; The cascade channel, IRQ2, heart beat timer (IRQ0), and keyboard controller (IRQ1), cannot be put into level mode mov dx,4d0h in al,dx mov byte ptr ds:[_rmPicElcr],al mov al,0 out dx,al mov dx,4d1h in al,dx mov byte ptr ds:[_rmPicElcr+1],al mov al,0 out dx,al pop edx pop eax ret __init8259 endp __restoreDos8259 proc cli push edx mov al,11h out 20h,al out 0a0h,al mov al,ICW2_MASTER_DOSINT_NO out 21h,al mov al,ICW2_SLAVE_DOSINT_NO out 0a1h,al mov al,4 out 21h,al mov al,2 out 0a1h,al mov al,1h out 21h,al out 0a1h,al mov dx,4d0h mov al,byte ptr ds:[_rmPicElcr] out dx,al mov dx,4d1h mov al,byte ptr ds:[_rmPicElcr+1] out dx,al pop edx ret __restoreDos8259 endp __enableA20 proc ;mov ax,0x2401 ;int 15h ;in al,0eeh in al,92h or al,2 out 92h,al ret __enableA20 endp __disableA20 proc in al,92h and al,0fdh out 92h,al ret __disableA20 endp Kernel16 ends
TrafficLight13/Release/tst01.asm
lugovskovp/TrafficLight13
10
174439
./Release/tst01.elf: file format elf32-avr Disassembly of section .text: 00000000 <__vectors>: 0: 09 c0 rjmp .+18 ; 0x14 <__ctors_end> 2: 16 c0 rjmp .+44 ; 0x30 <__bad_interrupt> 4: 15 c0 rjmp .+42 ; 0x30 <__bad_interrupt> 6: 14 c0 rjmp .+40 ; 0x30 <__bad_interrupt> 8: 13 c0 rjmp .+38 ; 0x30 <__bad_interrupt> a: 12 c0 rjmp .+36 ; 0x30 <__bad_interrupt> c: 11 c0 rjmp .+34 ; 0x30 <__bad_interrupt> e: 10 c0 rjmp .+32 ; 0x30 <__bad_interrupt> 10: 0f c0 rjmp .+30 ; 0x30 <__bad_interrupt> 12: 0e c0 rjmp .+28 ; 0x30 <__bad_interrupt> 00000014 <__ctors_end>: 14: 11 24 eor r1, r1 16: 1f be out 0x3f, r1 ; 63 18: cf e9 ldi r28, 0x9F ; 159 1a: cd bf out 0x3d, r28 ; 61 0000001c <__do_clear_bss>: 1c: 20 e0 ldi r18, 0x00 ; 0 1e: a0 e6 ldi r26, 0x60 ; 96 20: b0 e0 ldi r27, 0x00 ; 0 22: 01 c0 rjmp .+2 ; 0x26 <.do_clear_bss_start> 00000024 <.do_clear_bss_loop>: 24: 1d 92 st X+, r1 00000026 <.do_clear_bss_start>: 26: aa 36 cpi r26, 0x6A ; 106 28: b2 07 cpc r27, r18 2a: e1 f7 brne .-8 ; 0x24 <.do_clear_bss_loop> 2c: 02 d0 rcall .+4 ; 0x32 <main> 2e: 6e c0 rjmp .+220 ; 0x10c <_exit> 00000030 <__bad_interrupt>: 30: e7 cf rjmp .-50 ; 0x0 <__vectors> 00000032 <main>: 32: cf 93 push r28 34: df 93 push r29 36: 00 d0 rcall .+0 ; 0x38 <main+0x6> 38: cd b7 in r28, 0x3d ; 61 3a: dd 27 eor r29, r29 3c: 1a 82 std Y+2, r1 ; 0x02 3e: 19 82 std Y+1, r1 ; 0x01 40: 89 81 ldd r24, Y+1 ; 0x01 42: 9a 81 ldd r25, Y+2 ; 0x02 44: 04 97 sbiw r24, 0x04 ; 4 46: 78 f4 brcc .+30 ; 0x66 <__SREG__+0x27> 48: 89 81 ldd r24, Y+1 ; 0x01 4a: 80 5d subi r24, 0xD0 ; 208 4c: 28 2f mov r18, r24 4e: 89 81 ldd r24, Y+1 ; 0x01 50: 9a 81 ldd r25, Y+2 ; 0x02 52: 80 5a subi r24, 0xA0 ; 160 54: 9f 4f sbci r25, 0xFF ; 255 56: fc 01 movw r30, r24 58: 20 83 st Z, r18 5a: 89 81 ldd r24, Y+1 ; 0x01 5c: 9a 81 ldd r25, Y+2 ; 0x02 5e: 01 96 adiw r24, 0x01 ; 1 60: 9a 83 std Y+2, r25 ; 0x02 62: 89 83 std Y+1, r24 ; 0x01 64: ed cf rjmp .-38 ; 0x40 <__SREG__+0x1> 66: 83 e0 ldi r24, 0x03 ; 3 68: 90 e0 ldi r25, 0x00 ; 0 6a: 80 5a subi r24, 0xA0 ; 160 6c: 9f 4f sbci r25, 0xFF ; 255 6e: fc 01 movw r30, r24 70: 80 81 ld r24, Z 72: 08 2e mov r0, r24 74: 00 0c add r0, r0 76: 99 0b sbc r25, r25 78: 07 d0 rcall .+14 ; 0x88 <putchar> 7a: 80 e0 ldi r24, 0x00 ; 0 7c: 90 e0 ldi r25, 0x00 ; 0 7e: ce 5f subi r28, 0xFE ; 254 80: cd bf out 0x3d, r28 ; 61 82: df 91 pop r29 84: cf 91 pop r28 86: 08 95 ret 00000088 <putchar>: 88: 60 91 66 00 lds r22, 0x0066 ; 0x800066 <__iob+0x2> 8c: 70 91 67 00 lds r23, 0x0067 ; 0x800067 <__iob+0x3> 90: 01 d0 rcall .+2 ; 0x94 <fputc> 92: 08 95 ret 00000094 <fputc>: 94: 0f 93 push r16 96: 1f 93 push r17 98: cf 93 push r28 9a: df 93 push r29 9c: fb 01 movw r30, r22 9e: 23 81 ldd r18, Z+3 ; 0x03 a0: 21 fd sbrc r18, 1 a2: 03 c0 rjmp .+6 ; 0xaa <__stack+0xb> a4: 8f ef ldi r24, 0xFF ; 255 a6: 9f ef ldi r25, 0xFF ; 255 a8: 2c c0 rjmp .+88 ; 0x102 <__stack+0x63> aa: 22 ff sbrs r18, 2 ac: 16 c0 rjmp .+44 ; 0xda <__stack+0x3b> ae: 46 81 ldd r20, Z+6 ; 0x06 b0: 57 81 ldd r21, Z+7 ; 0x07 b2: 24 81 ldd r18, Z+4 ; 0x04 b4: 35 81 ldd r19, Z+5 ; 0x05 b6: 42 17 cp r20, r18 b8: 53 07 cpc r21, r19 ba: 44 f4 brge .+16 ; 0xcc <__stack+0x2d> bc: a0 81 ld r26, Z be: b1 81 ldd r27, Z+1 ; 0x01 c0: 9d 01 movw r18, r26 c2: 2f 5f subi r18, 0xFF ; 255 c4: 3f 4f sbci r19, 0xFF ; 255 c6: 31 83 std Z+1, r19 ; 0x01 c8: 20 83 st Z, r18 ca: 8c 93 st X, r24 cc: 26 81 ldd r18, Z+6 ; 0x06 ce: 37 81 ldd r19, Z+7 ; 0x07 d0: 2f 5f subi r18, 0xFF ; 255 d2: 3f 4f sbci r19, 0xFF ; 255 d4: 37 83 std Z+7, r19 ; 0x07 d6: 26 83 std Z+6, r18 ; 0x06 d8: 14 c0 rjmp .+40 ; 0x102 <__stack+0x63> da: 8b 01 movw r16, r22 dc: ec 01 movw r28, r24 de: fb 01 movw r30, r22 e0: 00 84 ldd r0, Z+8 ; 0x08 e2: f1 85 ldd r31, Z+9 ; 0x09 e4: e0 2d mov r30, r0 e6: 09 95 icall e8: 89 2b or r24, r25 ea: e1 f6 brne .-72 ; 0xa4 <__stack+0x5> ec: d8 01 movw r26, r16 ee: 16 96 adiw r26, 0x06 ; 6 f0: 8d 91 ld r24, X+ f2: 9c 91 ld r25, X f4: 17 97 sbiw r26, 0x07 ; 7 f6: 01 96 adiw r24, 0x01 ; 1 f8: 17 96 adiw r26, 0x07 ; 7 fa: 9c 93 st X, r25 fc: 8e 93 st -X, r24 fe: 16 97 sbiw r26, 0x06 ; 6 100: ce 01 movw r24, r28 102: df 91 pop r29 104: cf 91 pop r28 106: 1f 91 pop r17 108: 0f 91 pop r16 10a: 08 95 ret 0000010c <_exit>: 10c: f8 94 cli 0000010e <__stop_program>: 10e: ff cf rjmp .-2 ; 0x10e <__stop_program>
oeis/347/A347167.asm
neoneye/loda-programs
11
171545
; A347167: Numbers k such that phi(binomial(k,2)) is a power of 2. ; Submitted by <NAME> ; 2,3,4,5,6,16,17,256,257,65536,65537,4294967296 sub $0,1 mov $3,2 lpb $0 sub $0,2 mov $2,$1 mov $1,1 pow $3,2 lpe sub $2,$3 sub $2,7 sub $0,$2 sub $0,6
src/commands/makeewds.adb
Alex-Vasile/whitakers-words
3
27024
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. with Ada.Text_IO; with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package; with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names; with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package; with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package; with Words_Engine.English_Support_Package; use Words_Engine.English_Support_Package; with Weed; with Weed_All; with Support_Utils.Dictionary_Form; with Latin_Utils.General; use Latin_Utils; procedure Makeewds is package Integer_IO is new Ada.Text_IO.Integer_IO (Integer); use Ada.Text_IO; use Integer_IO; use Dictionary_Entry_IO; use Part_Entry_IO; use Part_Of_Speech_Type_IO; use Age_Type_IO; use Area_Type_IO; use Geo_Type_IO; use Frequency_Type_IO; use Source_Type_IO; use Ewds_Record_Io; Porting : constant Boolean := False; Checking : constant Boolean := True; D_K : Dictionary_Kind := Xxx; -- ###################### Start_Stem_1 : constant := 1; Start_Stem_2 : constant := Start_Stem_1 + Max_Stem_Size + 1; Start_Stem_3 : constant := Start_Stem_2 + Max_Stem_Size + 1; Start_Stem_4 : constant := Start_Stem_3 + Max_Stem_Size + 1; Start_Part : constant := Start_Stem_4 + Max_Stem_Size + 1; Line_Number : Integer := 0; subtype Line_Type is String (1 .. 400); N : Integer := 0; Input, Output, Check : Ada.Text_IO.File_Type; De : Dictionary_Entry; S, Line : Line_Type := (others => ' '); Blank_Line : constant Line_Type := (others => ' '); L, Last : Integer := 0; Ewa : Ewds_Array (1 .. 40) := (others => Null_Ewds_Record); Ewr : Ewds_Record := Null_Ewds_Record; -- First we supplement MEAN with singles of any hyphenated words -- In principle this could be done in the main EXTRACT, much same logic/code -- However this is difficult code for an old man, EXTRACT was hard -- when I was a bit younger, and I cannot remember anything about it. -- Separating them out makes it much easier to test function Add_Hyphenated (S : String) return String is -------- I tried to do something with hyphenated but so far it -------- does not work -- Find hyphenated words and add them to MEAN with a / connector, -- right before the parse so one has both the individual words (may -- be more than two) and a single combined word -- counting-board -> counting board/countingboard -- Cannot be bigger: T : String (1 .. Max_Meaning_Size * 2 + 20) := (others => ' '); Word_Start : Integer := 1; Word_End : Integer := 0; I, J, Jmax : Integer := 0; Hyphenated : Boolean := False; begin --PUT_LINE (S); while I < S'Last loop I := I + 1; J := J + 1; Word_End := 0; --PUT (INTEGER'IMAGE (I) & "-"); -- First clear away or ignore all the non-words stuff if S (I) = '|' then -- Skip continuation |'s Word_Start := I + 1; T (J) := S (I); J := J + 1; Jmax := Jmax + 1; null; I := I + 1; elsif S (I) = '"' then -- Skip "'S Word_Start := I + 1; T (J) := S (I); J := J + 1; Jmax := Jmax + 1; null; I := I + 1; else if S (I) = '(' then -- ( .. .) not to be parsed T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; while S (I) /= ')' loop T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; end loop; Word_Start := I + 2; -- Skip }; Word_End := 0; elsif S (I) = '[' then -- ( .. .) not to be parsed T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; while S (I - 1 .. I) /= "=>" loop T (J) := S (I); J := J + 1; Jmax := Jmax + 1; I := I + 1; end loop; Word_Start := I + 2; Word_End := 0; end if; -- Finished with the non-word stuff if S (I) = '-' then Word_End := I - 1; -- if (I /= S'FIRST) and then -- Not -word -- ( (S (I-1) /= ' ') and -- (S (I-1) /= '/') ) then -- HYPHENATED := TRUE; -- end if; end if; if S (I) = ' ' or S (I) = '/' or S (I) = ',' or S (I) = ';' or S (I) = '!' or S (I) = '?' or S (I) = '+' or S (I) = '*' or S (I) = '"' or S (I) = '(' then Word_End := I - 1; if Hyphenated then T (J) := '/'; J := J + 1; Jmax := Jmax + 1; for K in Word_Start .. Word_End loop if S (K) /= '-' then T (J) := S (K); J := J + 1; Jmax := Jmax + 1; end if; end loop; Hyphenated := False; end if; end if; if --WORD_END /= 0 and then S (I) = ' ' or S (I) = '/' then Word_Start := I + 1; Word_End := 0; end if; end if; -- On '|' -- Set up the Output to return --PUT ('|' & INTEGER'IMAGE (J) & '/' & INTEGER'IMAGE (I)); T (J) := S (I); Jmax := Jmax + 1; end loop; -- Over S'RANGE return T (1 .. Jmax); exception when others => Put_Line ("ADD_HYPHENATED Exception LINE = " & Integer'Image (Line_Number)); Put_Line (S); Put (De); New_Line; return T (1 .. Jmax); end Add_Hyphenated; procedure Extract_Words (S : in String; Pofs : in Part_Of_Speech_Type; N : out Integer; Ewa : out Ewds_Array) is -- i, j, js, k, l, m, im, ic : Integer := 0; J, K, L, M, Im, Ic : Integer := 0; End_Semi : constant Integer := 1; -- Have to expand type to take care of hyphenated subtype X_Meaning_Type is String (1 .. Max_Meaning_Size * 2 + 20); Null_X_Meaning_Type : constant X_Meaning_Type := (others => ' '); Semi, Comma : X_Meaning_Type := Null_X_Meaning_Type; Ww : Integer := 0; -- For debug begin -- i := 1; -- Element Position in line, per SEMI J := 1; -- Position in word K := 0; -- SEMI - Division in line L := 1; -- Position in MEAN, for EXTRACTing SEMI M := 1; -- COMMA in SEMI N := 1; -- Word number Im := 0; -- Position in SEMI Ic := 0; -- Position in COMMA Ewa (N) := Null_Ewds_Record; -- Slightly disparage extension if S (S'First) = '|' then K := 3; end if; while L <= S'Last loop -- loop over MEAN if S (L) = ' ' then -- Clear initial blanks L := L + 1; end if; Semi := Null_X_Meaning_Type; Im := 1; Extract_Semi : loop if S (L) = '|' then null; -- Ignore continuation flag | as word elsif S (L) in '0' .. '9' then null; -- Ignore numbers elsif S (L) = ';' then -- Division Terminator K := K + 1; --PUT ('+'); L := L + 1; -- Clear ; exit Extract_Semi; elsif S (L) = '(' then -- Skip ( .. .) ! while S (L) /= ')' loop --PUT ('+'); --PUT (INTEGER'IMAGE (L)); --PUT (S (L)); exit when L = S'Last; -- Run out L := L + 1; end loop; -- L := L + 1; -- Clear the ')' --PUT ('^'); --PUT (INTEGER'IMAGE (L)); --PUT (S (L)); if L > S'Last then L := S'Last; else if S (L) = ';' then -- ); exit Extract_Semi; end if; end if; --PUT (']'); if L >= S'Last then -- Ends in ) -- PUT ('!'); exit Extract_Semi; end if; --PUT ('+'); --L := L + 1; -- Clear the ')' elsif L = S'Last then --PUT ('|'); L := L + 1; -- To end the loop exit Extract_Semi; else Semi (Im) := S (L); Im := Im + 1; end if; --PUT ('+'); --IM := IM + 1; -- To next Character L := L + 1; -- To next Character end loop Extract_Semi; Ww := 10; Process_Semi : declare St : constant String := Trim (Semi); Sm : constant String (St'First .. St'Last) := St; begin if St'Length > 0 then Comma := Null_X_Meaning_Type; Im := Sm'First; M := 0; --I := SM'FIRST; --while I <= ST'LAST loop --PUT (S (I)); --PUT ('*'); --COMMA := NULL_X_MEANING_TYPE; Ic := 1; Loop_Over_Semi : while Im <= Sm'Last loop Comma := Null_X_Meaning_Type; Ww := 20; Find_Comma : loop --PUT (INTEGER'IMAGE (IM) & " ( " & SM (IM)); if Sm (Im) = '(' then -- Skip ( .. .) ! while Sm (Im) /= ')' loop Im := Im + 1; end loop; Im := Im + 1; -- Clear the ')' -- IM := IM + 1; -- Go to next Character if Im >= End_Semi then exit Find_Comma; end if; if (Sm (Im) = ';') or (Sm (Im) = ',') then -- Foumd COMMA M := M + 1; Ic := 1; Im := Im + 1; -- Clear ;, exit Find_Comma; elsif Sm (Im) = ' ' then Im := Im + 1; end if; --PUT_LINE ("------------------------"); end if; if Sm (Im) = '[' then -- Take end of [=>] while Sm (Im) /= '>' loop exit when Sm (Im) = ']'; -- If no > Im := Im + 1; end loop; Im := Im + 1; -- Clear the '>' or ']' if Sm (Im) = ';' then -- Foumd COMMA M := M + 1; Ic := 1; Im := Im + 1; -- Clear ; exit Find_Comma; elsif Sm (Im) = ' ' then Im := Im + 1; end if; end if; -- But could be 2 =>! --PUT_LINE ("Through ()[] I = " & INTEGER'IMAGE (I)); exit Find_Comma when Im > Sm'Last; --PUT (INTEGER'IMAGE (IM) & " ) " & SM (IM)); if Sm (Im) = ',' then -- Foumd COMMA M := M + 1; Ic := 1; Im := Im + 1; -- Clear , exit Find_Comma; elsif Im >= Sm'Last or Im = S'Last then -- Foumd COMMA Comma (Ic) := Sm (Im); M := M + 1; Ic := 1; exit Find_Comma; else Comma (Ic) := Sm (Im); Im := Im + 1; Ic := Ic + 1; end if; --PUT (INTEGER'IMAGE (IM) & " ! " & SM (IM)); end loop Find_Comma; Im := Im + 1; Ww := 30; Process_Comma : declare Ct : constant String := Trim (Comma); Cs : String (Ct'First .. Ct'Last) := Ct; Pure : Boolean := True; W_Start, W_End : Integer := 0; begin Ww := 31; if Ct'Length > 0 then -- Is COMMA non empty -- Are there any blanks? -- If not then it is a pure word -- Or words with / for Ip in Cs'Range loop if Cs (Ip) = ' ' then Pure := False; end if; end loop; Ww := 32; -- Check for WEED words and eliminate them W_Start := Cs'First; W_End := Cs'Last; for Iw in Cs'Range loop --PUT ('-'); --PUT (CS (IW)); if (Cs (Iw) = '(') or (Cs (Iw) = '[') then Ww := 33; W_Start := Iw + 1; else Ww := 34; if (Cs (Iw) = ' ') or (Cs (Iw) = '_') or (Cs (Iw) = '-') or (Cs (Iw) = ''') or (Cs (Iw) = '!') or (Cs (Iw) = '/') or (Cs (Iw) = ':') or (Cs (Iw) = '.') or (Cs (Iw) = '!') or (Cs (Iw) = ')') or (Cs (Iw) = ']') or (Iw = Cs'Last) then Ww := 35; if Iw = Cs'Last then W_End := Iw; elsif Iw /= Cs'First then W_End := Iw - 1; end if; Ww := 36; -- KLUDGE if Cs (W_Start) = '"' then Ww := 361; W_Start := W_Start + 1; Ww := 362; elsif Cs (W_End) = '"' then Ww := 364; W_End := W_End - 1; Ww := 365; end if; Ww := 37; --& " " & CS (W_START .. W_END) --); Weed_All (Cs (W_Start .. W_End)); if not Pure then Weed (Cs (W_Start .. W_End), Pofs); end if; W_Start := Iw + 1; end if; Ww := 38; end if; Ww := 39; end loop; -- On CS'RANGE --PUT_LINE (INTEGER'IMAGE (LINE_NUMBER) & "WEED done"); Ww := 40; -- Main process of COMMA Ic := 1; J := 1; while Ic <= Cs'Last loop --PUT (CS (IC)); if Cs (Ic) = '"' or -- Skip all " Cs (Ic) = '(' or -- Skip initial ( Cs (Ic) = '?' or -- Ignore ? Cs (Ic) = '~' or -- Ignore about ~ Cs (Ic) = '*' or Cs (Ic) = '%' or -- Ignore % unless word Cs (Ic) = '.' or -- Ignore . .. Cs (Ic) = '\' or -- Ignore weed (Cs (Ic) in '0' .. '9') then -- Skip numbers Ic := Ic + 1; Ww := 50; ----PUT ('-'); else if Cs (Ic) = '/' or Cs (Ic) = ' ' or Cs (Ic) = ''' or -- Ignore all ' incl 's ??? Cs (Ic) = '-' or -- Hyphen causes 2 words XXX Cs (Ic) = '+' or -- Plus causes 2 words Cs (Ic) = '_' or -- Underscore causes 2 words Cs (Ic) = '=' or -- = space/terminates Cs (Ic) = '>' or Cs (Ic) = ')' or Cs (Ic) = ']' or Cs (Ic) = '!' or Cs (Ic) = '?' or Cs (Ic) = '+' or Cs (Ic) = ':' or Cs (Ic) = ']' then -- Found word Ww := 60; --PUT ('/'); Ewa (N).Semi := K; if Pure then if K = 1 then Ewa (N).Kind := 15; else Ewa (N).Kind := 10; end if; else Ewa (N).Kind := 0; end if; Ww := 70; N := N + 1; -- Start new word in COMMA Ic := Ic + 1; J := 1; Ewa (N) := Null_Ewds_Record; elsif Ic = Cs'Last then -- Order of if important -- End, Found word --PUT ('!'); Ewa (N).W (J) := Cs (Ic); Ewa (N).Semi := K; if Pure then if K = 1 then Ewa (N).Kind := 15; else Ewa (N).Kind := 10; end if; else Ewa (N).Kind := 0; end if; N := N + 1; -- Start new word/COMMA Ewa (N) := Null_Ewds_Record; exit; else Ww := 80; --PUT ('+'); Ewa (N).W (J) := Cs (Ic); J := J + 1; Ic := Ic + 1; end if; end if; Ww := 90; end loop; end if; -- On COMMA being empty end Process_Comma; --PUT_LINE ("COMMA Processed "); end loop Loop_Over_Semi; --PUT_LINE ("LOOP OVER SEMI Processed "); end if; -- On ST'LENGTH > 0 --PUT_LINE ("LOOP OVER SEMI after ST'LENGTH 0 "); end Process_Semi; --PUT_LINE ("SEMI Processed "); -- I = " & INTEGER'IMAGE (I) --& " S (I) = " & S (I) --); if (L < S'Last) and then (S (L) = ';') then -- ?????? --PUT_LINE ("Clear L = " & INTEGER'IMAGE (L)); L := L + 1; end if; -- investigate this: -- js := l; -- Odd but necessary ????? for J in L .. S'Last loop exit when J = S'Last; if S (J) = ' ' then L := L + 1; else exit; end if; end loop; exit when L >= S'Last; end loop; -- loop over MEAN --PUT_LINE ("SEMI loop Processed"); if Ewa (N) = Null_Ewds_Record then N := N - 1; -- Clean up danglers end if; if Ewa (N) = Null_Ewds_Record then -- AGAIN!!!!!! N := N - 1; -- Clean up danglers end if; exception when others => if (S (S'Last) /= ')') or (S (S'Last) /= ']') then -- KLUDGE New_Line; Put_Line ("Extract Exception WW = " & Integer'Image (Ww) & " LINE = " & Integer'Image (Line_Number)); Put_Line (S); Put (De); New_Line; end if; end Extract_Words; begin Put_Line ("Takes a DICTLINE.D_K and produces a EWDSLIST.D_K "); Latin_Utils.General.Load_Dictionary (Line, Last, D_K); Open (Input, In_File, Add_File_Name_Extension (Dict_Line_Name, Dictionary_Kind'Image (D_K))); --PUT_LINE ("OPEN"); if not Porting then --PUT_LINE ("CREATING"); Create (Output, Out_File, Add_File_Name_Extension ("EWDSLIST", Dictionary_Kind'Image (D_K))); if Checking then Create (Check, Out_File, "CHECKEWD."); end if; --PUT_LINE ("CREATED"); end if; -- Now do the rest Over_Lines : while not End_Of_File (Input) loop S := Blank_Line; Get_Line (Input, S, Last); if Trim (S (1 .. Last)) /= "" then -- If non-blank line L := 0; Form_De : begin De.Stems (1) := S (Start_Stem_1 .. Max_Stem_Size); --NEW_LINE; PUT (DE.STEMS (1)); De.Stems (2) := S (Start_Stem_2 .. Start_Stem_2 + Max_Stem_Size - 1); De.Stems (3) := S (Start_Stem_3 .. Start_Stem_3 + Max_Stem_Size - 1); De.Stems (4) := S (Start_Stem_4 .. Start_Stem_4 + Max_Stem_Size - 1); --PUT ('#'); PUT (INTEGER'IMAGE (L)); PUT (INTEGER'IMAGE (LAST)); --PUT ('@'); Get (S (Start_Part .. Last), De.Part, L); --PUT ('%'); PUT (INTEGER'IMAGE (L)); PUT (INTEGER'IMAGE (LAST)); --PUT ('&'); PUT (S (L+1 .. LAST)); PUT ('3'); --GET (S (L+1 .. LAST), DE.PART.POFS, DE.KIND, L); -- FIXME: Why not Translation_Record_IO.Put ? Get (S (L + 1 .. Last), De.Tran.Age, L); Get (S (L + 1 .. Last), De.Tran.Area, L); Get (S (L + 1 .. Last), De.Tran.Geo, L); Get (S (L + 1 .. Last), De.Tran.Freq, L); Get (S (L + 1 .. Last), De.Tran.Source, L); De.Mean := Head (S (L + 2 .. Last), Max_Meaning_Size); -- Note that this allows initial blanks -- L+2 skips over the SPACER, required because -- this is STRING, not ENUM exception when others => New_Line; Put_Line ("GET Exception LAST = " & Integer'Image (Last)); Put_Line (S (1 .. Last)); Integer_IO.Put (Line_Number); New_Line; Put (De); New_Line; end Form_De; Line_Number := Line_Number + 1; if De.Part.Pofs = V and then De.Part.V.Con.Which = 8 then -- V 8 is a kludge for variant forms of verbs -- that have regular forms elsewhere null; else -- Extract words Extract_Words (Add_Hyphenated (Trim (De.Mean)), De.Part.Pofs, N, Ewa); -- EWORD_SIZE : constant := 38; -- AUX_WORD_SIZE : constant := 9; -- LINE_NUMBER_WIDTH : constant := 10; -- -- type EWDS_RECORD is -- record -- POFS : PART_OF_SPEECH_TYPE := X; -- W : STRING (1 .. EWORD_SIZE); -- AUX : STRING (1 .. AUX_WORD_SIZE); -- N : INTEGER; -- end record; for I in 1 .. N loop if Trim (Ewa (I).W)'Length /= 0 then Ewr.W := Head (Trim (Ewa (I).W), Eword_Size); Ewr.Aux := Head ("", Aux_Word_Size); Ewr.N := Line_Number; Ewr.Pofs := De.Part.Pofs; Ewr.Freq := De.Tran.Freq; Ewr.Semi := Ewa (I).Semi; Ewr.Kind := Ewa (I).Kind; Ewr.Rank := 80 - Frequency_Type'Pos (Ewr.Freq) * 10 + Ewr.Kind + (Ewr.Semi - 1) * (-3); if Ewr.Freq = Inflections_Package.N then Ewr.Rank := Ewr.Rank + 25; end if; --PUT (EWA (I)); NEW_LINE; --PUT (EWR); NEW_LINE; Put (Output, Ewr); -- SET_COL (OUTPUT, 71); -- INTEGER_IO.PUT (OUTPUT, I, 2); New_Line (Output); if Checking then -- Now make the CHECK file Put (Check, Ewr.W); Set_Col (Check, 25); declare Df : constant String := Support_Utils.Dictionary_Form (De); Ii : Integer := 1; begin if Df'Length > 0 then while Df (Ii) /= ' ' and Df (Ii) /= '.' and Df (Ii) /= ',' loop Put (Check, Df (Ii)); Ii := Ii + 1; exit when Ii = 19; end loop; end if; end; Set_Col (Check, 44); Put (Check, Ewr.N, 6); Put (Check, ' '); Put (Check, Ewr.Pofs); Put (Check, ' '); Put (Check, Ewr.Freq); Put (Check, ' '); Put (Check, Ewr.Semi, 5); Put (Check, ' '); Put (Check, Ewr.Kind, 5); Put (Check, ' '); Put (Check, Ewr.Rank, 5); Put (Check, ' '); Put (Check, De.Mean); New_Line (Check); end if; end if; end loop; end if; -- If non-blank line end if; end loop Over_Lines; Put_Line ("NUMBER_OF_LINES = " & Integer'Image (Line_Number)); if not Porting then Close (Output); if Checking then Close (Check); end if; end if; exception when Ada.Text_IO.Data_Error => null; when others => Put_Line (S (1 .. Last)); Integer_IO.Put (Line_Number); New_Line; Close (Output); if Checking then Close (Check); end if; end Makeewds;
Cubical/Data/FinSet/Constructors.agda
howsiyu/cubical
0
3955
<reponame>howsiyu/cubical {- This files contains: - Facts about constructions on finite sets, especially when they preserve finiteness. -} {-# OPTIONS --safe #-} module Cubical.Data.FinSet.Constructors where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Foundations.Equiv renaming (_∙ₑ_ to _⋆_) open import Cubical.Foundations.Univalence open import Cubical.HITs.PropositionalTruncation as Prop open import Cubical.Data.Nat open import Cubical.Data.Unit open import Cubical.Data.Empty as Empty open import Cubical.Data.Sum open import Cubical.Data.Sigma open import Cubical.Data.Fin.LehmerCode as LehmerCode open import Cubical.Data.SumFin open import Cubical.Data.FinSet.Base open import Cubical.Data.FinSet.Properties open import Cubical.Data.FinSet.FiniteChoice open import Cubical.Relation.Nullary open import Cubical.Functions.Fibration open import Cubical.Functions.Embedding open import Cubical.Functions.Surjection private variable ℓ ℓ' ℓ'' ℓ''' : Level module _ (X : Type ℓ)(p : isFinOrd X) where isFinOrd∥∥ : isFinOrd ∥ X ∥ isFinOrd∥∥ = _ , propTrunc≃ (p .snd) ⋆ SumFin∥∥≃ _ isFinOrd≃ : isFinOrd (X ≃ X) isFinOrd≃ = _ , equivComp (p .snd) (p .snd) ⋆ SumFin≃≃ _ module _ (X : Type ℓ )(p : isFinOrd X) (Y : Type ℓ')(q : isFinOrd Y) where isFinOrd⊎ : isFinOrd (X ⊎ Y) isFinOrd⊎ = _ , ⊎-equiv (p .snd) (q .snd) ⋆ SumFin⊎≃ _ _ isFinOrd× : isFinOrd (X × Y) isFinOrd× = _ , Σ-cong-equiv (p .snd) (λ _ → q .snd) ⋆ SumFin×≃ _ _ module _ (X : Type ℓ )(p : isFinOrd X) (Y : X → Type ℓ')(q : (x : X) → isFinOrd (Y x)) where private e = p .snd f : (x : X) → ℕ f x = q x .fst isFinOrdΣ : isFinOrd (Σ X Y) isFinOrdΣ = _ , Σ-cong-equiv {B' = λ x → Y (invEq e x)} e (transpFamily p) ⋆ Σ-cong-equiv-snd (λ x → q (invEq e x) .snd) ⋆ SumFinΣ≃ _ _ isFinOrdΠ : isFinOrd ((x : X) → Y x) isFinOrdΠ = _ , equivΠ {B' = λ x → Y (invEq e x)} e (transpFamily p) ⋆ equivΠCod (λ x → q (invEq e x) .snd) ⋆ SumFinΠ≃ _ _ -- closedness under several type constructors module _ (X : FinSet ℓ) (Y : X .fst → FinSet ℓ') where isFinSetΣ : isFinSet (Σ (X .fst) (λ x → Y x .fst)) isFinSetΣ = rec2 isPropIsFinSet (λ p q → isFinOrd→isFinSet (isFinOrdΣ (X .fst) (_ , p) (λ x → Y x .fst) q)) (X .snd .snd) (choice X (λ x → isFinOrd (Y x .fst)) (λ x → isFinSet→isFinSet' (Y x .snd))) isFinSetΠ : isFinSet ((x : X .fst) → Y x .fst) isFinSetΠ = rec2 isPropIsFinSet (λ p q → isFinOrd→isFinSet (isFinOrdΠ (X .fst) (_ , p) (λ x → Y x .fst) q)) (X .snd .snd) (choice X (λ x → isFinOrd (Y x .fst)) (λ x → isFinSet→isFinSet' (Y x .snd))) module _ (X : FinSet ℓ) (Y : X .fst → FinSet ℓ') (Z : (x : X .fst) → Y x .fst → FinSet ℓ'') where isFinSetΠ2 : isFinSet ((x : X .fst) → (y : Y x .fst) → Z x y .fst) isFinSetΠ2 = isFinSetΠ X (λ x → _ , isFinSetΠ (Y x) (Z x)) module _ (X : FinSet ℓ) (Y : X .fst → FinSet ℓ') (Z : (x : X .fst) → Y x .fst → FinSet ℓ'') (W : (x : X .fst) → (y : Y x .fst) → Z x y .fst → FinSet ℓ''') where isFinSetΠ3 : isFinSet ((x : X .fst) → (y : Y x .fst) → (z : Z x y .fst) → W x y z .fst) isFinSetΠ3 = isFinSetΠ X (λ x → _ , isFinSetΠ2 (Y x) (Z x) (W x)) module _ (X : FinSet ℓ) where isFinSet≡ : (a b : X .fst) → isFinSet (a ≡ b) isFinSet≡ a b = isDecProp→isFinSet (isFinSet→isSet (X .snd) a b) (isFinSet→Discrete (X .snd) a b) isFinSet∥∥ : isFinSet ∥ X .fst ∥ isFinSet∥∥ = Prop.rec isPropIsFinSet (λ p → isFinOrd→isFinSet (isFinOrd∥∥ (X .fst) (_ , p))) (X .snd .snd) isFinSetIsContr : isFinSet (isContr (X .fst)) isFinSetIsContr = isFinSetΣ X (λ x → _ , (isFinSetΠ X (λ y → _ , isFinSet≡ x y))) isFinSetIsProp : isFinSet (isProp (X .fst)) isFinSetIsProp = isFinSetΠ2 X (λ _ → X) (λ x x' → _ , isFinSet≡ x x') module _ (X : FinSet ℓ ) (Y : FinSet ℓ') (f : X .fst → Y .fst) where isFinSetFiber : (y : Y .fst) → isFinSet (fiber f y) isFinSetFiber y = isFinSetΣ X (λ x → _ , isFinSet≡ Y (f x) y) isFinSetIsEquiv : isFinSet (isEquiv f) isFinSetIsEquiv = EquivPresIsFinSet (invEquiv (isEquiv≃isEquiv' f)) (isFinSetΠ Y (λ y → _ , isFinSetIsContr (_ , isFinSetFiber y))) module _ (X : FinSet ℓ ) (Y : FinSet ℓ') where isFinSet⊎ : isFinSet (X .fst ⊎ Y .fst) isFinSet⊎ = card X + card Y , map2 (λ p q → isFinOrd⊎ (X .fst) (_ , p) (Y .fst) (_ , q) .snd) (X .snd .snd) (Y .snd .snd) isFinSet× : isFinSet (X .fst × Y .fst) isFinSet× = card X · card Y , map2 (λ p q → isFinOrd× (X .fst) (_ , p) (Y .fst) (_ , q) .snd) (X .snd .snd) (Y .snd .snd) isFinSet→ : isFinSet (X .fst → Y .fst) isFinSet→ = isFinSetΠ X (λ _ → Y) isFinSet≃ : isFinSet (X .fst ≃ Y .fst) isFinSet≃ = isFinSetΣ (_ , isFinSet→) (λ f → _ , isFinSetIsEquiv X Y f) module _ (X Y : FinSet ℓ ) where isFinSetType≡ : isFinSet (X .fst ≡ Y .fst) isFinSetType≡ = EquivPresIsFinSet (invEquiv univalence) (isFinSet≃ X Y) module _ (X : FinSet ℓ) where isFinSetAut : isFinSet (X .fst ≃ X .fst) isFinSetAut = LehmerCode.factorial (card X) , Prop.map (λ p → isFinOrd≃ (X .fst) (card X , p) .snd) (X .snd .snd) isFinSetTypeAut : isFinSet (X .fst ≡ X .fst) isFinSetTypeAut = EquivPresIsFinSet (invEquiv univalence) isFinSetAut module _ (X : FinSet ℓ) where isFinSet¬ : isFinSet (¬ (X .fst)) isFinSet¬ = isFinSet→ X (Fin 0 , isFinSetFin) module _ (X : FinSet ℓ) where isFinSetNonEmpty : isFinSet (NonEmpty (X .fst)) isFinSetNonEmpty = isFinSet¬ (_ , isFinSet¬ X) module _ (X : FinSet ℓ ) (Y : FinSet ℓ') (f : X .fst → Y .fst) where isFinSetIsEmbedding : isFinSet (isEmbedding f) isFinSetIsEmbedding = isFinSetΠ2 X (λ _ → X) (λ a b → _ , isFinSetIsEquiv (_ , isFinSet≡ X a b) (_ , isFinSet≡ Y (f a) (f b)) (cong f)) isFinSetIsSurjection : isFinSet (isSurjection f) isFinSetIsSurjection = isFinSetΠ Y (λ y → _ , isFinSet∥∥ (_ , isFinSetFiber X Y f y)) module _ (X : FinSet ℓ ) (Y : FinSet ℓ') where isFinSet↪ : isFinSet (X .fst ↪ Y .fst) isFinSet↪ = isFinSetΣ (_ , isFinSet→ X Y) (λ f → _ , isFinSetIsEmbedding X Y f) isFinSet↠ : isFinSet (X .fst ↠ Y .fst) isFinSet↠ = isFinSetΣ (_ , isFinSet→ X Y) (λ f → _ , isFinSetIsSurjection X Y f) -- a criterion of being finite set module _ (X : Type ℓ)(Y : FinSet ℓ') (f : X → Y .fst) (h : (y : Y .fst) → isFinSet (fiber f y)) where isFinSetTotal : isFinSet X isFinSetTotal = EquivPresIsFinSet (invEquiv (totalEquiv f)) (isFinSetΣ Y (λ y → _ , h y)) -- a criterion of fibers being finite sets, more general than the previous result module _ (X : FinSet ℓ) (Y : Type ℓ')(h : Discrete Y) (f : X. fst → Y) where isFinSetFiberDisc : (y : Y) → isFinSet (fiber f y) isFinSetFiberDisc y = isFinSetΣ X (λ x → _ , isDecProp→isFinSet (Discrete→isSet h _ _) (h (f x) y))
programs/oeis/176/A176900.asm
karttu/loda
1
27794
<filename>programs/oeis/176/A176900.asm ; A176900: sin((2*n+5)*Pi/6)*(n+1)*2^(n+1) ; 1,-4,-24,-32,80,384,448,-1024,-4608,-5120,11264,49152,53248,-114688,-491520,-524288,1114112,4718592,4980736,-10485760,-44040192,-46137344,96468992,402653184,419430400,-872415232,-3623878656,-3758096384 mov $2,$0 sub $2,1 mov $1,$2 add $1,2 cal $0,128018 ; Expansion of (1-4*x)/(1-2*x+4*x^2). mul $1,$0
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w27.asm
prismotizm/gigaleak
0
12893
<reponame>prismotizm/gigaleak Name: ys_w27.asm Type: file Size: 22875 Last-Modified: '2016-05-13T04:51:15Z' SHA-1: 55CDBA4BC5E98CD5309173F7F66D8A6C6343373F Description: null
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_232.asm
ljhsiun2/medusa
9
25347
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r15 push %r8 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0xf461, %rdi dec %r15 movups (%rdi), %xmm1 vpextrq $1, %xmm1, %rax nop nop nop nop nop add %r8, %r8 lea addresses_WT_ht+0x12c61, %r15 nop nop nop nop add $44731, %r10 mov $0x6162636465666768, %r12 movq %r12, %xmm7 movups %xmm7, (%r15) nop add %r8, %r8 lea addresses_normal_ht+0x65fc, %rdi xor $36934, %rbx mov (%rdi), %r8w nop nop nop xor %r12, %r12 lea addresses_UC_ht+0x321f, %r10 nop cmp %r12, %r12 movw $0x6162, (%r10) nop nop and %rdi, %rdi lea addresses_WC_ht+0x17931, %rsi lea addresses_WT_ht+0x1de61, %rdi clflush (%rdi) nop nop dec %r10 mov $88, %rcx rep movsq dec %rax lea addresses_D_ht+0x9e8b, %rbx nop nop nop add %r15, %r15 mov (%rbx), %r12d nop nop nop nop nop dec %rdi lea addresses_D_ht+0x1c661, %r15 nop nop nop nop cmp %rdi, %rdi movb (%r15), %al nop add $10978, %rsi lea addresses_UC_ht+0x16061, %rax xor $22653, %rsi mov $0x6162636465666768, %r8 movq %r8, %xmm2 and $0xffffffffffffffc0, %rax movntdq %xmm2, (%rax) nop nop nop nop nop dec %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r15 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rbx push %rcx push %rdx // Load lea addresses_US+0x6b21, %r14 clflush (%r14) nop xor %r10, %r10 mov (%r14), %r11d nop nop nop nop and %r14, %r14 // Load lea addresses_WT+0x12ae1, %r14 add $25091, %r12 vmovups (%r14), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %rbx nop nop nop nop nop sub $19884, %rbx // Faulty Load lea addresses_UC+0xdc61, %rdx nop and $56164, %rcx movb (%rdx), %r14b lea oracles, %r10 and $0xff, %r14 shlq $12, %r14 mov (%r10,%r14,1), %r14 pop %rdx pop %rcx pop %rbx pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 2}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Working Disassembly/Levels/LRZ/Misc Object Data/Map - Chained Platforms.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
21898
dc.w word_4A982-Map_LRZChainedPlatforms word_4A982: dc.w 6 ; DATA XREF: ROM:0004A980o dc.b $E8, 9, 0, $57, $FF, $E8 dc.b $E8, 9, 8, $57, 0, 0 dc.b $F8, 9, 0, $57, $FF, $E8 dc.b $F8, 9, 8, $57, 0, 0 dc.b 8, 9, 0, $5D, $FF, $E8 dc.b 8, 9, 8, $5D, 0, 0
alloy4fun_models/trashltl/models/8/vqLsvTJBsSbSHMXga.als
Kaixi26/org.alloytools.alloy
0
3594
<reponame>Kaixi26/org.alloytools.alloy<gh_stars>0 open main pred idvqLsvTJBsSbSHMXga_prop9 { all f: File | always(f in Protected implies always f not in Trash) } pred __repair { idvqLsvTJBsSbSHMXga_prop9 } check __repair { idvqLsvTJBsSbSHMXga_prop9 <=> prop9o }
Tareas/Ensamblador/tasm/BIN/graph.asm
TEC-2014092195/IC3101-Arquitectura_De_Computadores
0
96521
; *************************************************** ; Asterisco rebotador en la pantalla ; *************************************************** Pila Segment Stack 'Stack' dw 2048 dup(?) Pila Ends Datos Segment FIL DB 0 COL DB 0 DIR DB 4 ASTERIX DB '*' ; Fondo negro y asterisco verde CLARO ->0AH PAUSA1 dw 300 PAUSA2 dw 300 ; En total hace de pausa 10000x2000=20 000 000 de nops Text db 'texto$' Datos Ends Codigo Segment Assume DS:Datos,CS:Codigo,SS:Pila Inicio: ; INT 10h / AH = 0 - configurar modo de video. ; AL = modo de video deseado. ; 00h - modo texto. 40x25. 16 colores. 8 paginas. ; 03h - modo texto. 80x25. 16 colores. 8 paginas. ; 13h - modo grafico. 40x25. 256 colores. ; 320x200 pixeles. 1 pagina. mov ax,0013h int 10h mov ax, 0A000h mov ds, ax ; DS = A000h (memoria de graficos). ; ============== Lineas verticales ====================== ; Queremos pintar 256 colummas, cada una con un alto de ; 200 pixeles. Podemos ejecutar 51,200 ciclos. ; Como la memoria de graficos es lineal, es mejor pintar ; una fila a la vez, cada fila tiene 320 columnas, pero ; solo pintamos 256. Al llegar a la columna 256 saltamos ; a la siguiente fila sumando 320-256 = 64 ; Cada pixel cambia de color para dar el efecto de lineas ; verticales mov cx,0C800h ; # de pixeles xor dx,dx ; contador de columnas y color xor di,di ; ciclo_1: ; mov [di], dx ; poner color en A000:DI ; inc di ; inc dx ; cmp dx,256 ; jne sig_pix1 ; add di,0040h ; saltar al inicio de siguiente fila ; xor dx,dx ; reiniciar columnas y color ; sig_pix1: ; loop ciclo_1 ;INT 10 - AH = 09h VIDEO - WRITE ATTRIBUTES/CHARACTERS AT CURSOR POS MOV AH,09H MOV AL ,'*' MOV BH ,00h ;Screen Page MOV BL ,001010b ;Color (graphics mode) ;MOV DX, 0FH ;row number (y coordinate) MOV CX ,01h int 10h ;INT 10 - AH = 02h VIDEO - SET CURSOR POSITION http://mprolab.teipir.gr/vivlio80X86/dosints.pdf MOV AH,02h MOV DH,0h MOV DL,0h int 10h ;INT 10 - AH = 0Eh VIDEO - WRITE CHARACTER AND ADVANCE CURSOR (TTY WRITE) http://mprolab.teipir.gr/vivlio80X86/dosints.pdf ;AL = character MOV AH,0Eh MOV AL,2Ah MOV BH,00h MOV BL,18h MOV CX,0F0h int 10h MOV AH,0Eh MOV AL,2Ah MOV BH,00h MOV BL,19h MOV CX,0F0h int 10h ; Video Palette INT 10h AX = 1010h ;------------------------------------------ ;Modify the palette of one color. ;BX = color number ;ch = green ;cl = blue ;dh = red ;------------------------------------------ MOV AX,1010h MOV BL,18h MOV ch,0Fh MOV CL,0H MOV DH,0h INT 10h MOV AX,1010h MOV BL,19h MOV ch,0FFh MOV CL,0Fh MOV DH,0Fh INT 10h ; esperar por tecla mov ah,10h int 16h ; regresar a modo texto mov ax,0003h int 10h ; finalizar el programa mov ax,4c00h int 21h ret Codigo ENDS END Inicio
engine/events/card_key.asm
Dev727/ancientplatinum
28
83572
<filename>engine/events/card_key.asm _CardKey: ; Are we even in the right map to use this? ld a, [wMapGroup] cp GROUP_RADIO_TOWER_3F jr nz, .nope ld a, [wMapNumber] cp MAP_RADIO_TOWER_3F jr nz, .nope ; Are we facing the slot? ld a, [wPlayerDirection] and %1100 cp OW_UP jr nz, .nope call GetFacingTileCoord ld a, d cp 18 jr nz, .nope ld a, e cp 6 jr nz, .nope ; Let's use the Card Key. ld hl, .CardKeyScript call QueueScript ld a, TRUE ld [wItemEffectSucceeded], a ret .nope ld a, FALSE ld [wItemEffectSucceeded], a ret .CardKeyScript: closetext farsjump CardKeySlotScript
programs/oeis/131/A131478.asm
karttu/loda
1
23311
<filename>programs/oeis/131/A131478.asm ; A131478: a(n) = ceiling(n^4/4). ; 0,1,4,21,64,157,324,601,1024,1641,2500,3661,5184,7141,9604,12657,16384,20881,26244,32581,40000,48621,58564,69961,82944,97657,114244,132861,153664,176821,202500,230881,262144,296481,334084,375157,419904,468541,521284,578361,640000,706441,777924,854701,937024,1025157,1119364,1219921,1327104,1441201,1562500,1691301,1827904,1972621,2125764,2287657,2458624,2639001,2829124,3029341,3240000,3461461,3694084,3938241,4194304,4462657,4743684,5037781,5345344,5666781,6002500,6352921,6718464,7099561,7496644,7910157,8340544,8788261,9253764,9737521,10240000,10761681,11303044,11864581,12446784,13050157,13675204,14322441,14992384,15685561,16402500,17143741,17909824,18701301,19518724,20362657,21233664,22132321,23059204,24014901,25000000,26015101,27060804,28137721,29246464,30387657,31561924,32769901,34012224,35289541,36602500,37951761,39337984,40761841,42224004,43725157,45265984,46847181,48469444,50133481,51840000,53589721,55383364,57221661,59105344,61035157,63011844,65036161,67108864,69230721,71402500,73624981,75898944,78225181,80604484,83037657,85525504,88068841,90668484,93325261,96040000,98813541,101646724,104540401,107495424,110512657,113592964,116737221,119946304,123221101,126562500,129971401,133448704,136995321,140612164,144300157,148060224,151893301,155800324,159782241,163840000,167974561,172186884,176477941,180848704,185300157,189833284,194449081,199148544,203932681,208802500,213759021,218803264,223936261,229159044,234472657,239878144,245376561,250968964,256656421,262440000,268320781,274299844,280378281,286557184,292837657,299220804,305707741,312299584,318997461,325802500,332715841,339738624,346872001,354117124,361475157,368947264,376534621,384238404,392059801,400000000,408060201,416241604,424545421,432972864,441525157,450203524,459009201,467943424,477007441,486202500,495529861,504990784,514586541,524318404,534187657,544195584,554343481,564632644,575064381,585640000,596360821,607228164,618243361,629407744,640722657,652189444,663809461,675584064,687514621,699602500,711849081,724255744,736823881,749554884,762450157,775511104,788739141,802135684,815702161,829440000,843350641,857435524,871696101,886133824,900750157,915546564,930524521,945685504,961031001 mov $1,$0 pow $1,4 add $1,7 div $1,4 sub $1,1
programs/oeis/245/A245087.asm
karttu/loda
0
167934
; A245087: Largest number such that 2^a(n) is a divisor of (n!)!. ; 0,0,1,4,22,116,716,5034,40314,362874,3628789,39916793,479001588,6227020788,87178291188,1307674367982,20922789887982,355687428095978,6402373705727977 mov $3,1 mov $2,$0 lpb $3,1 fac $2 lpb $2,1 div $2,2 sub $3,$0 add $1,$2 lpe lpe
ThueMorse.agda
nad/codata
1
17160
<reponame>nad/codata ------------------------------------------------------------------------ -- An implementation of the Thue-Morse sequence ------------------------------------------------------------------------ -- The paper "Productivity of stream definitions" by Endrullis et al. -- (TCS 2010) uses a certain definition of the Thue-Morse sequence as -- a running example. -- Note that the code below makes use of the fact that Agda's -- termination checker allows "swapping of arguments", which was not -- mentioned when the termination checker was described in the paper -- "Beating the Productivity Checker Using Embedded Languages". -- However, it is easy to rewrite the code into a form which does not -- make use of swapping, at the cost of some code duplication. module ThueMorse where open import Codata.Musical.Notation open import Codata.Musical.Stream as S using (Stream; _≈_) open S.Stream; open S._≈_ open import Data.Bool using (Bool; not); open Data.Bool.Bool open import Function open import Relation.Binary import Relation.Binary.PropositionalEquality as P import Relation.Binary.Reasoning.Setoid as EqReasoning private module SS {A : Set} = Setoid (S.setoid A) open module SR {A : Set} = EqReasoning (S.setoid A) using (begin_; _∎) ------------------------------------------------------------------------ -- Chunks -- A value of type Chunks describes how a stream is generated. Note -- that an infinite sequence of empty chunks is not allowed. data Chunks : Set where -- Start the next chunk. next : (m : Chunks) → Chunks -- Cons an element to the current chunk. cons : (m : ∞ Chunks) → Chunks -- Equality of chunks. infix 4 _≈C_ data _≈C_ : Chunks → Chunks → Set where next : ∀ {m m′} (m≈m′ : m ≈C m′ ) → next m ≈C next m′ cons : ∀ {m m′} (m≈m′ : ∞ (♭ m ≈C ♭ m′)) → cons m ≈C cons m′ ------------------------------------------------------------------------ -- Chunk transformers tailC : Chunks → Chunks tailC (next m) = next (tailC m) tailC (cons m) = ♭ m mutual evensC : Chunks → Chunks evensC (next m) = next (evensC m) evensC (cons m) = cons (♯ oddsC (♭ m)) oddsC : Chunks → Chunks oddsC (next m) = next (oddsC m) oddsC (cons m) = evensC (♭ m) infixr 5 _⋎C_ -- Note that care is taken to create as few and large chunks as -- possible (see also _⋎W_). _⋎C_ : Chunks → Chunks → Chunks next m ⋎C next m′ = next (m ⋎C m′) -- Two chunks in, one out. next m ⋎C cons m′ = next (m ⋎C cons m′) cons m ⋎C m′ = cons (♯ (m′ ⋎C ♭ m)) ------------------------------------------------------------------------ -- Stream programs -- StreamP m A encodes programs which generate streams with chunk -- sizes given by m. infixr 5 _∷_ _⋎_ data StreamP : Chunks → Set → Set₁ where [_] : ∀ {m A} (xs : ∞ (StreamP m A)) → StreamP (next m) A _∷_ : ∀ {m A} (x : A) (xs : StreamP (♭ m) A) → StreamP (cons m) A tail : ∀ {m A} (xs : StreamP m A) → StreamP (tailC m) A evens : ∀ {m A} (xs : StreamP m A) → StreamP (evensC m) A odds : ∀ {m A} (xs : StreamP m A) → StreamP (oddsC m) A _⋎_ : ∀ {m m′ A} (xs : StreamP m A) (ys : StreamP m′ A) → StreamP (m ⋎C m′) A map : ∀ {m A B} (f : A → B) (xs : StreamP m A) → StreamP m B cast : ∀ {m m′ A} (ok : m ≈C m′) (xs : StreamP m A) → StreamP m′ A data StreamW : Chunks → Set → Set₁ where [_] : ∀ {m A} (xs : StreamP m A) → StreamW (next m) A _∷_ : ∀ {m A} (x : A) (xs : StreamW (♭ m) A) → StreamW (cons m) A program : ∀ {m A} → StreamW m A → StreamP m A program [ xs ] = [ ♯ xs ] program (x ∷ xs) = x ∷ program xs tailW : ∀ {m A} → StreamW m A → StreamW (tailC m) A tailW [ xs ] = [ tail xs ] tailW (x ∷ xs) = xs mutual evensW : ∀ {m A} → StreamW m A → StreamW (evensC m) A evensW [ xs ] = [ evens xs ] evensW (x ∷ xs) = x ∷ oddsW xs oddsW : ∀ {m A} → StreamW m A → StreamW (oddsC m) A oddsW [ xs ] = [ odds xs ] oddsW (x ∷ xs) = evensW xs infixr 5 _⋎W_ -- Note: Uses swapping of arguments. _⋎W_ : ∀ {m m′ A} → StreamW m A → StreamW m′ A → StreamW (m ⋎C m′) A [ xs ] ⋎W [ ys ] = [ xs ⋎ ys ] [ xs ] ⋎W (y ∷ ys) = [ xs ⋎ program (y ∷ ys) ] (x ∷ xs) ⋎W ys = x ∷ ys ⋎W xs mapW : ∀ {m A B} → (A → B) → StreamW m A → StreamW m B mapW f [ xs ] = [ map f xs ] mapW f (x ∷ xs) = f x ∷ mapW f xs castW : ∀ {m m′ A} → m ≈C m′ → StreamW m A → StreamW m′ A castW (next m≈m′) [ xs ] = [ cast m≈m′ xs ] castW (cons m≈m′) (x ∷ xs) = x ∷ castW (♭ m≈m′) xs whnf : ∀ {m A} → StreamP m A → StreamW m A whnf [ xs ] = [ ♭ xs ] whnf (x ∷ xs) = x ∷ whnf xs whnf (tail xs) = tailW (whnf xs) whnf (evens xs) = evensW (whnf xs) whnf (odds xs) = oddsW (whnf xs) whnf (xs ⋎ ys) = whnf xs ⋎W whnf ys whnf (map f xs) = mapW f (whnf xs) whnf (cast m≈m′ xs) = castW m≈m′ (whnf xs) mutual ⟦_⟧W : ∀ {m A} → StreamW m A → Stream A ⟦ [ xs ] ⟧W = ⟦ xs ⟧P ⟦ x ∷ xs ⟧W = x ∷ ♯ ⟦ xs ⟧W ⟦_⟧P : ∀ {m A} → StreamP m A → Stream A ⟦ xs ⟧P = ⟦ whnf xs ⟧W ------------------------------------------------------------------------ -- The Thue-Morse sequence [ccn]ω : Chunks [ccn]ω = cons (♯ cons (♯ next [ccn]ω)) [cn]²[ccn]ω : Chunks [cn]²[ccn]ω = cons (♯ next (cons (♯ next [ccn]ω))) [cn]³[ccn]ω : Chunks [cn]³[ccn]ω = cons (♯ next [cn]²[ccn]ω) -- Explanation of the proof of lemma₁: -- -- odds [ccn]ω ≈ [cn]ω -- -- [cn]ω ⋎ [ccn]ω ≈ -- c ([ccn]ω ⋎ n[cn]ω) ≈ -- c c (n[cn]ω ⋎ cn[ccn]ω) ≈ -- c c n ([cn]ω ⋎ cn[ccn]ω) ≈ -- c c n c (cn[ccn]ω ⋎ n[cn]ω) ≈ -- c c n c c (n[cn]ω ⋎ n[ccn]ω) ≈ -- c c n c c n ([cn]ω ⋎ [ccn]ω) lemma₁ : oddsC [ccn]ω ⋎C [ccn]ω ≈C [ccn]ω lemma₁ = cons (♯ cons (♯ next (cons (♯ cons (♯ next lemma₁))))) -- Explanation of the proof of lemma: -- -- evens [cn]³[ccn]ω ≈ cnn[cn]ω -- tail [cn]³[ccn]ω ≈ n[cn]²[ccn]ω -- -- cnn[cn]ω ⋎ n[cn]²[ccn]ω ≈ -- c (n[cn]²[ccn]ω ⋎ nn[cn]ω) ≈ -- c n ([cn]²[ccn]ω ⋎ n[cn]ω) ≈ -- c n c (n[cn]ω ⋎ ncn[ccn]ω) ≈ -- c n c n ([cn]ω ⋎ cn[ccn]ω) ≈ -- c n c n c (cn[ccn]ω ⋎ n[cn]ω) ≈ -- c n c n c c (n[cn]ω ⋎ n[ccn]ω) ≈ -- c n c n c c n ([cn]ω ⋎ [ccn]ω) lemma : evensC [cn]³[ccn]ω ⋎C tailC [cn]³[ccn]ω ≈C [cn]²[ccn]ω lemma = cons (♯ next (cons (♯ next (cons (♯ cons (♯ next lemma₁)))))) thueMorse : StreamP [cn]³[ccn]ω Bool thueMorse = false ∷ [ ♯ cast lemma (map not (evens thueMorse) ⋎ tail thueMorse) ] ------------------------------------------------------------------------ -- Equality programs infix 4 _≈[_]P_ _≈[_]W_ infixr 2 _≈⟨_⟩P_ _≈⟨_⟩_ data _≈[_]P_ : {A : Set} → Stream A → Chunks → Stream A → Set₁ where [_] : ∀ {m A} {xs ys : Stream A} (xs≈ys : ∞ (xs ≈[ m ]P ys)) → xs ≈[ next m ]P ys _∷_ : ∀ {m A} (x : A) {xs ys} (xs≈ys : ♭ xs ≈[ ♭ m ]P ♭ ys) → x ∷ xs ≈[ cons m ]P x ∷ ys tail : ∀ {m A} {xs ys : Stream A} (xs≈ys : xs ≈[ m ]P ys) → S.tail xs ≈[ tailC m ]P S.tail ys evens : ∀ {m A} {xs ys : Stream A} (xs≈ys : xs ≈[ m ]P ys) → S.evens xs ≈[ evensC m ]P S.evens ys odds : ∀ {m A} {xs ys : Stream A} (xs≈ys : xs ≈[ m ]P ys) → S.odds xs ≈[ oddsC m ]P S.odds ys _⋎_ : ∀ {m m′ A} {xs xs′ ys ys′ : Stream A} (xs≈ys : xs ≈[ m ]P ys) (xs′≈ys′ : xs′ ≈[ m′ ]P ys′) → (xs ⟨ S._⋎_ ⟩ xs′) ≈[ m ⋎C m′ ]P (ys ⟨ S._⋎_ ⟩ ys′) map : ∀ {m A B} (f : A → B) {xs ys : Stream A} (xs≈ys : xs ≈[ m ]P ys) → S.map f xs ≈[ m ]P S.map f ys cast : ∀ {m m′ A} (ok : m ≈C m′) {xs ys : Stream A} (xs≈ys : xs ≈[ m ]P ys) → xs ≈[ m′ ]P ys _≈⟨_⟩P_ : ∀ {m A} xs {ys zs : Stream A} (xs≈ys : xs ≈[ m ]P ys) (ys≈zs : ys ≈ zs) → xs ≈[ m ]P zs _≈⟨_⟩_ : ∀ {m A} xs {ys zs : Stream A} (xs≈ys : xs ≈ ys) (ys≈zs : ys ≈[ m ]P zs) → xs ≈[ m ]P zs data _≈[_]W_ : {A : Set} → Stream A → Chunks → Stream A → Set₁ where [_] : ∀ {m A} {xs ys : Stream A} (xs≈ys : xs ≈[ m ]P ys) → xs ≈[ next m ]W ys _∷_ : ∀ {m A} (x : A) {xs ys} (xs≈ys : ♭ xs ≈[ ♭ m ]W ♭ ys) → x ∷ xs ≈[ cons m ]W x ∷ ys program≈ : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]W ys → xs ≈[ m ]P ys program≈ [ xs≈ys ] = [ ♯ xs≈ys ] program≈ (x ∷ xs≈ys) = x ∷ program≈ xs≈ys tail-congW : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]W ys → S.tail xs ≈[ tailC m ]W S.tail ys tail-congW [ xs≈ys ] = [ tail xs≈ys ] tail-congW (x ∷ xs≈ys) = xs≈ys mutual evens-congW : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]W ys → S.evens xs ≈[ evensC m ]W S.evens ys evens-congW [ xs≈ys ] = [ evens xs≈ys ] evens-congW (x ∷ xs≈ys) = x ∷ odds-congW xs≈ys odds-congW : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]W ys → S.odds xs ≈[ oddsC m ]W S.odds ys odds-congW [ xs≈ys ] = [ odds xs≈ys ] odds-congW (x ∷ xs≈ys) = evens-congW xs≈ys infixr 5 _⋎-congW_ -- Note: Uses swapping of arguments. _⋎-congW_ : ∀ {m m′ A} {xs xs′ ys ys′ : Stream A} → xs ≈[ m ]W ys → xs′ ≈[ m′ ]W ys′ → (xs ⟨ S._⋎_ ⟩ xs′) ≈[ m ⋎C m′ ]W (ys ⟨ S._⋎_ ⟩ ys′) [ xs≈ys ] ⋎-congW [ xs′≈ys′ ] = [ xs≈ys ⋎ xs′≈ys′ ] [ xs≈ys ] ⋎-congW (y ∷ xs′≈ys′) = [ xs≈ys ⋎ program≈ (y ∷ xs′≈ys′) ] (x ∷ xs≈ys) ⋎-congW xs′≈ys′ = x ∷ xs′≈ys′ ⋎-congW xs≈ys map-congW : ∀ {m A B} (f : A → B) {xs ys : Stream A} → xs ≈[ m ]W ys → S.map f xs ≈[ m ]W S.map f ys map-congW f [ xs≈ys ] = [ map f xs≈ys ] map-congW f (x ∷ xs≈ys) = f x ∷ map-congW f xs≈ys cast-congW : ∀ {m m′ A} (ok : m ≈C m′) {xs ys : Stream A} → xs ≈[ m ]W ys → xs ≈[ m′ ]W ys cast-congW (next m≈m′) [ xs≈ys ] = [ cast m≈m′ xs≈ys ] cast-congW (cons m≈m′) (x ∷ xs≈ys) = x ∷ cast-congW (♭ m≈m′) xs≈ys transPW : ∀ {m A} {xs ys zs : Stream A} → xs ≈[ m ]W ys → ys ≈ zs → xs ≈[ m ]W zs transPW [ xs≈ys ] ys≈zs = [ _ ≈⟨ xs≈ys ⟩P ys≈zs ] transPW (x ∷ xs≈ys) (P.refl ∷ ys≈zs) = x ∷ transPW xs≈ys (♭ ys≈zs) transW : ∀ {m A} {xs ys zs : Stream A} → xs ≈ ys → ys ≈[ m ]W zs → xs ≈[ m ]W zs transW (x ∷ xs≈ys) [ ys≈zs ] = [ _ ≈⟨ x ∷ xs≈ys ⟩ ys≈zs ] transW (P.refl ∷ xs≈ys) (x ∷ ys≈zs) = x ∷ transW (♭ xs≈ys) ys≈zs whnf≈ : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]P ys → xs ≈[ m ]W ys whnf≈ [ xs ] = [ ♭ xs ] whnf≈ (x ∷ xs) = x ∷ whnf≈ xs whnf≈ (tail xs) = tail-congW (whnf≈ xs) whnf≈ (evens xs) = evens-congW (whnf≈ xs) whnf≈ (odds xs) = odds-congW (whnf≈ xs) whnf≈ (xs ⋎ ys) = whnf≈ xs ⋎-congW whnf≈ ys whnf≈ (map f xs) = map-congW f (whnf≈ xs) whnf≈ (cast m≈m′ xs) = cast-congW m≈m′ (whnf≈ xs) whnf≈ (xs ≈⟨ xs≈ys ⟩P ys≈zs) = transPW (whnf≈ xs≈ys) ys≈zs whnf≈ (xs ≈⟨ xs≈ys ⟩ ys≈zs) = transW xs≈ys (whnf≈ ys≈zs) mutual soundW : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]W ys → xs ≈ ys soundW [ xs≈ys ] = soundP xs≈ys soundW (x ∷ xs≈ys) = P.refl ∷ ♯ soundW xs≈ys soundP : ∀ {m A} {xs ys : Stream A} → xs ≈[ m ]P ys → xs ≈ ys soundP xs≈ys = soundW (whnf≈ xs≈ys) ------------------------------------------------------------------------ -- The definition is correct -- The proof consists mostly of boiler-plate code. program-hom : ∀ {m A} (xs : StreamW m A) → ⟦ program xs ⟧P ≈ ⟦ xs ⟧W program-hom [ xs ] = SS.refl program-hom (x ∷ xs) = P.refl ∷ ♯ program-hom xs mutual tailW-hom : ∀ {A : Set} {m} (xs : StreamW m A) → ⟦ tailW xs ⟧W ≈ S.tail ⟦ xs ⟧W tailW-hom [ xs ] = tail-hom xs tailW-hom (x ∷ xs) = SS.refl tail-hom : ∀ {A : Set} {m} (xs : StreamP m A) → ⟦ tail xs ⟧P ≈ S.tail ⟦ xs ⟧P tail-hom xs = tailW-hom (whnf xs) mutual infixr 5 _⋎W-hom_ _⋎-hom_ -- Note: Uses swapping of arguments. _⋎W-hom_ : ∀ {A : Set} {m m′} (xs : StreamW m A) (ys : StreamW m′ A) → ⟦ xs ⋎W ys ⟧W ≈[ m ⋎C m′ ]P (⟦ xs ⟧W ⟨ S._⋎_ ⟩ ⟦ ys ⟧W) (x ∷ xs) ⋎W-hom ys = x ∷ ys ⋎W-hom xs [ xs ] ⋎W-hom [ ys ] = [ ♯ (xs ⋎-hom ys) ] [ xs ] ⋎W-hom (y ∷ ys′) = [ ♯ (⟦ xs ⋎ program ys ⟧P ≈⟨ xs ⋎-hom program ys ⟩P (begin (⟦ xs ⟧P ⟨ S._⋎_ ⟩ ⟦ program ys ⟧P) SR.≈⟨ SS.refl ⟨ S._⋎-cong_ ⟩ program-hom ys ⟩ (⟦ xs ⟧P ⟨ S._⋎_ ⟩ ⟦ ys ⟧W) ∎)) ] where ys = y ∷ ys′ _⋎-hom_ : ∀ {A : Set} {m m′} (xs : StreamP m A) (ys : StreamP m′ A) → ⟦ xs ⋎ ys ⟧P ≈[ m ⋎C m′ ]P (⟦ xs ⟧P ⟨ S._⋎_ ⟩ ⟦ ys ⟧P) xs ⋎-hom ys = whnf xs ⋎W-hom whnf ys mutual evensW-hom : ∀ {A : Set} {m} (xs : StreamW m A) → ⟦ evensW xs ⟧W ≈ S.evens ⟦ xs ⟧W evensW-hom [ xs ] = evens-hom xs evensW-hom (x ∷ xs) = P.refl ∷ ♯ oddsW-hom xs evens-hom : ∀ {A : Set} {m} (xs : StreamP m A) → ⟦ evens xs ⟧P ≈ S.evens ⟦ xs ⟧P evens-hom xs = evensW-hom (whnf xs) oddsW-hom : ∀ {A : Set} {m} (xs : StreamW m A) → ⟦ oddsW xs ⟧W ≈ S.odds ⟦ xs ⟧W oddsW-hom [ xs ] = odds-hom xs oddsW-hom (x ∷ xs) = evensW-hom xs odds-hom : ∀ {A : Set} {m} (xs : StreamP m A) → ⟦ odds xs ⟧P ≈ S.odds ⟦ xs ⟧P odds-hom xs = oddsW-hom (whnf xs) mutual mapW-hom : ∀ {A B : Set} {m} (f : A → B) (xs : StreamW m A) → ⟦ mapW f xs ⟧W ≈ S.map f ⟦ xs ⟧W mapW-hom f [ xs ] = map-hom f xs mapW-hom f (x ∷ xs) = P.refl ∷ ♯ mapW-hom f xs map-hom : ∀ {A B : Set} {m} (f : A → B) (xs : StreamP m A) → ⟦ map f xs ⟧P ≈ S.map f ⟦ xs ⟧P map-hom f xs = mapW-hom f (whnf xs) mutual castW-hom : ∀ {m m′ A} (m≈m′ : m ≈C m′) (xs : StreamW m A) → ⟦ castW m≈m′ xs ⟧W ≈ ⟦ xs ⟧W castW-hom (next m≈m′) [ xs ] = cast-hom m≈m′ xs castW-hom (cons m≈m′) (x ∷ xs) = P.refl ∷ ♯ castW-hom (♭ m≈m′) xs cast-hom : ∀ {m m′ A} (m≈m′ : m ≈C m′) (xs : StreamP m A) → ⟦ cast m≈m′ xs ⟧P ≈ ⟦ xs ⟧P cast-hom m≈m′ xs = castW-hom m≈m′ (whnf xs) -- The intended definition of the Thue-Morse sequence is bs = rhs bs. rhs : Stream Bool → Stream Bool rhs bs = false ∷ ♯ (S.map not (S.evens bs) ⟨ S._⋎_ ⟩ S.tail bs) -- The definition above satisfies the intended defining equation. correct : ⟦ thueMorse ⟧P ≈[ [cn]³[ccn]ω ]P rhs ⟦ thueMorse ⟧P correct = false ∷ [ ♯ cast lemma ( ⟦ cast lemma (map not (evens thueMorse) ⋎ tail thueMorse) ⟧P ≈⟨ cast-hom lemma (map not (evens thueMorse) ⋎ tail thueMorse) ⟩ ⟦ map not (evens thueMorse) ⋎ tail thueMorse ⟧P ≈⟨ map not (evens thueMorse) ⋎-hom tail thueMorse ⟩P (begin (⟦ map not (evens thueMorse) ⟧P ⟨ S._⋎_ ⟩ ⟦ tail thueMorse ⟧P) SR.≈⟨ SS.trans (map-hom not (evens thueMorse)) (S.map-cong not (evens-hom thueMorse)) ⟨ S._⋎-cong_ ⟩ tail-hom thueMorse ⟩ (S.map not (S.evens ⟦ thueMorse ⟧P) ⟨ S._⋎_ ⟩ S.tail ⟦ thueMorse ⟧P) ∎ )) ] -- The defining equation has at most one solution. unique : ∀ bs bs′ → bs ≈ rhs bs → bs′ ≈ rhs bs′ → bs ≈[ [cn]³[ccn]ω ]P bs′ unique bs bs′ bs≈ bs′≈ = bs ≈⟨ bs≈ ⟩ rhs bs ≈⟨ false ∷ [ ♯ cast lemma (map not (evens (unique bs bs′ bs≈ bs′≈)) ⋎ tail (unique bs bs′ bs≈ bs′≈)) ] ⟩P (begin rhs bs′ SR.≈⟨ SS.sym bs′≈ ⟩ bs′ ∎)
programs/oeis/141/A141425.asm
neoneye/loda
22
13151
<filename>programs/oeis/141/A141425.asm ; A141425: Period 6: repeat [1, 2, 4, 5, 7, 8]. ; 1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5,7,8,1,2,4,5 mod $0,6 mul $0,3 div $0,2 add $0,1
programs/oeis/200/A200919.asm
neoneye/loda
22
3440
; A200919: Number of crossings on periodic braids with n strands such that all strands meet. ; 0,0,0,1,3,5,9,13,19,25,34 trn $0,2 seq $0,8804 ; Expansion of 1/((1-x)^2*(1-x^2)*(1-x^4)). sub $0,1
awa/src/awa-components-wikis.ads
fuzzysloth/ada-awa
0
12695
----------------------------------------------------------------------- -- awa-components-wikis -- Wiki rendering component -- Copyright (C) 2011, 2015, 2016 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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. ----------------------------------------------------------------------- with Ada.Strings.Wide_Wide_Unbounded; with Util.Beans.Basic; with Util.Beans.Objects; with ASF.Contexts.Faces; with ASF.Components; with ASF.Components.Html; with Wiki.Strings; with Wiki.Render; with Wiki.Plugins; with Wiki.Render.Links; package AWA.Components.Wikis is use ASF.Contexts.Faces; -- The wiki format of the wiki text. The valid values are: -- dotclear, google, creole, phpbb, mediawiki FORMAT_NAME : constant String := "format"; VALUE_NAME : constant String := ASF.Components.VALUE_NAME; -- The link renderer bean that controls the generation of page and image links. LINKS_NAME : constant String := "links"; -- The plugin factory bean that must be used for Wiki plugins. PLUGINS_NAME : constant String := "plugins"; -- Whether the TOC is rendered in the document. TOC_NAME : constant String := "toc"; -- ------------------------------ -- Wiki component -- ------------------------------ -- -- <awa:wiki value="wiki-text" format="dotclear|google|creole|phpbb" styleClass="class"/> -- type UIWiki is new ASF.Components.Html.UIHtmlComponent with null record; type UIWiki_Access is access all UIWiki'Class; -- Get the wiki format style. The format style is obtained from the <b>format</b> -- attribute name. function Get_Wiki_Style (UI : in UIWiki; Context : in Faces_Context'Class) return Wiki.Wiki_Syntax; -- Get the links renderer that must be used to render image and page links. function Get_Links_Renderer (UI : in UIWiki; Context : in Faces_Context'Class) return Wiki.Render.Links.Link_Renderer_Access; -- Get the plugin factory that must be used by the Wiki parser. function Get_Plugin_Factory (UI : in UIWiki; Context : in Faces_Context'Class) return Wiki.Plugins.Plugin_Factory_Access; -- Render the wiki text overriding procedure Encode_Begin (UI : in UIWiki; Context : in out Faces_Context'Class); use Ada.Strings.Wide_Wide_Unbounded; IMAGE_PREFIX_ATTR : constant String := "image_prefix"; PAGE_PREFIX_ATTR : constant String := "page_prefix"; type Link_Renderer_Bean is new Util.Beans.Basic.Bean and Wiki.Render.Links.Link_Renderer with record Page_Prefix : Unbounded_Wide_Wide_String; Image_Prefix : Unbounded_Wide_Wide_String; end record; -- Make a link adding a prefix unless the link is already absolute. procedure Make_Link (Renderer : in Link_Renderer_Bean; Link : in Wiki.Strings.WString; Prefix : in Unbounded_Wide_Wide_String; URI : out Unbounded_Wide_Wide_String); -- Get the value identified by the name. overriding function Get_Value (From : in Link_Renderer_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Link_Renderer_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Get the image link that must be rendered from the wiki image link. overriding procedure Make_Image_Link (Renderer : in out Link_Renderer_Bean; Link : in Wiki.Strings.WString; URI : out Unbounded_Wide_Wide_String; Width : in out Natural; Height : in out Natural); -- Get the page link that must be rendered from the wiki page link. overriding procedure Make_Page_Link (Renderer : in out Link_Renderer_Bean; Link : in Wiki.Strings.WString; URI : out Unbounded_Wide_Wide_String; Exists : out Boolean); private function Starts_With (Content : in Unbounded_Wide_Wide_String; Item : in String) return Boolean; end AWA.Components.Wikis;
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco/Cisco_callhome.g4
sskausik08/Wilco
0
7715
parser grammar Cisco_callhome; import Cisco_common; options { tokenVocab = CiscoLexer; } call_home_null : NO? ( ALERT_GROUP | CONTACT | CONTACT_EMAIL_ADDR | CONTACT_NAME | CONTRACT_ID | CUSTOMER_ID | MAIL_SERVER | PHONE_NUMBER | SENDER | SERVICE | SITE_ID | SOURCE_INTERFACE | SOURCE_IP_ADDRESS | STREET_ADDRESS ) ~NEWLINE* NEWLINE ; call_home_profile : PROFILE ~NEWLINE* NEWLINE ( call_home_profile_null )* ; call_home_profile_null : NO? ( ACTIVE | DESTINATION | SUBSCRIBE_TO_ALERT_GROUP ) ~NEWLINE* NEWLINE ; callhome_destination_profile : DESTINATION_PROFILE name = variable ( callhome_destination_profile_alert_group | callhome_destination_profile_email_addr | callhome_destination_profile_format | callhome_destination_profile_message_level | callhome_destination_profile_message_size | callhome_destination_profile_transport_method | NEWLINE ) ; callhome_destination_profile_alert_group : ALERT_GROUP variable NEWLINE ; callhome_destination_profile_email_addr : EMAIL_ADDR variable NEWLINE ; callhome_destination_profile_message_level : MESSAGE_LEVEL DEC NEWLINE ; callhome_destination_profile_message_size : MESSAGE_SIZE DEC NEWLINE ; callhome_destination_profile_format : FORMAT ( XML | FULL_TXT | SHORT_TXT ) NEWLINE ; callhome_destination_profile_transport_method : TRANSPORT_METHOD variable NEWLINE ; callhome_diagnostic_signature : DIAGNOSTIC_SIGNATURE NEWLINE ( callhome_diagnostic_signature_null )* ; callhome_diagnostic_signature_null : NO? ( ACTIVE | PROFILE ) ~NEWLINE* NEWLINE ; callhome_email_contact : EMAIL_CONTACT variable NEWLINE ; callhome_enable : ENABLE NEWLINE ; callhome_null : NO? ( DATA_PRIVACY | DUPLICATE_MESSAGE | ( NO ( DESTINATION_PROFILE | ENABLE | TRANSPORT ) ) | PERIODIC_INVENTORY | ( TRANSPORT ( HTTP ) ) ) ~NEWLINE* NEWLINE ; callhome_phone_contact : PHONE_CONTACT variable NEWLINE ; callhome_streetaddress : STREETADDRESS variable NEWLINE ; callhome_switch_priority : SWITCH_PRIORITY DEC NEWLINE ; callhome_transport : TRANSPORT ( callhome_transport_email ) ; callhome_transport_email : EMAIL ( callhome_transport_email_from | callhome_transport_email_reply_to | callhome_transport_email_smtp_server ) ; callhome_transport_email_from : FROM variable NEWLINE ; callhome_transport_email_reply_to : REPLY_TO variable NEWLINE ; callhome_transport_email_smtp_server : SMTP_SERVER ( IP_ADDRESS | IPV6_ADDRESS | variable ) ( ( PORT p = DEC ) | ( USE_VRF vrf = variable ) )* NEWLINE ; s_call_home : NO? CALL_HOME ~NEWLINE* NEWLINE ( call_home_null | call_home_profile )* ; s_callhome : CALLHOME NEWLINE ( callhome_email_contact | callhome_destination_profile | callhome_diagnostic_signature | callhome_enable | callhome_null | callhome_phone_contact | callhome_streetaddress | callhome_switch_priority | callhome_transport )* ;
programs/oeis/179/A179207.asm
karttu/loda
1
85671
; A179207: a(n) = n - 1 + ceiling((-3 + n^2)/2) if n > 1 with a(1)=1, complement of A182835. ; 1,2,5,10,15,22,29,38,47,58,69,82,95,110,125,142,159,178,197,218,239,262,285,310,335,362,389,418,447,478,509,542,575,610,645,682,719,758,797,838,879,922,965,1010,1055,1102,1149,1198,1247,1298,1349,1402,1455,1510,1565,1622,1679,1738,1797,1858,1919,1982,2045,2110,2175,2242,2309,2378,2447,2518,2589,2662,2735,2810,2885,2962,3039,3118,3197,3278,3359,3442,3525,3610,3695,3782,3869,3958,4047,4138,4229,4322,4415,4510,4605,4702,4799,4898,4997,5098,5199,5302,5405,5510,5615,5722,5829,5938,6047,6158,6269,6382,6495,6610,6725,6842,6959,7078,7197,7318,7439,7562,7685,7810,7935,8062,8189,8318,8447,8578,8709,8842,8975,9110,9245,9382,9519,9658,9797,9938,10079,10222,10365,10510,10655,10802,10949,11098,11247,11398,11549,11702,11855,12010,12165,12322,12479,12638,12797,12958,13119,13282,13445,13610,13775,13942,14109,14278,14447,14618,14789,14962,15135,15310,15485,15662,15839,16018,16197,16378,16559,16742,16925,17110,17295,17482,17669,17858,18047,18238,18429,18622,18815,19010,19205,19402,19599,19798,19997,20198,20399,20602,20805,21010,21215,21422,21629,21838,22047,22258,22469,22682,22895,23110,23325,23542,23759,23978,24197,24418,24639,24862,25085,25310,25535,25762,25989,26218,26447,26678,26909,27142,27375,27610,27845,28082,28319,28558,28797,29038,29279,29522,29765,30010,30255,30502,30749,30998,31247,31498 mov $1,$0 mul $1,$0 mov $2,$0 mul $0,2 trn $0,3 mul $2,2 add $1,$2 add $0,$1 div $0,2 mov $1,$0 add $1,1
sources/google_naive.adb
theurt/PageRank
0
17938
<gh_stars>0 with Ada.Text_IO; use Ada.Text_IO; package body Google_Naive is procedure Initialiser (matrice : out T_Google_Naive; dimensions_ligne : in Integer; dimensions_colonne : in Integer) is begin matrice.nb_ligne := dimensions_ligne; matrice.nb_colonne := dimensions_colonne; end Initialiser; function Est_Vide (Matrice : in T_Google_Naive) return Boolean is begin return (matrice.nb_ligne = 0 and matrice.nb_colonne = 0) ; end Est_Vide; procedure Dimension(Matrice : in T_Google_Naive; ligne : out Integer; colonne : out Integer) is begin ligne := matrice.nb_ligne; colonne := matrice.nb_colonne; end Dimension; function Get_coefficient (Matrice : in T_Google_Naive; ligne : in Integer; colonne : in Integer) return T_Element is begin if ligne > Matrice.nb_ligne or colonne > Matrice.nb_colonne then -- dimensions incompatibles raise Invalid_indices_Error; else return Matrice.tableau(ligne,colonne); end if; end Get_coefficient; procedure Enregistrer_coefficient (Matrice : in out T_Google_Naive; ligne : in Integer; colonne : in Integer; coefficient : in T_Element) is begin if matrice.nb_colonne < colonne or matrice.nb_ligne < ligne then -- dimensions incompatibles raise Dimensions_incompatibles_Error; else Matrice.tableau(ligne,colonne) := coefficient; end if; end Enregistrer_coefficient; function Somme (Matrice_A : in T_Google_Naive; Matrice_B : in T_Google_Naive) return T_Google_Naive is coefficient: T_Element; -- A(i,j) + B(i,j) nb_ligne_A : Integer; -- nombre de ligne de la matrice A nb_ligne_B : Integer; -- nombre de ligne de la matrice B nb_colonne_A : Integer; -- nombre de ligne de la matrice A nb_colonne_B : Integer; -- nombre de ligne de la matrice B Matrice_C : T_Google_Naive; begin Dimension(Matrice_A,nb_ligne_A,nb_colonne_A); Dimension(Matrice_B,nb_ligne_B,nb_colonne_B); -- Vérifier que les matrices soient de dimensions compatibles if nb_ligne_A /= nb_ligne_B or nb_colonne_A /= nb_colonne_B then raise Dimensions_incompatibles_Error; else Initialiser(Matrice_C,nb_ligne_A,nb_colonne_A); -- C stocke le resultat de la somme -- Sommer coefficient par coefficient for ligne in 1..nb_ligne_A loop coefficient := T_Element(0.0); for colonne in 1..nb_colonne_A loop coefficient := Matrice_A.tableau(ligne,colonne) + Matrice_B.tableau(ligne,colonne); Matrice_C.tableau(ligne,colonne) := coefficient; end loop; end loop; end if; return Matrice_C; end Somme; function Produit_matrices (Matrice_A : in T_Google_Naive; Matrice_B : in T_Google_Naive) return T_Google_Naive is somme: T_Element; -- A(i,j) + B(i,j) nb_ligne_A : Integer; -- nombre de ligne de la matrice A nb_ligne_B : Integer; -- nombre de ligne de la matrice B nb_colonne_A : Integer; -- nombre de ligne de la matrice A nb_colonne_B : Integer; -- nombre de ligne de la matrice B Matrice_C : T_Google_Naive; begin Dimension(Matrice_A,nb_ligne_A,nb_colonne_A); Dimension(Matrice_B,nb_ligne_B,nb_colonne_B); -- Vérifier que les matrices soient de dimensions compatibles if nb_colonne_A /= nb_ligne_B then raise Dimensions_incompatibles_Error; else Initialiser(Matrice_C,Matrice_A.nb_ligne,Matrice_B.nb_colonne); -- Enregistrer chaque coefficient for ligne in 1..Matrice_A.nb_ligne loop for colonne in 1..Matrice_B.nb_colonne loop -- Sommer les A(i,k) * B (k,j) somme := T_Element(0.0); for k in 1..Matrice_B.Nb_ligne loop somme := somme + Get_coefficient(Matrice_A,ligne,k)* Get_coefficient(Matrice_B,k,colonne); end loop; Enregistrer_coefficient(Matrice_C,ligne,colonne,somme); end loop; end loop; end if; return Matrice_C; end Produit_matrices; procedure Produit_scalaire_matrice(Matrice : in out T_Google_Naive; scalaire : in T_Element) is begin for ligne in 1..Matrice.nb_ligne loop for colonne in 1..Matrice.nb_colonne loop Matrice.tableau(ligne,colonne):=scalaire*Matrice.tableau(ligne,colonne); end loop; end loop; end Produit_scalaire_matrice; function Egalite(Matrice_A : in T_Google_Naive; Matrice_B : in T_Google_Naive) return Boolean is begin if Matrice_B.nb_colonne /= Matrice_A.nb_colonne or Matrice_A.nb_ligne/= Matrice_B.nb_ligne then -- dimensions incompatibles return False; else -- Vérifier que les cofficients soient tous égaux for ligne in 1..Matrice_A.nb_ligne loop for colonne in 1..Matrice_A.nb_colonne loop if Matrice_A.tableau(ligne,colonne) /= Matrice_B.tableau(ligne,colonne) then return False; end if; end loop; end loop; return True; end if; end Egalite; procedure Affecter (Matrice_A : in out T_Google_Naive; Matrice_B : in T_Google_Naive) is begin -- Vérifier que les matrices soient de dimensions compatibles if Matrice_B.nb_colonne /= Matrice_A.nb_colonne or Matrice_A.nb_ligne/= Matrice_B.nb_ligne then raise Dimensions_incompatibles_Error; else -- Affecter coefficient par coefficient for ligne in 1..Matrice_B.nb_ligne loop for colonne in 1..Matrice_B.nb_colonne loop Matrice_A.tableau(ligne,colonne) := Matrice_B.tableau(ligne,colonne); end loop; end loop; end if; end Affecter; procedure Affichage (Matrice : in T_Google_Naive) is begin if Matrice.nb_colonne=0 or matrice.nb_ligne=0 then -- Afficher la matrice vide Put("[ ]"); else Put('['); -- Afficher coefficient par coefficient for ligne in 1..Matrice.nb_ligne loop Put('['); for colonne in 1..Matrice.nb_colonne loop Afficher(Matrice.tableau(ligne,colonne)); Put(','); end loop; Put(']'); New_Line; end loop; Put(']'); end if; end Affichage; end Google_Naive;
data/pokemon/dex_entries/cresselia.asm
AtmaBuster/pokeplat-gen2
6
161358
<filename>data/pokemon/dex_entries/cresselia.asm db "LUNAR@" ; species name db "Those who sleep" next "holding CRESSELIA's" next "feather are" page "assured of joyful" next "dreams. It's shaped" next "like the moon.@"
bbc/bbcmaster.asm
peter-mount/departures8bit
0
83794
; ******************************************************************************** ; BBC Master 128 ROM image ; ******************************************************************************** ; Select 65c02 CPU 1 INCLUDE "../macros.asm" ; Our macros INCLUDE "../zeropage.asm" ; Zero page allocations INCLUDE "mos.asm" ; BBC MOS definitions ORG &8000 ; Paged Rom start GUARD &C000 ; Guard at end of Paged Rom INCLUDE "romheader.asm" ; Rom header must be the first code section INCLUDE "error.asm" ; BRK error handler INCLUDE "language.asm" ; Language entry point INCLUDE "oscli.asm" ; OSCLI handler INCLUDE "screen.asm" ; BBC Screen handler INCLUDE "service.asm" ; Service entry point INCLUDE "../utils/outputbuffer.asm" ; Output buffer handling INCLUDE "../utils/prompt.asm" INCLUDE "../network/serial.asm" ; RS232 handler INCLUDE "../network/dialer.asm" ; WiFi Modem dialer INCLUDE "../network/api.asm" ; Our API INCLUDE "../main.asm" ; The core application ; Save the rom SAVE "m128rom", &8000, &C000
HDMA5.asm
nesdoug/SNES_11
3
92239
<gh_stars>1-10 ;hdma effect 5 ;use a window to color a portion of the screen ;combining windows and color math (fixed color) ;2 separate hdma channels, for window Set_F5: A8 XY16 ;Note: windows NOT active on main nor sub screens, ;$2123-4, $212e-f ;but it IS active for color math... lda #$20 ;Window 1 active for color, not inverted sta $2125 ;WOBJSEL - window mask for obj and color lda #$10 ;prevent outside color window, clip never, ;add fixed color (not subscreen) sta $2130 ;CGWSEL - color addition select lda #$3f ;color math on all things, add, not half sta $2131 ;CGADSUB - color math designation lda #$8f ;blue at 50% sta $2132 ;COLDATA set the fixed color ;window_logic_bg = $212a-b ... keep it zero ;if we flip 2125 to inverted, the color portion will ;reverse, blue outside the box ;that also would happen if we change 2130 to ;prevent inside stz $4300 ;1 register, write once lda #$26 ;2126 WH0 sta $4301 ;destination ldx #.loword(H_TABLE7) stx $4302 ;address lda #^H_TABLE7 sta $4304 ;address stz $4310 ;1 register, write once lda #$27 ;2127 WH1 sta $4311 ;destination ldx #.loword(H_TABLE8) stx $4312 ;address lda #^H_TABLE8 sta $4314 ;address lda #3 ;channels 1 and 2 sta HDMAEN ;$420c rts H_TABLE7: .byte 40, $ff .byte 120, $49 .byte 22, $49 .byte 1, $ff .byte 0 H_TABLE8: .byte 40, 0 .byte 120, $b6 .byte 22, $b6 .byte 1, 0 .byte 0
PostgreSQL/Scripts/PGPrefsRunAsAdmin.applescript
MaccaTech/PostgresPrefs
87
496
# # PGPrefsRunAsAdmin.applescript # PostgresPrefs # # Created by <NAME> on 24/12/11. # Copyright (c) 2011-2020 Macca Tech Ltd. (http://macca.tech) # (See LICENCE.txt) # # ============================================================== # # OVERVIEW: # --------- # # Executes all received arguments on the shell with admin # privileges # # Note: any error message received on stderr is redirected # to stdout, because Objective C function # AuthorizationExecuteWithPrivileges can only capture output # on stdout # # ============================================================== on run argv # Join args into single string set prevDelimiter to AppleScript's text item delimiters set AppleScript's text item delimiters to " " set cmd to (argv as string) as string set AppleScript's text item delimiters to prevDelimiter # Run on shell, return result set result to "" as string try set result to do shell script cmd with administrator privileges without altering line endings # Return error to stdout on error errMsg set result to errMsg as string end try return result end run
src/NTypes/Sigma.agda
vituscze/HoTT-lectures
0
5107
<reponame>vituscze/HoTT-lectures {-# OPTIONS --without-K #-} module NTypes.Sigma where open import NTypes open import PathOperations open import PathStructure.Sigma open import Transport open import Types Σ-isSet : ∀ {a b} {A : Set a} {B : A → Set b} → isSet A → (∀ x → isSet (B x)) → isSet (Σ A B) Σ-isSet {A = A} {B = B} A-set B-set x y p q = split-eq p ⁻¹ · ap₂-dep-eq {B = B} _,_ (ap π₁ p) (ap π₁ q) π₁-eq (tr-∘ π₁ p (π₂ x) ⁻¹ · apd π₂ p) (tr-∘ π₁ q (π₂ x) ⁻¹ · apd π₂ q) π₂-eq · split-eq q where split-eq : (p : x ≡ y) → ap₂-dep {B = B} _,_ (ap π₁ p) (tr-∘ π₁ p (π₂ x) ⁻¹ · apd π₂ p) ≡ p split-eq = π₂ (π₂ (π₂ split-merge-eq)) π₁-eq : ap π₁ p ≡ ap π₁ q π₁-eq = A-set _ _ (ap π₁ p) (ap π₁ q) π₂-eq : tr (λ z → tr B z (π₂ x) ≡ π₂ y) π₁-eq (tr-∘ π₁ p (π₂ x) ⁻¹ · apd π₂ p) ≡ tr-∘ π₁ q (π₂ x) ⁻¹ · apd π₂ q π₂-eq = B-set _ (tr B (ap π₁ q) (π₂ x)) (π₂ y) (tr (λ z → tr B z (π₂ x) ≡ π₂ y) π₁-eq (tr-∘ π₁ p (π₂ x) ⁻¹ · apd π₂ p)) (tr-∘ π₁ q (π₂ x) ⁻¹ · apd π₂ q)
oeis/024/A024712.asm
neoneye/loda-programs
11
102684
; A024712: a(n) = residue mod 3 of n-th term of A024702. ; Submitted by <NAME> ; 1,2,2,1,0,0,1,2,1,0,1,2,2,0,1,2,1,0,0,2,2,0,2,2,1,0,0,1,0,1,2,1,1,2,1,0,1,2,0,0,2,1,0,0,1,2,2,1,0,1,2,0,1,2,0,0,2,2,1,1,0,1,2,2,2,1,1,2,2,0,2,1,0,1,2,0,1,1,1,2,0,0,2,2,0,2,2,1,0,2,0,1,1,0,1,0,0,0,2,0 seq $0,173064 ; a(n) = prime(n) - 5. add $0,7 mul $0,4 sub $0,8 pow $0,2 mul $0,2 div $0,768 mod $0,3
Applescript/Mask_Toggle.applescript
dustindmiller/QTableTop
1
2150
tell application id "com.figure53.QLab.4" to tell front workspace ##set mapList to (q number of cues of cue "MAPS") ##set mapName to (choose from list mapList with title "Toggle Masks" with prompt "Select Map..." OK button name {"Select"} cancel button name {"Cancel"}) as string set mapName to q name of cue "Map Toggle" if mapName is "No Active Map" then return else if cue (mapName & " MASKS") exists then set maskList to (q number of cues of cue (mapName & " MASKS")) set maskSel to (choose from list maskList with title "Toggle " & mapName & " Masks" with prompt "Select Mask..." OK button name {"Select"} cancel button name {"Cancel"}) as string if maskSel is "false" then return else if maskSel is not "Cancel" then set maskName to q name of cue maskSel if opacity of cue maskSel is not 0 then set maskState to "(Active)" set defButton to "Disable" else set maskState to "(Not-Active)" set defButton to "Enable" end if set maskAction to (display dialog maskSel & " - " & maskName & " " & maskState with title "Toggle " & mapName & " Masks" buttons {"Enable", "Disable", "Cancel"} default button defButton giving up after 5) set maskAct to button returned of maskAction if maskAct is "Cancel" then return else if maskAct is "Enable" then set armed of cue "Mask Enabler" to true set opacity of cue maskSel to 0.01 start cue "Mask Enabler" delay 3 set armed of cue "Mask Enabler" to false else if maskAct is "Disable" then set opacity of cue maskSel to 0.0 end if end if else display dialog "Map does not have any masks" with title "Toggle Masks" with icon 2 buttons "OK" default button "OK" giving up after 5 end if end tell
src/Prelude/Bytes.agda
lclem/agda-prelude
0
13729
module Prelude.Bytes where open import Prelude.Bool open import Prelude.Decidable open import Prelude.Equality open import Prelude.Equality.Unsafe {-# FOREIGN GHC import qualified Data.ByteString as B #-} postulate Bytes : Set {-# COMPILE GHC Bytes = type B.ByteString #-} private module Internal where postulate empty : Bytes append : Bytes → Bytes → Bytes {-# COMPILE GHC empty = B.empty #-} {-# COMPILE GHC append = B.append #-} -- Eq -- private postulate eqBytes : Bytes → Bytes → Bool {-# COMPILE GHC eqBytes = (==) #-} instance EqBytes : Eq Bytes _==_ {{EqBytes}} x y with eqBytes x y ... | true = yes unsafeEqual ... | false = no unsafeNotEqual -- Monoid -- instance open import Prelude.Monoid MonoidBytes : Monoid Bytes mempty {{MonoidBytes}} = Internal.empty _<>_ {{MonoidBytes}} = Internal.append
libsrc/_DEVELOPMENT/string/c/sccz80/bcmp.asm
meesokim/z88dk
0
101075
<gh_stars>0 ; BSD ; int bcmp (const void *b1, const void *b2, size_t len) SECTION code_string PUBLIC bcmp EXTERN memcmp defc bcmp = memcmp
3-mid/opengl/source/lean/io/opengl-io.adb
charlie5/lace
20
24223
with openGL.Images, openGL.Viewport, openGL.Tasks, openGL.Errors, GID, GL.Binding, GL.safe, GL.Pointers, ada.unchecked_Conversion, ada.Calendar, ada.Characters.handling, System; package body openGL.IO is use ada.Characters.handling, ada.Streams.Stream_IO; use type Index_t; -------- -- Face -- function Vertices_of (Self : in Face) return Vertices is begin case Self.Kind is when Triangle => return Self.Tri; when Quad => return Self.Quad; when Polygon => return Self.Poly.all; end case; end Vertices_of; procedure set_Vertex_in (Self : in out Face; Which : in long_Index_t; To : in Vertex) is begin case Self.Kind is when Triangle => Self.Tri (Which) := To; when Quad => Self.Quad (Which) := To; when Polygon => Self.Poly (Which) := To; end case; end set_Vertex_in; procedure destroy (Self : in out Face) is procedure free is new ada.unchecked_Deallocation (Vertices, Vertices_view); begin if Self.Kind = Polygon then free (Self.Poly); end if; end destroy; ------------- -- Operations -- function current_Frame return Image is use GL, GL.Binding, GL.Pointers, Texture; Extent : constant Extent_2d := openGL.Viewport.Extent; Frame : Image (1 .. Index_t (Extent.Width), 1 .. Index_t (Extent.Height)); begin glReadPixels (0, 0, GLsizei (Extent.Width), GLsizei (Extent.Height), to_GL (Format' (Texture.RGB)), GL_UNSIGNED_BYTE, to_GLvoid_access (Frame (1, 1).Red'Access)); return Frame; end current_Frame; --------- -- Forge -- function to_height_Map (image_Filename : in asset_Name; Scale : in Real := 1.0) return height_Map_view is File : Ada.Streams.Stream_IO.File_Type; Image : GID.Image_Descriptor; up_Name : constant String := To_Upper (to_String (image_Filename)); next_Frame : ada.Calendar.Day_Duration := 0.0; begin open (File, in_File, to_String (image_Filename)); GID.load_Image_Header (Image, Stream (File).all, try_tga => image_Filename'Length >= 4 and then up_Name (up_Name'Last - 3 .. up_Name'Last) = ".TGA"); declare image_Width : constant Positive := GID.Pixel_Width (Image); image_Height : constant Positive := GID.Pixel_Height (Image); the_Heights : constant access height_Map := new height_Map' (1 .. Index_t (image_height) => (1 .. Index_t (image_width) => <>)); procedure load_raw_Image is subtype primary_Color_range is GL.GLubyte; Row, Col : Index_t; procedure set_X_Y (x, y : Natural) is begin Col := Index_t (X + 1); Row := Index_t (Y + 1); end Set_X_Y; procedure put_Pixel (Red, Green, Blue : primary_Color_range; Alpha : primary_Color_range) is pragma Warnings (Off, alpha); -- Alpha is just ignored. use type GL.GLubyte, Real; begin the_Heights (Row, Col) := (Real (Red) + Real (Green) + Real (Blue)) / (3.0 * 255.0) * Scale; if Col = Index_t (image_Width) then Row := Row + 1; Col := 1; else Col := Col + 1; end if; -- ^ GID requires us to look to next pixel on the right for next time. end put_Pixel; procedure Feedback (Percents : Natural) is null; procedure load_Image is new GID.load_Image_contents (primary_Color_range, set_X_Y, put_Pixel, Feedback, GID.fast); begin load_Image (Image, next_Frame); end load_Raw_image; begin load_raw_Image; close (File); return the_Heights.all'unchecked_Access; end; end to_height_Map; function fetch_Image (Stream : in ada.Streams.Stream_IO.Stream_access; try_TGA : in Boolean) return Image is begin return Images.fetch_Image (Stream, try_TGA); end fetch_Image; function to_Image (image_Filename : in asset_Name) return Image is File : ada.Streams.Stream_IO.File_type; up_Name : constant String := to_Upper (to_String (image_Filename)); begin open (File, In_File, to_String (image_Filename)); declare the_Image : constant Image := fetch_Image (Stream (File), try_TGA => image_Filename'Length >= 4 and then up_Name (up_Name'Last - 3 .. up_Name'Last) = ".TGA"); begin close (File); return the_Image; end; end to_Image; function to_lucid_Image (image_Filename : in asset_Name) return lucid_Image is Unused : aliased Boolean; begin return to_lucid_Image (image_Filename, Unused'Access); end to_lucid_Image; function to_lucid_Image (image_Filename : in asset_Name; is_Lucid : access Boolean) return lucid_Image is File : ada.Streams.Stream_IO.File_type; the_Image : GID.Image_Descriptor; up_Name : constant String := to_Upper (to_String (image_Filename)); next_Frame : ada.Calendar.Day_Duration := 0.0; begin open (File, in_File, to_String (image_Filename)); GID.load_Image_Header (the_Image, Stream (File).all, try_TGA => image_Filename'Length >= 4 and then up_Name (up_Name'Last - 3 .. up_Name'Last) = ".TGA"); declare image_Width : constant Positive := GID.Pixel_Width (the_Image); image_Height : constant Positive := GID.Pixel_Height (the_Image); Frame : lucid_Image (1 .. Index_t (image_Height), 1 .. Index_t (image_Width)); procedure load_raw_Image is subtype primary_Color_range is GL.GLubyte; Row, Col : Index_t; procedure set_X_Y (X, Y : Natural) is begin Col := Index_t (X + 1); Row := Index_t (Y + 1); end set_X_Y; procedure put_Pixel (Red, Green, Blue : primary_Color_range; Alpha : primary_Color_range) is use type GL.GLubyte, Real; begin Frame (Row, Col) := ((Red, Green, Blue), Alpha); if Col = Index_t (image_Width) then -- GID requires us to look to next pixel on the right for next time. Row := Row + 1; Col := 1; else Col := Col + 1; end if; if Alpha /= Opaque then is_Lucid.all := True; end if; end put_Pixel; procedure Feedback (Percents : Natural) is null; procedure load_Image is new GID.load_Image_contents (primary_Color_range, set_X_Y, put_Pixel, Feedback, GID.fast); begin load_Image (the_Image, next_Frame); end Load_raw_image; begin is_Lucid.all := False; load_raw_Image; close (File); return Frame; end; end to_lucid_Image; function to_Texture (image_Filename : in asset_Name) return Texture.Object is use Texture; is_Lucid : aliased Boolean; the_lucid_Image : constant lucid_Image := to_lucid_Image (image_Filename, is_Lucid'Access); the_Texture : Texture.Object := Forge.to_Texture (Texture.Dimensions' (the_lucid_Image'Length (2), the_lucid_Image'Length (1))); begin if is_Lucid then set_Image (the_Texture, the_lucid_Image); else declare the_opaque_Image : constant Image := to_Image (the_lucid_Image); begin set_Image (the_Texture, the_opaque_Image); end; end if; return the_Texture; end to_Texture; procedure destroy (Self : in out Model) is procedure free is new ada.unchecked_Deallocation (bone_Weights, bone_Weights_view); procedure free is new ada.unchecked_Deallocation (bone_Weights_array, bone_Weights_array_view); begin free (Self.Sites); free (Self.Coords); free (Self.Normals); if Self.Weights /= null then for Each in Self.Weights'Range loop free (Self.Weights (Each)); end loop; free (Self.Weights); end if; for Each in Self.Faces'Range loop destroy (Self.Faces (Each)); end loop; free (Self.Faces); end destroy; -------------------------------- --- Screenshot and Video Capture -- type U8 is mod 2 ** 8; for U8 'Size use 8; type U16 is mod 2 ** 16; for U16'Size use 16; type U32 is mod 2 ** 32; for U32'Size use 32; type I32 is range -2 ** 31 .. 2 ** 31 - 1; for I32'Size use 32; generic type Number is mod <>; S : Stream_Access; procedure write_Intel_x86_Number (N : in Number); procedure write_Intel_x86_Number (N : in Number) is M : Number := N; Bytes : constant Integer := Number'Size / 8; begin for i in 1 .. bytes loop U8'write (S, U8 (M mod 256)); M := M / 256; end loop; end write_Intel_x86_Number; procedure write_raw_BGR_Frame (Stream : Stream_Access; Width, Height : Natural) is use GL, GL.Binding, openGL.Texture; -- 4-byte padding for .bmp/.avi formats is the same as GL's default -- padding: see glPixelStore, GL_[UN]PACK_ALIGNMENT = 4 as initial value. -- http://www.openGL.org/sdk/docs/man/xhtml/glPixelStore.xml -- padded_row_Size : constant Positive := 4 * Integer (Float'Ceiling (Float (Width) * 3.0 / 4.0)); -- (in bytes) type temp_Bitmap_type is array (Natural range <>) of aliased gl.GLUbyte; PicData: temp_Bitmap_type (0 .. (padded_row_Size + 4) * (Height + 4) - 1); -- No dynamic allocation needed! -- The "+4" are there to avoid parity address problems when GL writes to the buffer. type Loc_pointer is new gl.safe.GLvoid_Pointer; function convert is new ada.unchecked_Conversion (System.Address, Loc_pointer); -- This method is functionally identical as GNAT's Unrestricted_Access -- but has no type safety (cf GNAT Docs). pragma no_strict_Aliasing (Loc_pointer); -- Recommended by GNAT 2005+. pPicData : Loc_pointer; data_Max : constant Integer := padded_row_Size * Height - 1; -- Workaround for the severe xxx'Read xxx'Write performance -- problems in the GNAT and ObjectAda compilers (as in 2009) -- This is possible if and only if Byte = Stream_Element and -- arrays types are both packed the same way. -- type Byte_array is array (Integer range <>) of aliased GLUByte; subtype Size_Test_a is Byte_array (1 .. 19); subtype Size_Test_b is ada.Streams.Stream_Element_array (1 .. 19); workaround_possible: constant Boolean := Size_Test_a'Size = Size_Test_b'Size and then Size_Test_a'Alignment = Size_Test_b'Alignment; begin Tasks.check; pPicData:= Convert (PicData (0)'Address); GLReadPixels (0, 0, GLSizei (Width), GLSizei (Height), to_GL (Texture.BGR), GL.GL_UNSIGNED_BYTE, pPicData); Errors.log; if workaround_possible then declare use ada.Streams; SE_Buffer : Stream_Element_array (0 .. Stream_Element_Offset (PicData'Last)); for SE_Buffer'Address use PicData'Address; pragma import (Ada, SE_Buffer); begin ada.Streams.write (Stream.all, SE_Buffer (0 .. Stream_Element_Offset (data_Max))); end; else temp_Bitmap_type'write (Stream, PicData (0 .. data_Max)); end if; end write_raw_BGR_Frame; procedure write_raw_BGRA_Frame (Stream : Stream_access; Width, Height : Natural) is use GL, GL.Binding, Texture; -- 4-byte padding for .bmp/.avi formats is the same as GL's default -- padding: see glPixelStore, GL_[UN]PACK_ALIGNMENT = 4 as initial value. -- http://www.openGL.org/sdk/docs/man/xhtml/glPixelStore.xml -- padded_row_Size : constant Positive:= 4 * Integer (Float'Ceiling (Float (Width))); -- (in bytes) type temp_Bitmap_type is array (Natural range <>) of aliased gl.GLUbyte; PicData: temp_Bitmap_type (0.. (padded_row_size + 4) * (height + 4) - 1); -- No dynamic allocation needed! -- The "+4" are there to avoid parity address problems when GL writes -- to the buffer. type Loc_pointer is new gl.safe.GLvoid_Pointer; function convert is new ada.unchecked_Conversion (System.Address, Loc_pointer); -- This method is functionally identical as GNAT's Unrestricted_Access -- but has no type safety (cf GNAT Docs). pragma no_strict_Aliasing (loc_pointer); -- Recommended by GNAT 2005+. pPicData : Loc_pointer; data_Max : constant Integer := padded_row_Size * Height - 1; -- Workaround for the severe xxx'Read xxx'Write performance -- problems in the GNAT and ObjectAda compilers (as in 2009) -- This is possible if and only if Byte = Stream_Element and -- arrays types are both packed the same way. -- type Byte_array is array (Integer range <>) of aliased GLUByte; subtype Size_Test_a is Byte_Array (1..19); subtype Size_Test_b is ada.Streams.Stream_Element_array (1 .. 19); workaround_possible: constant Boolean := Size_Test_a'Size = Size_Test_b'Size and then Size_Test_a'Alignment = Size_Test_b'Alignment; begin Tasks.check; pPicData:= convert (PicData (0)'Address); GLReadPixels (0, 0, GLSizei (width), GLSizei (height), to_GL (openGL.Texture.BGRA), GL.GL_UNSIGNED_BYTE, pPicData); Errors.log; if workaround_possible then declare use ada.Streams; SE_Buffer : Stream_Element_array (0 .. Stream_Element_Offset (PicData'Last)); for SE_Buffer'Address use PicData'Address; pragma Import (Ada, SE_Buffer); begin ada.Streams.write (Stream.all, SE_Buffer (0 .. Stream_Element_Offset (data_Max))); end; else temp_Bitmap_type'write (Stream, PicData (0 .. data_Max)); end if; end write_raw_BGRA_Frame; ------------- -- Screenshot -- subtype FXPT2DOT30 is U32; type CIEXYZ is record ciexyzX : FXPT2DOT30; ciexyzY : FXPT2DOT30; ciexyzZ : FXPT2DOT30; end record; type CIEXYZTRIPLE is record ciexyzRed : CIEXYZ; ciexyzGreen : CIEXYZ; ciexyzBlue : CIEXYZ; end record; type BITMAPFILEHEADER is record bfType : U16; bfSize : U32; bfReserved1 : U16 := 0; bfReserved2 : U16 := 0; bfOffBits : U32; end record; pragma pack (BITMAPFILEHEADER); for BITMAPFILEHEADER'Size use 8 * 14; type BITMAPINFOHEADER is record biSize : U32; biWidth : I32; biHeight : I32; biPlanes : U16; biBitCount : U16; biCompression : U32; biSizeImage : U32; biXPelsPerMeter : I32 := 0; biYPelsPerMeter : I32 := 0; biClrUsed : U32 := 0; biClrImportant : U32 := 0; end record; pragma pack (BITMAPINFOHEADER); for BITMAPINFOHEADER'Size use 8 * 40; type BITMAPV4HEADER is record Core : BITMAPINFOHEADER; bV4RedMask : U32; bV4GreenMask : U32; bV4BlueMask : U32; bV4AlphaMask : U32; bV4CSType : U32; bV4Endpoints : CIEXYZTRIPLE; bV4GammaRed : U32; bV4GammaGreen : U32; bV4GammaBlue : U32; end record; pragma pack (BITMAPV4HEADER); for BITMAPV4HEADER'Size use 8 * 108; procedure opaque_Screenshot (Filename : in String) is use GL, GL.Binding; File : ada.Streams.Stream_IO.File_Type; FileInfo : BITMAPINFOHEADER; FileHeader : BITMAPFILEHEADER; Viewport : array (0 .. 3) of aliased GLint; begin Tasks.check; glGetIntegerv (GL_VIEWPORT, Viewport (0)'Unchecked_Access); Errors.log; FileHeader.bfType := 16#4D42#; -- 'BM' FileHeader.bfOffBits := BITMAPINFOHEADER'Size / 8 + BITMAPFILEHEADER'Size / 8; FileInfo.biSize := BITMAPINFOHEADER'Size / 8; FileInfo.biWidth := I32 (Viewport (2)); FileInfo.biHeight := I32 (Viewport (3)); FileInfo.biPlanes := 1; FileInfo.biBitCount := 24; FileInfo.biCompression := 0; FileInfo.biSizeImage := U32 ( 4 * Integer (Float'Ceiling (Float (FileInfo.biWidth) * 3.0 / 4.0)) * Integer (FileInfo.biHeight)); FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.biSizeImage; create (File, out_File, Filename); declare procedure write_Intel is new write_Intel_x86_Number (U16, Stream (File)); procedure write_Intel is new write_Intel_x86_Number (U32, Stream (File)); function convert is new ada.unchecked_Conversion (I32, U32); begin -- ** Endian-safe: ** -- write_Intel (FileHeader.bfType); write_Intel (FileHeader.bfSize); write_Intel (FileHeader.bfReserved1); write_Intel (FileHeader.bfReserved2); write_Intel (FileHeader.bfOffBits); -- write_Intel ( FileInfo.biSize); write_Intel (convert (FileInfo.biWidth)); write_Intel (convert (FileInfo.biHeight)); write_Intel ( FileInfo.biPlanes); write_Intel ( FileInfo.biBitCount); write_Intel ( FileInfo.biCompression); write_Intel ( FileInfo.biSizeImage); write_Intel (convert (FileInfo.biXPelsPerMeter)); write_Intel (convert (FileInfo.biYPelsPerMeter)); write_Intel ( FileInfo.biClrUsed); write_Intel ( FileInfo.biClrImportant); -- write_raw_BGR_Frame (Stream (File), Integer (Viewport (2)), Integer (Viewport (3))); Close (File); exception when others => Close (File); raise; end; end opaque_Screenshot; procedure lucid_Screenshot (Filename : in String) is use GL, GL.Binding; File : ada.Streams.Stream_IO.File_type; FileHeader : BITMAPFILEHEADER; FileInfo : BITMAPV4HEADER; Viewport : array (0 .. 3) of aliased GLint; begin Tasks.check; glGetIntegerv (GL_VIEWPORT, Viewport (0)'Unchecked_Access); Errors.log; FileHeader.bfType := 16#4D42#; -- 'BM' FileHeader.bfOffBits := BITMAPV4HEADER 'Size / 8 + BITMAPFILEHEADER'Size / 8; FileInfo.Core.biSize := BITMAPV4HEADER'Size / 8; FileInfo.Core.biWidth := I32 (Viewport (2)); FileInfo.Core.biHeight := I32 (Viewport (3)); FileInfo.Core.biPlanes := 1; FileInfo.Core.biBitCount := 32; FileInfo.Core.biCompression := 3; FileInfo.Core.biSizeImage := U32 ( 4 -- 4-byte padding for '.bmp/.avi' formats. * Integer (Float'Ceiling (Float (FileInfo.Core.biWidth))) * Integer (FileInfo.Core.biHeight)); FileInfo.bV4RedMask := 16#00FF0000#; FileInfo.bV4GreenMask := 16#0000FF00#; FileInfo.bV4BlueMask := 16#000000FF#; FileInfo.bV4AlphaMask := 16#FF000000#; FileInfo.bV4CSType := 0; FileInfo.bV4Endpoints := (others => (others => 0)); FileInfo.bV4GammaRed := 0; FileInfo.bV4GammaGreen := 0; FileInfo.bV4GammaBlue := 0; FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.Core.biSizeImage; Create (File, out_File, Filename); declare procedure write_Intel is new write_Intel_x86_Number (U16, Stream (File)); procedure write_Intel is new write_Intel_x86_Number (U32, Stream (File)); function convert is new ada.unchecked_Conversion (I32, U32); begin -- ** Endian-safe: ** -- write_Intel (FileHeader.bfType); write_Intel (FileHeader.bfSize); write_Intel (FileHeader.bfReserved1); write_Intel (FileHeader.bfReserved2); write_Intel (FileHeader.bfOffBits); -- write_Intel ( FileInfo.Core.biSize); write_Intel (convert (FileInfo.Core.biWidth)); write_Intel (convert (FileInfo.Core.biHeight)); write_Intel ( FileInfo.Core.biPlanes); write_Intel ( FileInfo.Core.biBitCount); write_Intel ( FileInfo.Core.biCompression); write_Intel ( FileInfo.Core.biSizeImage); write_Intel (convert (FileInfo.Core.biXPelsPerMeter)); write_Intel (convert (FileInfo.Core.biYPelsPerMeter)); write_Intel ( FileInfo.Core.biClrUsed); write_Intel ( FileInfo.Core.biClrImportant); write_Intel (FileInfo.bV4RedMask); write_Intel (FileInfo.bV4GreenMask); write_Intel (FileInfo.bV4BlueMask); write_Intel (FileInfo.bV4AlphaMask); write_Intel (FileInfo.bV4CSType); write_Intel (FileInfo.bV4Endpoints.ciexyzRed.ciexyzX); write_Intel (FileInfo.bV4Endpoints.ciexyzRed.ciexyzY); write_Intel (FileInfo.bV4Endpoints.ciexyzRed.ciexyzZ); write_Intel (FileInfo.bV4Endpoints.ciexyzGreen.ciexyzX); write_Intel (FileInfo.bV4Endpoints.ciexyzGreen.ciexyzY); write_Intel (FileInfo.bV4Endpoints.ciexyzGreen.ciexyzZ); write_Intel (FileInfo.bV4Endpoints.ciexyzBlue.ciexyzX); write_Intel (FileInfo.bV4Endpoints.ciexyzBlue.ciexyzY); write_Intel (FileInfo.bV4Endpoints.ciexyzBlue.ciexyzZ); write_Intel (FileInfo.bV4GammaRed); write_Intel (FileInfo.bV4GammaGreen); write_Intel (FileInfo.bV4GammaBlue); write_raw_BGRA_Frame (Stream (File), Integer (Viewport (2)), Integer (Viewport (3))); close (File); exception when others => Close (File); raise; end; end lucid_Screenshot; procedure Screenshot (Filename : in String; with_Alpha : in Boolean := False) is begin if with_Alpha then lucid_Screenshot (Filename); else opaque_Screenshot (Filename); end if; end Screenshot; ---------------- -- Video Capture -- -- We define global variables since it is not expected -- that more that one capture is taken at the same time. -- avi : ada.Streams.Stream_IO.File_type; frames : Natural; rate : Positive; width, height : Positive; bmp_size : U32; procedure write_RIFF_Headers is -- Written 1st time to take place (but # of frames unknown) -- Written 2nd time for setting # of frames, sizes, etc. -- calc_bmp_size : constant U32 := U32 (((width)) * height * 3); -- !! stuff to multiple of 4 !! index_size : constant U32 := U32 (frames) * 16; movie_size : constant U32 := 4 + U32 (frames) * (calc_bmp_size + 8); second_list_size : constant U32 := 4 + 64 + 48; first_list_size : constant U32 := (4 + 64) + (8 + second_list_size); file_size : constant U32 := 8 + (8 + first_list_size) + (4 + movie_size) + (8 + index_size); Stream : constant Stream_access := ada.Streams.Stream_IO.Stream (avi); procedure write_Intel is new write_Intel_x86_Number (U16, Stream); procedure write_Intel is new write_Intel_x86_Number (U32, Stream); microseconds_per_frame : constant U32 := U32 (1_000_000.0 / long_Float (rate)); begin bmp_size := calc_bmp_size; String'write (Stream, "RIFF"); U32 'write (Stream, file_size); String'write (Stream, "AVI "); String'write (Stream, "LIST"); write_Intel (first_list_size); String'write (Stream, "hdrl"); String'write (Stream, "avih"); write_Intel (U32' (56)); -- Begin of AVI Header write_Intel (microseconds_per_frame); write_Intel (U32'(0)); -- MaxBytesPerSec write_Intel (U32'(0)); -- Reserved1 write_Intel (U32'(16)); -- Flags (16 = has an index) write_Intel (U32 (frames)); write_Intel (U32'(0)); -- InitialFrames write_Intel (U32'(1)); -- Streams write_Intel (bmp_size); write_Intel (U32 (width)); write_Intel (U32 (height)); write_Intel (U32'(0)); -- Scale write_Intel (U32'(0)); -- Rate write_Intel (U32'(0)); -- Start write_Intel (U32'(0)); -- Length -- End of AVI Header String'write (Stream, "LIST"); write_Intel (second_list_size); String'write (Stream, "strl"); -- Begin of Str String'write (Stream, "strh"); write_Intel (U32'(56)); String'write (Stream, "vids"); String'write (Stream, "DIB "); write_Intel (U32'(0)); -- flags write_Intel (U32'(0)); -- priority write_Intel (U32'(0)); -- initial frames write_Intel (microseconds_per_frame); -- Scale write_Intel (U32'(1_000_000)); -- Rate write_Intel (U32'(0)); -- Start write_Intel (U32 (frames)); -- Length write_Intel (bmp_size); -- SuggestedBufferSize write_Intel (U32'(0)); -- Quality write_Intel (U32'(0)); -- SampleSize write_Intel (U32'(0)); write_Intel (U16 (width)); write_Intel (U16 (height)); -- End of Str String'write (Stream, "strf"); write_Intel (U32'(40)); -- Begin of BMI write_Intel (U32'(40)); -- BM header size (like BMP) write_Intel (U32 (width)); write_Intel (U32 (height)); write_Intel (U16'(1)); -- Planes write_Intel (U16'(24)); -- BitCount write_Intel (U32'(0)); -- Compression write_Intel (bmp_size); -- SizeImage write_Intel (U32'(3780)); -- XPelsPerMeter write_Intel (U32'(3780)); -- YPelsPerMeter write_Intel (U32'(0)); -- ClrUsed write_Intel (U32'(0)); -- ClrImportant -- End of BMI String'write (Stream, "LIST"); write_Intel (movie_size); String'write (Stream, "movi"); end Write_RIFF_headers; procedure start_Capture (AVI_Name : String; frame_Rate : Positive) is use GL, GL.Binding; Viewport : array (0 .. 3) of aliased GLint; begin Tasks.check; create (Avi, out_File, AVI_Name); Frames := 0; Rate := frame_Rate; glGetIntegerv (GL_VIEWPORT, Viewport (0)'unchecked_Access); Errors.log; Width := Positive (Viewport (2)); Height := Positive (Viewport (3)); -- NB: GL viewport resizing should be blocked during the video capture ! write_RIFF_Headers; end start_Capture; procedure capture_Frame is S : constant Stream_Access := Stream (Avi); procedure Write_Intel is new Write_Intel_x86_number (U32, s); begin String'write (S, "00db"); write_Intel (bmp_Size); write_raw_BGR_frame (S, Width, Height); Frames := Frames + 1; end capture_Frame; procedure stop_Capture is index_Size : constant U32 := U32 (Frames) * 16; S : constant Stream_Access := Stream (Avi); ChunkOffset : U32 := 4; procedure write_Intel is new write_Intel_x86_Number (U32, S); begin -- Write the index section -- String'write (S, "idx1"); write_Intel (index_Size); for f in 1 .. Frames loop String'write (S, "00db"); write_Intel (U32'(16)); -- Keyframe. write_Intel (ChunkOffset); ChunkOffset := ChunkOffset + bmp_Size + 8; write_Intel (bmp_Size); end loop; Set_Index (avi, 1); -- Go back to file beginning. write_RIFF_Headers; -- Rewrite headers with correct data. close (Avi); end stop_Capture; end openGL.IO;
libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_mouse_kempston_wheel_delta.asm
jpoikela/z88dk
640
101490
<filename>libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_mouse_kempston_wheel_delta.asm ; int16_t in_mouse_kempston_wheel_delta(void) SECTION code_clib SECTION code_input PUBLIC in_mouse_kempston_wheel_delta EXTERN asm_in_mouse_kempston_wheel_delta defc in_mouse_kempston_wheel_delta = asm_in_mouse_kempston_wheel_delta
oeis/153/A153141.asm
neoneye/loda-programs
11
90630
; A153141: Permutation of nonnegative integers: A059893-conjugate of A153151. ; Submitted by <NAME> ; 0,1,3,2,7,6,4,5,15,14,12,13,8,9,10,11,31,30,28,29,24,25,26,27,16,17,18,19,20,21,22,23,63,62,60,61,56,57,58,59,48,49,50,51,52,53,54,55,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,127,126,124,125,120,121,122,123,112,113,114,115,116,117,118,119,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,64,65,66,67 mov $1,$0 trn $0,1 seq $0,59893 ; Reverse the order of all but the most significant bit in binary expansion of n: if n = 1ab..yz then a(n) = 1zy..ba. seq $0,153151 ; Rotated binary decrementing: For n<2 a(n) = n, if n=2^k, a(n) = 2*n-1, otherwise a(n) = n-1. sub $0,1 seq $0,59893 ; Reverse the order of all but the most significant bit in binary expansion of n: if n = 1ab..yz then a(n) = 1zy..ba. cmp $1,0 cmp $1,0 mul $0,$1
.emacs.d/elpa/ada-mode-7.1.4/wisi-gpr.ads
caqg/linux-home
0
17531
-- Abstract : -- -- Ada implementation of: -- -- [1] gpr-wisi.el -- [2] gpr-indent-user-options.el -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, 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 MERCHAN- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- As a special exception under Section 7 of GPL version 3, you are granted -- additional permissions described in the GCC Runtime Library Exception, -- version 3.1, as published by the Free Software Foundation. pragma License (Modified_GPL); package Wisi.Gpr is Language_Protocol_Version : constant String := "1"; -- Defines the data passed to Initialize in Params. -- -- This value must match gpr-wisi.el -- gpr-wisi-language-protocol-version. -- Indent parameters from [2] Gpr_Indent : Integer := 3; Gpr_Indent_Broken : Integer := 2; Gpr_Indent_When : Integer := 3; -- Other parameters End_Names_Optional : Boolean := False; type Parse_Data_Type is new Wisi.Parse_Data_Type with null record; overriding procedure Initialize (Data : in out Parse_Data_Type; Lexer : in WisiToken.Lexer.Handle; Descriptor : access constant WisiToken.Descriptor; Base_Terminals : in WisiToken.Base_Token_Array_Access; Post_Parse_Action : in Post_Parse_Action_Type; Begin_Line : in WisiToken.Line_Number_Type; End_Line : in WisiToken.Line_Number_Type; Begin_Indent : in Integer; Params : in String); -- Call Wisi_Runtime.Initialize, then: -- -- If Params /= "", set all indent parameters from Params, in -- declaration order; otherwise keep default values. Boolean is -- represented by 0 | 1. Parameter values are space delimited. -- -- Also do any other initialization that Gpr_Data needs. end Wisi.Gpr;
pwnlib/shellcraft/templates/thumb/mov.asm
kristoff3r/pwntools
1
25799
<gh_stars>1-10 <% from pwnlib.shellcraft import common %> <%page args="dst, src"/> <%docstring> mov(dst, src) Returns THUMB code for moving the specified source value into the specified destination register. </%docstring> /* Set ${dst} = ${src} */ %if not isinstance(src, (int, long)): mov ${dst}, ${src} %else: <% srcu = src & 0xffffffff srcs = srcu - 2 * (srcu & 0x80000000) %> %if srcu == 0: eor ${dst}, ${dst} %elif srcu < 256: mov ${dst}, #${src} %elif -256 < srcs < 0: eor ${dst}, ${dst} sub ${dst}, #${-srcs} %else: <% shift1 = 0 while (1 << shift1) & src == 0: shift1 += 1 %> %if (0xff << shift1) & src == src: %if shift1 < 4: mov ${dst}, #${src >> shift1} lsl ${dst}, #4 lsr ${dst}, #{4 - shift1} %else: mov ${dst}, #${src >> shift1} lsl ${dst}, #${shift1} %endif %else: <% shift2 = 8 while (1 << shift2) & src == 0: shift2 += 1 %> %if ((0xff << shift2) | 0xff) & src == src: mov ${dst}, #${src >> shift2} lsl ${dst}, #${shift2} add ${dst}, #${src & 0xff} %else: <% shift3 = shift1 + 8 while (1 << shift3) & src == 0: shift3 += 1 %> %if ((0xff << shift1) | (0xff << shift3)) & src == src: mov ${dst}, #${src >> shift3} lsl ${dst}, #${shift3 - shift1} add ${dst}, #${(src >> shift1) & 0xff} lsl ${dst}, #${shift1} %else: <% id = common.label("value") extra = '' if (src & 0xff000000 == 0): src = src | 0xff000000 extra = '\n '.join([ "lsl %s, #8" % dst, "lsr %s, #8" % dst ]) %> ldr ${dst}, ${id} b ${id}_after ${id}: .word ${src} ${id}_after: ${extra} %endif %endif %endif %endif %endif
src/drivers/usb_u2222/sam-usb.adb
Fabien-Chouteau/samd51-hal
1
1086
<reponame>Fabien-Chouteau/samd51-hal ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2021, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with SAM_SVD.USB; use SAM_SVD.USB; package body SAM.USB is NVM_Software_Calibration_Area : constant := 16#00800080#; USB_Calibration_Addr : constant := NVM_Software_Calibration_Area + 4; type USB_Calibration is record TRANSP : UInt5; TRANSN : UInt5; TRIM : UInt3; Reserved : UInt3; end record with Volatile_Full_Access, Size => 16; for USB_Calibration use record TRANSP at 0 range 0 .. 4; TRANSN at 0 range 5 .. 9; TRIM at 0 range 10 .. 12; Reserved at 0 range 13 .. 15; end record; USB_Cal : USB_Calibration with Address => System'To_Address (USB_Calibration_Addr); function To_EP_Size (Size : UInt8) return EP_Packet_Size is (case Size is when 8 => S_8Bytes, when 16 => S_16Bytes, when 32 => S_32Bytes, when 64 => S_64Bytes, when 128 => S_128Bytes, -- when 256 => S_256Bytes, -- when 512 => S_512Bytes, -- when 1023 => S_1023Bytes, when others => raise Program_Error with "Invalid Size for EP" ); ---------------- -- Initialize -- ---------------- overriding procedure Initialize (This : in out UDC) is P : USB_Peripheral renames This.Periph.all; begin -- Reset the peripheral P.USB_DEVICE.CTRLA.SWRST := True; while P.USB_DEVICE.SYNCBUSY.SWRST loop null; end loop; P.USB_DEVICE.PADCAL.TRANSP := USB_Cal.TRANSP; P.USB_DEVICE.PADCAL.TRANSN := USB_Cal.TRANSN; P.USB_DEVICE.PADCAL.TRIM := USB_Cal.TRIM; P.USB_DEVICE.CTRLB.DETACH := True; -- Highest Quality of Service P.USB_DEVICE.QOSCTRL.CQOS := 3; P.USB_DEVICE.QOSCTRL.DQOS := 3; P.USB_DEVICE.CTRLB.SPDCONF := FS; P.USB_DEVICE.DESCADD := UInt32 (System.Storage_Elements.To_Integer (This.EP_Descs'Address)); end Initialize; -------------------- -- Request_Buffer -- -------------------- overriding function Request_Buffer (This : in out UDC; Ep : EP_Addr; Len : UInt11; Min_Alignment : UInt8 := 1) return System.Address is begin return Standard.USB.Utils.Allocate (This.Alloc, Alignment => UInt8'Max (Min_Alignment, EP_Buffer_Min_Alignment), Len => Len); end Request_Buffer; ----------- -- Start -- ----------- overriding procedure Start (This : in out UDC) is begin This.Periph.USB_DEVICE.CTRLA := (MODE => DEVICE, RUNSTDBY => True, ENABLE => True, SWRST => False, others => <>); while This.Periph.USB_DEVICE.SYNCBUSY.ENABLE loop null; end loop; This.Periph.USB_DEVICE.CTRLB.DETACH := False; This.EP_Descs (0).Bank0_Out.ADDR := This.EP0_Buffer'Address; if (UInt32 (System.Storage_Elements.To_Integer (This.EP0_Buffer'Address)) and 2#11#) /= 0 then raise Program_Error with "Invalid alignement for EP0 buffer"; end if; This.EP0_Buffer := (others => 42); end Start; ----------- -- Reset -- ----------- overriding procedure Reset (This : in out UDC) is begin null; end Reset; ---------- -- Poll -- ---------- overriding function Poll (This : in out UDC) return UDC_Event is P : USB_Peripheral renames This.Periph.all; begin -- End Of Reset if P.USB_DEVICE.INTFLAG.EORST then -- Clear flag P.USB_DEVICE.INTFLAG.EORST := True; return (Kind => Reset); end if; -- Endpoint events declare EPINT : UInt8 := P.USB_DEVICE.EPINTSMRY.EPINT.Val; EP_Status : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_Register; EP_Out_Size, EP_In_Size : UInt14; begin for Ep in P.USB_DEVICE.USB_DEVICE_ENDPOINT'Range loop exit when EPINT = 0; if True or else (EPINT and 1) /= 0 then EP_Status := P.USB_DEVICE.USB_DEVICE_ENDPOINT (Ep).EPINTFLAG; -- Setup Request if Ep = 0 and then EP_Status.RXSTP then P.USB_DEVICE.USB_DEVICE_ENDPOINT (0).EPINTFLAG := ( -- Clear the interrupt the RXSTP flag. RXSTP => True, -- Although Setup packet only set RXSTP bit, TRCPT0 bit -- could already be set by previous ZLP OUT Status (not -- handled until now). TRCPT0 => True, others => <>); declare Req : Setup_Data with Address => This.EP0_Buffer'Address; begin return (Kind => Setup_Request, Req => Req, Req_EP => 0); end; end if; -- Check transfer IN complete if EP_Status.TRCPT1 then P.USB_DEVICE.USB_DEVICE_ENDPOINT (Ep).EPINTFLAG := (TRCPT1 => True, TRFAIL1 => True, others => <>); EP_In_Size := This.EP_Descs (Ep).Bank1_In.PCKSIZE.BYTE_COUNT; return (Kind => Transfer_Complete, EP => (UInt4 (Ep), EP_In), BCNT => UInt11 (EP_In_Size)); end if; -- Check transfer OUT complete if EP_Status.TRCPT0 then EP_Out_Size := This.EP_Descs (Ep).Bank0_Out.PCKSIZE.BYTE_COUNT; P.USB_DEVICE.USB_DEVICE_ENDPOINT (Ep).EPINTFLAG := (TRCPT0 => True, others => <>); return (Kind => Transfer_Complete, EP => (UInt4 (Ep), EP_Out), BCNT => UInt11 (EP_Out_Size)); end if; end if; EPINT := Shift_Right (EPINT, 1); end loop; end; return No_Event; end Poll; --------------------- -- EP_Write_Packet -- --------------------- overriding procedure EP_Write_Packet (This : in out UDC; Ep : EP_Id; Addr : System.Address; Len : UInt32) is P : USB_Peripheral renames This.Periph.all; Num : constant Natural := Natural (Ep); begin if Num > This.Periph.USB_DEVICE.USB_DEVICE_ENDPOINT'Last then raise Program_Error with "Invalid endpoint number"; end if; if Len > UInt32 (UInt14'Last) then raise Program_Error with "Packet too big for endpoint"; end if; This.EP_Descs (Num).Bank1_In.ADDR := Addr; This.EP_Descs (Num).Bank1_In.PCKSIZE.BYTE_COUNT := UInt14 (Len); This.EP_Descs (Num).Bank1_In.PCKSIZE.MULTI_PACKET_SIZE := 0; -- Set the bank to ready to start the transfer P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTFLAG := (TRFAIL1 => True, others => <>); P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSSET.BK1RDY := True; end EP_Write_Packet; -------------- -- EP_Setup -- -------------- overriding procedure EP_Setup (This : in out UDC; EP : EP_Addr; Typ : EP_Type; Max_Size : UInt16) is P : USB_Peripheral renames This.Periph.all; Num : constant Natural := Natural (EP.Num); EPTYPE : constant UInt3 := (case Typ is when Control => 1, when Isochronous => 2, when Bulk => 3, when Interrupt => 4); begin if Num > This.Periph.USB_DEVICE.USB_DEVICE_ENDPOINT'Last then raise Program_Error with "Invalid endpoint number"; end if; case EP.Dir is when EP_Out => This.EP_Descs (Num).Bank0_Out.PCKSIZE.SIZE := To_EP_Size (This.Max_Packet_Size); This.EP_Descs (Num).Bank0_Out.PCKSIZE.BYTE_COUNT := 0; This.EP_Descs (Num).Bank0_Out.PCKSIZE.MULTI_PACKET_SIZE := 0; This.EP_Descs (Num).Bank0_Out.PCKSIZE.AUTO_ZLP := False; -- Clear flags P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTFLAG := (TRCPT0 => True, others => <>); -- Enable the endpoint with the requested type P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPCFG.EPTYPE0 := EPTYPE; -- Enable TRCPT interrupt -- /!\ If the endpoint is not enabled the interrupt will not be -- enabled. P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTENSET.TRCPT0 := True; when EP_In => This.EP_Descs (Num).Bank1_In.PCKSIZE.SIZE := To_EP_Size (This.Max_Packet_Size); This.EP_Descs (Num).Bank1_In.PCKSIZE.BYTE_COUNT := 0; This.EP_Descs (Num).Bank1_In.PCKSIZE.MULTI_PACKET_SIZE := 0; This.EP_Descs (Num).Bank1_In.PCKSIZE.AUTO_ZLP := False; -- Clear flags P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTFLAG := (TRCPT1 => True, others => <>); -- Enable the endpoint with the requested type P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPCFG.EPTYPE1 := EPTYPE; -- Enable TRCPT interrupt -- /!\ If the endpoint is not enabled the interrupt will not be -- enabled. P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTENSET.TRCPT1 := True; end case; end EP_Setup; ----------------------- -- EP_Ready_For_Data -- ----------------------- overriding procedure EP_Ready_For_Data (This : in out UDC; EP : EP_Id; Addr : System.Address; Size : UInt32; Ready : Boolean := True) is P : USB_Peripheral renames This.Periph.all; Num : constant Natural := Natural (EP); begin if Num > This.Periph.USB_DEVICE.USB_DEVICE_ENDPOINT'Last then raise Program_Error with "Invalid endpoint number"; end if; if Ready then if EP = 0 then -- TODO: Why? EP0 always on internal buffer? This.EP_Descs (0).Bank0_Out.ADDR := This.EP0_Buffer'Address; else This.EP_Descs (Num).Bank0_Out.ADDR := Addr; end if; -- Enable RXSTP interrupt P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTENSET.RXSTP := True; This.EP_Descs (Num).Bank0_Out.PCKSIZE.MULTI_PACKET_SIZE := UInt14 (Size); This.EP_Descs (Num).Bank0_Out.PCKSIZE.BYTE_COUNT := 0; -- Clear Bank0-Ready to say we are ready to receive data P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPINTFLAG := (TRFAIL0 => True, others => <>); P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSCLR.BK0RDY := True; else -- Set Bank0-Ready to say we are NOT ready to receive data P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSSET.BK0RDY := True; end if; end EP_Ready_For_Data; -------------- -- EP_Stall -- -------------- overriding procedure EP_Stall (This : in out UDC; EP : EP_Addr; Set : Boolean := True) is P : USB_Peripheral renames This.Periph.all; Num : constant Natural := Natural (EP.Num); begin if Integer (EP.Num) > This.Periph.USB_DEVICE.USB_DEVICE_ENDPOINT'Last then raise Program_Error with "Invalid endpoint number"; end if; case EP.Dir is when EP_Out => if Set then P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSSET.STALLRQ.Arr (0) := True; else P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSCLR.STALLRQ.Arr (0) := True; end if; when EP_In => if Set then P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSSET.STALLRQ.Arr (1) := True; else P.USB_DEVICE.USB_DEVICE_ENDPOINT (Num).EPSTATUSCLR.STALLRQ.Arr (1) := True; end if; end case; end EP_Stall; ----------------- -- Set_Address -- ----------------- overriding procedure Set_Address (This : in out UDC; Addr : UInt7) is begin This.Periph.USB_DEVICE.DADD := (ADDEN => True, DADD => Addr); end Set_Address; end SAM.USB;
src/asis/asis-data_decomposition-extensions.ads
My-Colaborations/dynamo
15
4494
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A S I S . D A T A _ D E C O M P O S I T I O N . E X T E N S I O N S -- -- -- -- S p e c -- -- -- -- Copyright (c) 1995-2008, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This package contains queries yielding various representation information -- which may be useful for ASIS applications, and which can not be obtained -- through the Asis.Data_Decomposition package as defined by the ASIS -- Standard. package Asis.Data_Decomposition.Extensions is generic type Constrained_Subtype is private; function Portable_Data_Value (Value : Constrained_Subtype) return Portable_Data; -- This is the inverse function for -- Asis.Data_Decomposition.Portable_Constrained_Subtype. Instantiated with -- an appropriate scalar type, (e.g., System.Integer, can be used to -- convert value to a data stream that can be used by ASIS Data -- Decomposition queries, in particular, for passing as an actual for the -- Value parameter of -- Asis.Data_Decomposition.Construct_Artificial_Data_Stream. -- -- Instantiated with a record type, can be used to convert a value to a -- data stream that can be analyzed by ASIS Data Decomposition queries. function Component_Name_Definition (Component : Record_Component) return Asis.Declaration; -- For the argument Compononent, returns the corresponding -- A_Defining_Identified Element. -- Asis.Data_Decomposition.Component_Declaration query can not be used to -- determine the name of the component in case if two or more record -- components are defined by the same component declaration or discriminant -- specification, that's why this query may be needed. -- -- All non-Nil component values are appropriate. -- -- Returns Defining_Name_Kinds: -- A_Defining_Identifier ---------------------------- -- Static type attributes -- ---------------------------- -- Queries defined in this section returns static representation -- attributes of types and subtypes. Some, but not all of the attributes -- defined in RM 95 which return representation information about types -- and subtypes and which are not functions are mapped onto -- Asis.Data_Decomposition.Extensions queries. -- --|AN Application Note: -- -- In contrast to Asis.Data_Decomposition queries which operates on type -- definitions, these queries operates on type and subtype defining names. -- The reason is that type and its subtypes may have different values of -- the same representation attribute, and this difference may be -- important for application. -------------------------------------------------------- -- Floating Point Types and Decimal Fixed Point Types -- -------------------------------------------------------- function Digits_Value (Floating_Point_Subtype : Asis.Element) return ASIS_Natural; -- Provided that Floating_Point_Subtype is the defining name of some -- floating point or decimal fixed point type or subtype (including types -- derived from floating point or decimal fixed point types), this -- function returns the requested decimal precision for this type or -- subtype, as defined in RM 95, 3.5.8(2), 3.5.10(7) -- -- Appropriate Defining_Name_Kinds -- A_Defining_Identifier, provided that it defines some floating -- point or decimal fixed point type -- or subtype ----------------------------------------------------- -- Fixed Point Types and Decimal Fixed Point Types -- ----------------------------------------------------- -- --|AN Application Note: -- -- For fixed point types, it is important to return the precise values of -- 'small' and 'delta'. The corresponding Ada attributes 'Small and 'Delta -- are defined in RM95 as being of universal_real type. But in this unit, -- we can not use universal_real as a return type of a query, and using -- any explicitly defined real type can not guarantee that the exact -- values of 'small' and 'delta' will be returned by the corresponding -- queries, since these values have arbitrary exact precision. -- -- To represent the value of universal_real type, the Small_Value -- and Delta_Value functions return a pair of integers representing -- the normalized fraction with integer numerator and denominator -- ("normalized means that the fraction is reduced to lowest terms), -- or alternatively a string is returned that contains the fraction -- represented in this manner. The latter form is the only one that -- can be used if the numerator or denominator is outside the range -- of ASIS_Integer. type Fraction is record Num : ASIS_Integer; Denum : ASIS_Positive; end record; function Small_Value (Fixed_Point_Subtype : Asis.Element) return String; -- Provided that Fixed_Point_Subtype is the defining name of some -- fixed point type or subtype (including types derived from fixed -- point types), this function returns the string image of 'small' of -- this type or subtype, as defined in RM 95, 3.5.10(2) as a string -- value representing a fraction (numerator / denominator), with no -- spaces, and both numerator and denominator represented in decimal. -- -- Appropriate Defining_Name_Kinds -- A_Defining_Identifier, provided that it defines some fixed point -- or decimal fixed point type or subtype function Small_Value (Fixed_Point_Subtype : Asis.Element) return Fraction; -- Provided that Fixed_Point_Subtype is the defining name of some -- fixed point type or subtype (including types derived from fixed -- point types), this function returns the fraction representation of -- 'small' of this type or subtype, as defined in RM 95, 3.5.10(2) -- ASIS_Failed is raised and the corresponding Diagnosis tring is set -- if the numerator or denominator is outside the representable range. -- -- Appropriate Defining_Name_Kinds -- A_Defining_Identifier, provided that it defines some fixed point -- or decimal fixed point type or subtype function Delta_Value (Fixed_Point_Subtype : Asis.Element) return String; -- Provided that Fixed_Point_Subtype is the defining name of some -- fixed point type or subtype (including types derived from fixed -- point types), this function returns the string image of 'delta' of -- this type or subtype, as defined in RM 95, 3.5.10(2) as a string -- value representing a fraction (numerator / denominator), with no -- spaces, and both numerator and denominator represented in decimal. -- -- Appropriate Defining_Name_Kinds -- A_Defining_Identifier, provided that it defines some fixed point -- or decimal fixed point type or subtype function Delta_Value (Fixed_Point_Subtype : Asis.Element) return Fraction; -- Provided that Fixed_Point_Subtype is the defining name of some -- fixed point type or subtype (including types derived from fixed -- point types), this function returns the fraction representation of -- 'delta' of this type or subtype, as defined in RM 95, 3.5.10(3) -- ASIS_Failed is raised and the corresponding Diagnosis tring is set -- if the numerator or denominator is outside the representable range. -- -- Appropriate Defining_Name_Kinds -- A_Defining_Identifier, provided that it defines some fixed point -- or decimal fixed point type or subtype ---------------------- -- Other Attributes -- ---------------------- -- The current version of Asis.Data_Decomposition.Extensions does not -- provide queries for the 'Fore or 'Aft attributes of fixed point types. ------------------------------- -- Decimal Fixed Point Types -- ------------------------------- function Scale_Value (Desimal_Fixed_Point_Subtype : Asis.Element) return ASIS_Natural; -- Provided that Desimal_Fixed_Point_Subtype is the defining name of some -- decimal fixed point type or subtype (including types derived from -- decimal fixed point types), this function returns the scale of -- this type or subtype, as defined in RM 95 3.5.10(11). -- -- Appropriate Defining_Name_Kinds -- A_Defining_Identifier, provided that it defines some decimal fixed -- point type or subtype end Asis.Data_Decomposition.Extensions;