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
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_xr/CiscoXr_lldp.g4
pranavbj-amzn/batfish
763
5039
parser grammar CiscoXr_lldp; import CiscoXr_common; options { tokenVocab = CiscoXrLexer; } s_lldp: LLDP NEWLINE lldp_inner*; lldp_inner : lldp_null | lldp_tlv_select ; lldp_null : ( EXTENDED_SHOW_WIDTH | HOLDTIME | REINIT | SUBINTERFACES | TIMER ) null_rest_of_line ; lldp_tlv_select: TLV_SELECT NEWLINE lldp_tlv_select_inner*; lldp_tlv_select_inner: lldpts_null; lldpts_null : ( MANAGEMENT_ADDRESS | PORT_DESCRIPTION | SYSTEM_CAPABILITIES | SYSTEM_DESCRIPTION | SYSTEM_NAME ) null_rest_of_line ;
mc-sema/validator/x86_64/tests/FIADDm32.asm
randolphwong/mcsema
2
87957
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_FPU_PE|FLAG_FPU_C1 ;TEST_FILE_META_END ; set up st0 to be PI FLDPI ;TEST_BEGIN_RECORDING lea rdi, [rsp-08] mov dword [rdi], 0x10000 FIADD dword [rdi] mov edi, 0x0 ;TEST_END_RECORDING
src/main/resources/adder.asm
kleinesfilmroellchen/ToyCpuEmulator
0
87550
<filename>src/main/resources/adder.asm load 30,a load 50,b add b out halt
src/are-installer-merges.adb
stcarrez/resource-embedder
7
3776
----------------------------------------------------------------------- -- are-installer-merges -- Web file merge -- Copyright (C) 2020, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Ada.Strings.Fixed; with Ada.Streams.Stream_IO; with Ada.Exceptions; with Ada.IO_Exceptions; with Ada.Unchecked_Deallocation; with Util.Beans.Objects; with Util.Log.Loggers; with Util.Files; with Util.Strings; with Util.Streams.Files; with Util.Streams.Texts; with Util.Streams.Buffered; with EL.Expressions; with Are.Utils; package body Are.Installer.Merges is use Util.Log; use Ada.Strings.Fixed; use Util.Beans.Objects; use Ada.Strings.Unbounded; use type Ada.Calendar.Time; procedure Process_Property (Rule : in out Merge_Rule; Node : in DOM.Core.Node); procedure Process_Replace (Rule : in out Merge_Rule; Node : in DOM.Core.Node); Log : constant Loggers.Logger := Loggers.Create ("Are.Installer.Merges"); -- ------------------------------ -- Extract the <property name='{name}'>{value}</property> to setup the -- EL context to evaluate the source and target links for the merge. -- ------------------------------ procedure Process_Property (Rule : in out Merge_Rule; Node : in DOM.Core.Node) is use Util.Beans.Objects.Maps; Name : constant String := Are.Utils.Get_Attribute (Node, "name"); Value : constant String := Are.Utils.Get_Data_Content (Node); Pos : constant Natural := Util.Strings.Index (Name, '.'); begin if Pos = 0 then Rule.Variables.Bind (Name, To_Object (Value)); return; end if; -- A composed name such as 'jquery.path' must be split so that we store -- the 'path' value within a 'jquery' Map_Bean object. We handle only -- one such composition. declare Param : constant String := Name (Name'First .. Pos - 1); Tag : constant Unbounded_String := To_Unbounded_String (Param); Var : constant EL.Expressions.Expression := Rule.Variables.Get_Variable (Tag); Val : Object := Rule.Params.Get_Value (Param); Child : Map_Bean_Access; begin if Is_Null (Val) then Child := new Map_Bean; Val := To_Object (Child); Rule.Params.Set_Value (Param, Val); else Child := Map_Bean_Access (To_Bean (Val)); end if; Child.Set_Value (Name (Pos + 1 .. Name'Last), To_Object (Value)); if Var.Is_Null then Rule.Variables.Bind (Param, Val); end if; end; end Process_Property; procedure Process_Replace (Rule : in out Merge_Rule; Node : in DOM.Core.Node) is From : constant String := Are.Utils.Get_Data_Content (Node, "from"); To : constant String := Are.Utils.Get_Data_Content (Node, "to"); begin Rule.Replace.Include (From, To); end Process_Replace; procedure Iterate_Properties is new Are.Utils.Iterate_Nodes (Merge_Rule, Process_Property); procedure Iterate_Replace is new Are.Utils.Iterate_Nodes (Merge_Rule, Process_Replace); -- ------------------------------ -- Create a distribution rule to copy a set of files or directories. -- ------------------------------ function Create_Rule (Node : in DOM.Core.Node) return Distrib_Rule_Access is Result : constant Merge_Rule_Access := new Merge_Rule; begin Iterate_Properties (Result.all, Node, "property", False); Iterate_Replace (Result.all, Node, "replace", False); Result.Context.Set_Variable_Mapper (Result.Variables'Access); Result.Start_Mark := Are.Utils.Get_Attribute (Node, "merge-start", DEFAULT_MERGE_START); Result.End_Mark := Are.Utils.Get_Attribute (Node, "merge-end", DEFAULT_MERGE_END); return Result.all'Access; end Create_Rule; -- ------------------------------ -- Get a name to qualify the installation rule (used for logs). -- ------------------------------ overriding function Get_Install_Name (Rule : in Merge_Rule) return String is pragma Unreferenced (Rule); begin return "merge"; end Get_Install_Name; overriding procedure Install (Rule : in Merge_Rule; Path : in String; Files : in File_Vector; Context : in out Context_Type'Class) is use Ada.Streams; type Mode_Type is (MERGE_NONE, MERGE_LINK, MERGE_SCRIPT); procedure Error (Message : in String; Arg1 : in String := ""); function Get_Target_Name (Link : in String) return String; function Get_Target_Path (Link : in String) return String; function Get_Filename (Line : in String) return String; function Get_Source (Line : in String; Tag : in String) return String; function Find_Match (Buffer : in Stream_Element_Array) return Stream_Element_Offset; procedure Prepare_Merge (Line : in String); procedure Include (Line : in String; Pattern : in String); procedure Process (Line : in String); Root_Dir : constant String := Context.Get_Generation_Path (To_String (Rule.Dir)); Source : constant String := Get_Source_Path (Files, False); Target : constant String := Context.Get_Generation_Path (Path); Dir : constant String := Ada.Directories.Containing_Directory (Target); Build : constant String := "23"; -- Context.Get_Parameter ("dynamo.build"); Start_Mark : constant String := "<!-- " & To_String (Rule.Start_Mark) & " "; End_Mark : constant String := "<!-- " & To_String (Rule.End_Mark) & " "; File_Time : constant Ada.Calendar.Time := Ada.Directories.Modification_Time (Source); Modtime : Ada.Calendar.Time := File_Time; Output : aliased Util.Streams.Files.File_Stream; Merge : aliased Util.Streams.Files.File_Stream; Merge_Path : UString; Merge_Name : UString; Text : Util.Streams.Texts.Print_Stream; Mode : Mode_Type := MERGE_NONE; Line_Num : Natural := 0; Inc_Error : Natural := 0; procedure Error (Message : in String; Arg1 : in String := "") is Line : constant String := Util.Strings.Image (Line_Num); begin Context.Error (Source & ":" & Line & ": " & Message, Arg1); end Error; function Get_Target_Name (Link : in String) return String is Expr : EL.Expressions.Expression; File : Util.Beans.Objects.Object; begin Expr := EL.Expressions.Create_Expression (Link, Rule.Context); File := Expr.Get_Value (Rule.Context); declare Name : constant String := To_String (File); begin -- Drop the first '/' if there is one. if Name'Length > 0 and then Name (Name'First) = '/' then return Name (Name'First + 1 .. Name'Last); else return Name; end if; end; end Get_Target_Name; function Get_Target_Path (Link : in String) return String is Name : constant String := Get_Target_Name (Link); begin return Util.Files.Compose (Root_Dir, Name); end Get_Target_Path; function Get_Filename (Line : in String) return String is Pos : Natural := Index (Line, "link="); Last : Natural; begin if Pos > 0 then Mode := MERGE_LINK; else Pos := Index (Line, "script="); if Pos > 0 then Mode := MERGE_SCRIPT; end if; if Pos = 0 then return ""; end if; end if; Pos := Index (Line, "="); Last := Util.Strings.Index (Line, ' ', Pos + 1); if Last = 0 then return ""; end if; return Line (Pos + 1 .. Last - 1); end Get_Filename; function Get_Source (Line : in String; Tag : in String) return String is Pos : Natural := Index (Line, Tag); Last : Natural; begin if Pos = 0 then return ""; end if; Pos := Pos + Tag'Length; if Pos > Line'Last or else (Line (Pos) /= '"' and Line (Pos) /= ''') then return ""; end if; Last := Util.Strings.Index (Line, Line (Pos), Pos + 1); if Last = 0 then return ""; end if; return Line (Pos + 1 .. Last - 1); end Get_Source; procedure Prepare_Merge (Line : in String) is Link : constant String := Get_Filename (Line); Path : constant String := Get_Target_Name (Link); Target_Path : constant String := Util.Files.Compose (Root_Dir, Path); Parent_Dir : constant String := Ada.Directories.Containing_Directory (Target_Path); begin if Link'Length = 0 then Error ("invalid empty file name"); return; end if; case Mode is when MERGE_LINK => Text.Write ("<link media='screen' type='text/css' rel='stylesheet'" & " href='"); Text.Write (Link); Text.Write ("?build="); Text.Write (Build); Text.Write ("'/>" & ASCII.LF); when MERGE_SCRIPT => Text.Write ("<script type='text/javascript' src='"); Text.Write (Link); Text.Write ("?build="); Text.Write (Build); Text.Write ("'></script>" & ASCII.LF); when MERGE_NONE => null; end case; if Rule.Level >= Util.Log.INFO_LEVEL then Log.Info (" create {0}", Path); end if; if not Ada.Directories.Exists (Parent_Dir) then Ada.Directories.Create_Path (Parent_Dir); end if; Modtime := File_Time; Merge_Path := To_Unbounded_String (Target_Path); Merge_Name := To_Unbounded_String (Path); Merge.Create (Mode => Ada.Streams.Stream_IO.Out_File, Name => Target_Path); end Prepare_Merge; Current_Match : Util.Strings.Maps.Cursor; function Find_Match (Buffer : in Stream_Element_Array) return Stream_Element_Offset is Iter : Util.Strings.Maps.Cursor := Rule.Replace.First; First : Stream_Element_Offset := Buffer'Last + 1; begin while Util.Strings.Maps.Has_Element (Iter) loop declare Value : constant String := Util.Strings.Maps.Key (Iter); Match : Stream_Element_Array (1 .. Value'Length); for Match'Address use Value'Address; Pos : Stream_Element_Offset; begin Pos := Buffer'First; while Pos + Match'Length < Buffer'Last loop if Buffer (Pos .. Pos + Match'Length - 1) = Match then if First > Pos then First := Pos; Current_Match := Iter; end if; exit; end if; Pos := Pos + 1; end loop; end; Util.Strings.Maps.Next (Iter); end loop; return First; end Find_Match; procedure Free is new Ada.Unchecked_Deallocation (Object => Ada.Streams.Stream_Element_Array, Name => Util.Streams.Buffered.Buffer_Access); procedure Include (Line : in String; Pattern : in String) is Source : constant String := Get_Source (Line, Pattern); Target : constant String := Get_Target_Path (Source); Input : Util.Streams.Files.File_Stream; Size : Stream_Element_Offset; Last : Stream_Element_Offset; Pos : Stream_Element_Offset; Next : Stream_Element_Offset; Buffer : Util.Streams.Buffered.Buffer_Access; Time : Ada.Calendar.Time; begin if Source'Length = 0 then Inc_Error := Inc_Error + 1; if Inc_Error > 5 then return; end if; Error ("expecting a '{0}' in the line to identify the file to include", Pattern); if Inc_Error = 5 then Error ("may be the end marker '{0}' was not correct?", To_String (Rule.End_Mark)); end if; return; end if; if Rule.Level >= Util.Log.INFO_LEVEL then Log.Info (" include {0}", Target); end if; Time := Ada.Directories.Modification_Time (Target); if Time > Modtime then Modtime := Time; end if; Input.Open (Name => Target, Mode => Ada.Streams.Stream_IO.In_File); Size := Stream_Element_Offset (Ada.Directories.Size (Target)); Buffer := new Stream_Element_Array (1 .. Size); Input.Read (Buffer.all, Last); Input.Close; Pos := 1; while Pos < Last loop Next := Find_Match (Buffer (Pos .. Last)); if Next > Pos then Merge.Write (Buffer (Pos .. Next - 1)); end if; exit when Next >= Last; declare Value : constant String := Util.Strings.Maps.Key (Current_Match); Replace : constant String := Util.Strings.Maps.Element (Current_Match); Content : Stream_Element_Array (1 .. Replace'Length); for Content'Address use Replace'Address; begin Merge.Write (Content); Pos := Next + Value'Length; end; end loop; Free (Buffer); exception when Ex : Ada.IO_Exceptions.Name_Error => Error ("cannot read {0}", Ada.Exceptions.Exception_Message (Ex)); end Include; procedure Process (Line : in String) is Pos : Natural; begin Line_Num := Line_Num + 1; case Mode is when MERGE_NONE => Pos := Index (Line, Start_Mark); if Pos = 0 then Text.Write (Line); Text.Write (ASCII.LF); return; end if; Text.Write (Line (Line'First .. Pos - 1)); Prepare_Merge (Line (Pos + 10 .. Line'Last)); when MERGE_LINK => Pos := Index (Line, End_Mark); if Pos > 0 then Merge.Close; if not Rule.Source_Timestamp then Modtime := Ada.Directories.Modification_Time (To_String (Merge_Path)); end if; Rule.Add_File (Name => To_String (Merge_Name), Path => To_String (Merge_Path), Modtime => Modtime, Override => True); Mode := MERGE_NONE; return; end if; Include (Line, "href="); when MERGE_SCRIPT => Pos := Index (Line, End_Mark); if Pos > 0 then Merge.Close; if not Rule.Source_Timestamp then Modtime := Ada.Directories.Modification_Time (To_String (Merge_Path)); end if; Rule.Add_File (Name => To_String (Merge_Name), Path => To_String (Merge_Path), Modtime => Modtime, Override => True); Mode := MERGE_NONE; return; end if; Include (Line, "src="); end case; end Process; begin if Rule.Level >= Util.Log.INFO_LEVEL then Log.Info ("webmerge {0}", Path); end if; Ada.Directories.Create_Path (Dir); Output.Create (Name => Target, Mode => Ada.Streams.Stream_IO.Out_File); Text.Initialize (Output'Unchecked_Access, 16 * 1024); Util.Files.Read_File (Source, Process'Access); Text.Flush; Output.Close; Rule.Add_File (Path, Target, File_Time); end Install; end Are.Installer.Merges;
wof/lcs/123p/99.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
243547
<gh_stars>1-10 copyright zengfr site:http://github.com/zengfr/romhack 0079B0 move.b ($1a,PC,D0.w), ($99,A0) [123p+ 28, 123p+ 2A, enemy+28, enemy+2A] 0079B6 move.w ($8,A1), D1 [123p+ 99, enemy+99] 007E98 moveq #$0, D0 [123p+ 99, enemy+99] 007ECC bra $7ea4 007F2E move.b D0, ($99,A1) 007F32 bra $7ea2 [123p+ 99, enemy+99] 0082FA bne $8308 [123p+ 99, enemy+99] 01173C move.w ($a,PC,D0.w), D1 [123p+ 99] 011C3E cmpi.b #$6, ($99,A0) [enemy+CE] 011C44 bne $11c4a [123p+ 99, enemy+99] 05E50A bne $5e5b8 [123p+ 99, enemy+99] copyright zengfr site:http://github.com/zengfr/romhack
Project4/Sandbox/testmain3.asm
orrinjelo/virtual-machine
0
163646
<reponame>orrinjelo/virtual-machine<gh_stars>0 ; GLOBALS =========================================================== SIZE .INT 7 cnt .INT 7 tenth .INT 0 c .BYT 0 .BYT 0 .BYT 0 .BYT 0 .BYT 0 .BYT 0 .BYT 0 data .INT 0 flag .INT 0 opdv .INT 0 debug .INT 0 ; Program vars PLUS .BYT '+' MINUS .BYT '-' spc .BYT 32 ret .BYT 10 EOT .BYT 3 ; End of text LTUE .INT -42 at .BYT '@' ; Strings opderr .BYT 32 .BYT 'i' .BYT 's' .BYT 32 .BYT 'n' .BYT 'o' .BYT 't' .BYT 32 .BYT 'a' .BYT 32 .BYT 'n' .BYT 'u' .BYT 'm' .BYT 'b' .BYT 'e' .BYT 'r' .BYT 10 .BYT 3 ; EOT getdataerr .BYT 'N' .BYT 'u' .BYT 'm' .BYT 'b' .BYT 'e' .BYT 'r' .BYT 32 .BYT 't' .BYT 'o' .BYT 'o' .BYT 32 .BYT 'B' .BYT 'i' .BYT 'g' .BYT 10 .BYT 3 ; END OF TEXT goodnum .BYT 'O' .BYT 'p' .BYT 'e' .BYT 'r' .BYT 'a' .BYT 'n' .BYT 'd' .BYT 32 .BYT 'i' .BYT 's' .BYT 32 .BYT 3 ; EOT ; Other useful values ZERO .INT 0 I .INT 1 II .INT 2 III .INT 3 IV .INT 4 V .INT 5 VI .INT 6 VII .INT 7 VIII .INT 8 IX .INT 9 X .INT 10 cZERO .BYT 48 cI .BYT 49 cII .BYT 50 cIII .BYT 51 cIV .BYT 52 cV .BYT 53 cVI .BYT 54 cVII .BYT 55 cVIII .BYT 56 cIX .BYT 57 _s .BYT '+' _k .INT 1 _j .BYT '7' JMP START ; === print ========================================================= print MOV R1 FP ; Copy over the FP ADI R1 -36 ; Bypass the ret addr, PFP, and Registers LDR R2 (R1) ; Load in the value at the 3rd slot up in AR LDB R3 (R2) ; R2 = addr of argument ps_ LDB R0 EOT CMP R0 R3 BRZ R0 eps_ TRP 3 ADI R2 1 LDB R3 (R2) JMP ps_ ; === Begin return call eps_ MOV SP FP ; Test for underflow MOV R5 SP CMP R6 SB BGT R6 UNDERFLOW ; === Store Ret value LDR R7 ZERO ; Return value ; === Return to last location MOV R6 FP ; Return address pointed to by FP ADI R6 -4 LDR R6 (R6) JMR R6 ; === END print ===================================================== ; === reset ========================================================= ; Reset c to all 0's ; Assign values to data, opdv, cnt, and flag reset MOV R6 FP ADI R6 -36 ; Access w LDR R0 (R6) ADI R6 -4 ; x LDR R1 (R6) ADI R6 -4 ; y LDR R2 (R6) ADI R6 -4 ; z LDR R4 (R6) ; === End variable initiation LDR R6 ZERO LDA R5 c for0 LDR R7 SIZE CMP R7 R6 BRZ R7 ef0 LDR R7 ZERO STB R7 (R5) ADI R6 1 ADI R5 1 JMP for0 ef0 STR R0 data STR R1 opdv STR R2 cnt STR R4 flag ; === Begin return call MOV SP FP ; Test for underflow MOV R5 SP CMP R6 SB BGT R6 UNDERFLOW ; === Store Ret value LDR R7 ZERO ; Return value ; === Return to last location MOV R6 FP ; Return address pointed to by FP ADI R6 -4 LDR R6 (R6) JMR R6 ; === END reset ===================================================== ; === getdata ======================================================= ; Read one char at a time from the keyboard after a ; newline ‘\n’ has been entered. If there is room ; place the char in the array c ; otherwise indicate the number is too big and ; flush the keyboard input. getdata LDR R0 cnt LDR R1 SIZE CMP R0 R1 BLT R0 isroom ; Get data if there is room ; === Begin Function call MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -4 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 252 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ADI SP -4 LDA R6 getdataerr STR R6 (SP) ; === Function call JMP print ; === Restore the registers MOV R6 FP ADI R6 -12 LDR R0 (R6) ADI R6 -4 LDR R1 (R6) ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call ; === Begin Function call eps2 MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -4 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 216 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ; === Function call JMP flush ; === Restore the registers MOV R6 FP ADI R6 -12 LDR R0 (R6) ADI R6 -4 LDR R1 (R6) ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call JMP gdendif isroom LDA R5 c LDR R4 cnt ADD R5 R4 TRP 4 STB R3 (R5) ADI R4 1 STR R4 cnt gdendif MOV SP FP ; Test for underflow MOV R5 SP CMP R6 SB BGT R6 UNDERFLOW ; === Store Ret value LDR R7 ZERO ; Return value ; === Return to last location MOV R6 FP ; Return address pointed to by FP ADI R6 -4 LDR R6 (R6) JMR R6 ; === END getdata =================================================== ; Convert char j to an integer if possible. ; If the flag is not set use the sign indicator s ; and the tenths indicator to compute the actual ; value of j. Add the value to the accumulator opdv. ; ======== FUNCTION START opd ======================================= opd MOV SP FP ; Test for underflow MOV R5 SP CMP R5 SB BGT R5 UNDERFLOW ; == Load passed params s, k, j MOV R7 FP ; Copy over the FP ADI R7 -33 ; Bypass the ret addr, PFP, and Registers LDB R0 (R7) ; Load char s ADI R7 -4 LDR R1 (R7) ; Load int k ADI R7 -1 LDB R2 (R7) ; Load char j ; ======== END FUNCTION HEADING ===================================== LDR R4 ZERO ; int t = 0 LDB R5 cZERO CMP R5 R2 ; if (j == '0') BNZ R5 ELSE1 ADI R4 0 ; t = 0 JMP ENDIF ELSE1 LDB R5 cI CMP R5 R2 ; else if (j == '1') BNZ R5 ELSE2 ADI R4 1 ; t = 1 JMP ENDIF ELSE2 LDB R5 cII CMP R5 R2 ; else if (j == '2') BNZ R5 ELSE3 ADI R4 2 ; t = 2 JMP ENDIF ELSE3 LDB R5 cIII CMP R5 R2 ; else if (j == '3') BNZ R5 ELSE4 ADI R4 3 ; t = 3 JMP ENDIF ELSE4 LDB R5 cIV CMP R5 R2 ; else if (j == '4') BNZ R5 ELSE5 ADI R4 4 ; t = 4 JMP ENDIF ELSE5 LDB R5 cV CMP R5 R2 ; else if (j == '5') BNZ R5 ELSE6 ADI R4 5 ; t = 5 JMP ENDIF ELSE6 LDB R5 cVI CMP R5 R2 ; else if (j == '6') BNZ R5 ELSE7 ADI R4 6 ; t = 6 JMP ENDIF ELSE7 LDB R5 cVII CMP R5 R2 ; else if (j == '7') BNZ R5 ELSE8 ADI R4 7 ; t = 7 JMP ENDIF ELSE8 LDB R5 cVIII CMP R5 R2 ; else if (j == '8') BNZ R5 ELSE9 ADI R4 8 ; t = 8 JMP ENDIF ELSE9 LDB R5 cIX CMP R5 R2 ; else if (j == '9') BNZ R5 ELSEF ADI R4 9 ; t = 9 JMP ENDIF ELSEF MOV R3 R2 TRP 3 ; Start Print LDA R5 opderr LDB R3 (R5) ps1 LDB R4 EOT CMP R4 R3 BRZ R4 eps1 TRP 3 ADI R5 1 LDB R3 (R5) JMP ps1 ; End Print eps1 LDB R5 flag ADI R5 1 STR R5 flag ; flag = 1 ENDIF LDR R5 flag BNZ R5 ENDIFFLAG ; if (!flag) LDB R5 PLUS CMP R5 R0 BNZ R5 SPLUSELSE ; if (s == '+') MUL R4 R1 ; t *= k JMP ENDSPLUS SPLUSELSE MOV R5 R1 SUB R5 R1 SUB R5 R1 ; -k MUL R4 R5 ; t *= -k ENDSPLUS LDR R7 opdv ADD R7 R4 ; opdv + t STR R7 opdv ENDIFFLAG MOV R5 FP ; Return address pointed to by FP ADI R5 -4 LDR R5 (R5) JMR R5 ; ======== FUNCTION END opd ========================================= ; === FUNCTION flush ================================================ ; === flush ========================================================= flush LDR R0 ZERO STR R0 data flw1 TRP 4 STB R3 c LDB R0 ret CMP R0 R3 BNZ R0 flw1 ; begin return call MOV SP FP ; Test for underflow MOV R5 SP CMP R6 SB BGT R6 UNDERFLOW ; === Store Ret value LDR R7 ZERO ; Return value ; === Return to last location MOV R6 FP ; Return address pointed to by FP ADI R6 -4 LDR R6 (R6) JMR R6 ; === END FUNCTION flush ========================================== ;==== Main ========================================================== ; === Begin Function call START MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -20 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 360 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ADI SP -4 LDR R6 I STR R6 (SP) ; w ADI SP -4 LDR R6 ZERO STR R6 (SP) ; x ADI SP -4 LDR R6 ZERO STR R6 (SP) ; y ADI SP -4 LDR R6 ZERO STR R6 (SP) ; z ; === Function call JMP reset ; === Restore the registers ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call ; === Begin Function call MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -20 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 216 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ; === Function call JMP getdata ; === Restore the registers ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call whi1 LDB R0 c LDB R1 at CMP R1 R0 BRZ R1 ewh1 ; While c[0] != '@' LDB R1 PLUS LDB R2 MINUS CMP R1 R0 CMP R2 R0 BRZ R1 if2 BRZ R2 if2 ; if c[0] == '+' || c[0] == '-' JMP el1 ; === Begin Function call if2 MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -20 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 216 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ; === Function call JMP getdata ; === Restore the registers ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call JMP eif1 el1 LDA R1 c ; c[1] = c[0] ADI R1 1 STB R0 (R1) LDB R1 PLUS ; c[0] = '+' STB R1 c LDR R1 cnt ; cnt++ ADI R1 1 STR R1 cnt JMP eif1 eif1 LDR R0 data BRZ R0 ewh2 ; while (data) LDR R1 cnt ADI R1 -1 LDA R2 c ADD R2 R1 LDB R2 (R2) LDB R4 ret CMP R2 R4 BNZ R2 els2 ; if c[cnt-1] == '\n' LDR R0 ZERO ; data = 0 STR R0 data LDR R0 I ; tenth = 1 STR R0 tenth ADI R1 -1 ; cnt = cnt - 2 STR R1 cnt whi3 LDR R4 flag LDR R5 cnt BNZ R4 ewh3 BRZ R5 ewh3 ; === Begin Function call MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -6 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 360 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ADI SP -1 LDB R6 c STB R6 (SP) ADI SP -4 LDR R6 tenth STR R6 (SP) ADI SP -1 LDA R6 c LDR R7 cnt ADD R6 R7 LDB R6 (R6) STB R6 (SP) ; === Function call JMP opd ; === Restore the registers MOV R6 FP ADI R6 -12 LDR R0 (R6) ADI R6 -4 LDR R1 (R6) ADI R6 -4 LDR R2 (R6) ADI R6 -4 LDR R3 (R6) ADI R6 -4 LDR R4 (R6) ADI R6 -4 LDR R5 (R6) ADI R6 -4 ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call LDR R1 cnt ; cnt-- ADI R1 -1 STR R1 cnt LDR R1 tenth LDR R2 X MUL R1 R2 STR R1 tenth JMP whi3 ewh3 LDR R0 flag BRZ R0 prf JMP eprf ; === Begin Function call prf MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -4 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 252 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ADI SP -4 LDA R6 goodnum STR R6 (SP) ; === Function call JMP print ; === Restore the registers MOV R6 FP ADI R6 -12 LDR R0 (R6) ADI R6 -4 LDR R1 (R6) ADI R6 -4 LDR R2 (R6) ADI R6 -4 LDR R3 (R6) ADI R6 -4 LDR R4 (R6) ADI R6 -4 LDR R5 (R6) ADI R6 -4 ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call LDR R3 opdv TRP 1 LDB R3 ret TRP 3 eprf JMP eif1 ; end while ; === Begin Function call els2 MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -20 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 216 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ; === Function call JMP getdata ; === Restore the registers ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call ; else JMP eif1 ; end while ; === Begin Function call ewh2 MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -20 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 360 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ADI SP -4 LDR R6 I STR R6 (SP) ; w ADI SP -4 LDR R6 ZERO STR R6 (SP) ; x ADI SP -4 LDR R6 ZERO STR R6 (SP) ; y ADI SP -4 LDR R6 ZERO STR R6 (SP) ; z ; === Function call JMP reset ; === Restore the registers ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call ; === Begin Function call MOV R7 SP ; Test for overflow ADI R7 -8 ; Adjust for Rtn address & PFP ADI R7 -24 ; Registers ADI R7 -20 ; Vars CMP R7 SL BLT R7 OVERFLOW ; === Store Ret and PFP MOV R7 FP ; Save FP in R1, this will be PFP MOV FP SP ; Point at current activation record ADI SP -4 ; Adjust SP for ret address MOV R6 PC ; PC incremented by 1 instruction ADI R6 216 ; Compute return address STR R6 (SP) ; Push return address ADI SP -4 ; Adjust for PFP STR R7 (SP) ; Push PFP to top of stack ; === Store registers ADI SP -4 ; R0 STR R0 (SP) ADI SP -4 ; R1 STR R1 (SP) ADI SP -4 ; R2 STR R2 (SP) ADI SP -4 ; R3 STR R3 (SP) ADI SP -4 ; R4 STR R4 (SP) ADI SP -4 ; R5 STR R5 (SP) ; === Store variables ; === Function call JMP getdata ; === Restore the registers ; === Roll back SP and FP MOV SP FP ADI FP -8 LDR FP (FP) ; === End function call JMP whi1 ewh1 ADI R0 0 ; NOP place holder. :) ; LDR R3 LTUE ; TRP 1 nodbz TRP 0 UNDERFLOW TRP 0 OVERFLOW TRP 0
src/main/antlr4/imports/Directions.g4
Yucukof/edu-antlr4-toy-parser-to-nbc
0
155
lexer grammar Directions; NORTH: 'north'|'NORTH'; SOUTH: 'south'|'SOUTH'; EAST: 'east'|'EAST'; WEST: 'west'|'WEST';
programs/oeis/092/A092352.asm
neoneye/loda
22
99867
<reponame>neoneye/loda<filename>programs/oeis/092/A092352.asm ; A092352: G.f.: (1+3*x^3)/((1-x)^2*(1-x^3)^2). ; 1,2,3,9,15,21,36,51,66,94,122,150,195,240,285,351,417,483,574,665,756,876,996,1116,1269,1422,1575,1765,1955,2145,2376,2607,2838,3114,3390,3666,3991,4316,4641,5019,5397,5775,6210,6645,7080,7576,8072,8568,9129,9690 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 mov $5,$0 add $5,1 mov $6,$0 mov $7,0 lpb $5 mov $0,$6 sub $5,1 sub $0,$5 add $0,1 seq $0,78688 ; Continued fraction expansion of e^(1/4). mov $3,$0 mul $3,2 div $3,4 add $7,$3 lpe add $1,$7 lpe mov $0,$1
kernel/compiler/dictionary.asm
paulscottrobson/color-forth-old-next
1
102379
<gh_stars>1-10 ; *************************************************************************************** ; *************************************************************************************** ; ; Name : dictionary.asm ; Author : <NAME> (<EMAIL>) ; Date : 7th December 2018 ; Purpose : Dictionary handler. ; ; *************************************************************************************** ; *************************************************************************************** ; *********************************************************************************************** ; ; Add Dictionary Word. Name is a tagged string at BC ends in $80-$FF, uses the current ; page/pointer values. A indicates whether it goes in FORTH ($00) or MACRO ($80) ; ; *********************************************************************************************** DICTAddWord: push af ; registers to stack. push bc push de push hl push ix push bc ; put word address in HL pop hl and $80 ; mask off forth/macro bit put in C ld c,a ld b,-1 ; work out length in B push hl __DICTGetLength: inc b inc hl bit 7,(hl) jr z,__DICTGetLength pop hl ; HL = Tag. inc hl ; HL = first character ld a,DictionaryPage ; switch to dictionary page call PAGESwitch ld ix,$C000 ; IX = Start of dictionary __DICTFindEndDictionary: ld a,(ix+0) ; follow down chain to the end or a jr z,__DICTCreateEntry ld e,a ld d,0 add ix,de jr __DICTFindEndDictionary __DICTCreateEntry: ld a,b add a,5 ld (ix+0),a ; offset is length + 5 ld a,(HerePage) ; code page ld (ix+1),a ld de,(Here) ; code address ld (ix+2),e ld (ix+3),d ld a,b ; OR length with FORTH/MACRO bit. or c ld (ix+4),a ; put length in. ex de,hl ; put name in DE __DICTAddCopy: ld a,(de) ; copy byte over as 7 bit ASCII. ld (ix+5),a inc ix inc de djnz __DICTAddCopy ; until string is copied over. ld (ix+5),0 ; write end of dictionary zero. call PAGERestore pop ix ; restore and exit pop hl pop de pop bc pop af ret ; *********************************************************************************************** ; ; Find word in dictionary. BC points to tagged string which is the name. ; A is the search type ($00 = FORTH,$80 = MACRO) ; ; On exit, HL is the address and E the page number with CC if found, ; CS set and HL=DE=0 if not found. ; ; *********************************************************************************************** DICTFindWord: push bc ; save registers - return in EHL Carry push ix ld h,b ; put address of name in HL. ld l,c ld c,a ; puth the FORTH/MACRO mask in C ld a,DictionaryPage ; switch to dictionary page call PAGESwitch ld ix,$C000 ; dictionary start __DICTFindMainLoop: ld a,(ix+0) ; examine offset, exit if zero. or a jr z,__DICTFindFail ld a,(ix+4) ; get this entries forth/macro byte xor c ; compare against one passed in and $80 ; only interested in bit 7. jr nz,__DICTFindNext ; if different go to next push ix ; save pointers on stack. push hl ld a,(ix+4) ; get the word length to test into B and $1F ld b,a ; into B inc hl ; skip over tag byte __DICTCheckName: ld a,(ix+5) ; compare dictionary vs character. cp (hl) ; compare vs the matching character. jr nz,__DICTFindNoMatch ; no, not the same word. inc hl ; HL point to next character inc ix djnz __DICTCheckName bit 7,(hl) ; is the next character in HL a tag/$80 jr z,__DICTFindNoMatch ; otherwise you have failed to match. pop hl ; Found a match. restore HL and IX pop ix ld d,0 ; D = 0 for neatness. ld e,(ix+1) ; E = page ld l,(ix+2) ; HL = address ld h,(ix+3) xor a ; clear the carry flag. jr __DICTFindExit __DICTFindNoMatch: ; this one doesn't match. pop hl ; restore HL and IX pop ix __DICTFindNext: ld e,(ix+0) ; DE = offset ld d,$00 add ix,de ; next word. jr __DICTFindMainLoop ; and try the next one. __DICTFindFail: ld de,$0000 ; return all zeros. ld hl,$0000 scf ; set carry flag __DICTFindExit: push af call PAGERestore pop af pop ix ; pop registers and return. pop bc ret
oeis/248/A248105.asm
neoneye/loda-programs
11
24468
<reponame>neoneye/loda-programs ; A248105: Positions of 1,0,1 in the Thue-Morse sequence (A010060). ; Submitted by <NAME> ; 3,12,15,20,27,36,43,48,51,60,63,68,75,80,83,92,99,108,111,116,123,132,139,144,147,156,163,172,175,180,187,192,195,204,207,212,219,228,235,240,243,252,255,260,267,272,275,284,291,300,303,308,315,320,323,332,335,340,347,356,363,368,371,380,387,396,399,404,411,420,427,432,435,444,447,452,459,464,467,476,483,492,495,500,507,516,523,528,531,540,547,556,559,564,571,576,579,588,591,596 mov $2,$0 seq $0,72939 ; Define a sequence c depending on n by: c(1)=1 and c(2)=n; c(k+2) = (c(k+1) + c(k))/2 if c(k+1) and c(k) have the same parity; otherwise c(k+2)=abs(c(k+1)-2*c(k)); sequence gives values of n such that lim k -> infinity c(k) = infinity. add $1,$0 mul $1,2 mod $2,2 add $1,$2 mov $0,$1 sub $0,3
oeis/016/A016748.asm
neoneye/loda-programs
11
14249
; A016748: a(n) = (2*n)^8. ; 0,256,65536,1679616,16777216,100000000,429981696,1475789056,4294967296,11019960576,25600000000,54875873536,110075314176,208827064576,377801998336,656100000000,1099511627776,1785793904896,2821109907456,4347792138496,6553600000000,9682651996416,14048223625216,20047612231936,28179280429056,39062500000000,53459728531456,72301961339136,96717311574016,128063081718016,167961600000000,218340105584896,281474976710656,360040606269696,457163239653376,576480100000000,722204136308736,899194740203776 pow $0,8 mul $0,256
testsuite/league/arguments_environment_test.adb
svn2github/matreshka
24
17915
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <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$ ------------------------------------------------------------------------------ -- Test program to help to test access to arguments and environment. ------------------------------------------------------------------------------ with Ada.Wide_Wide_Text_IO; with League.Application; with League.Strings; with League.String_Vectors; procedure Arguments_Environment_Test is use League.Strings; Args : constant League.String_Vectors.Universal_String_Vector := League.Application.Arguments; begin if Args.Element (1) /= To_Universal_String ("проверка") then raise Program_Error; end if; for J in 1 .. Args.Length loop Ada.Wide_Wide_Text_IO.Put_Line (Args.Element (J).To_Wide_Wide_String); end loop; Ada.Wide_Wide_Text_IO.Put_Line (League.Application.Environment.Value (League.Strings.To_Universal_String ("PATH")).To_Wide_Wide_String); end Arguments_Environment_Test;
libsrc/_DEVELOPMENT/stdlib/c/sccz80/atoll_callee.asm
ahjelm/z88dk
640
4719
; long long atoll(const char *buf) SECTION code_clib SECTION code_stdlib PUBLIC atoll_callee EXTERN asm_atoll, l_store_64_dehldehl_mbc atoll_callee: pop hl pop bc ex (sp),hl push ix push bc ; save result * call asm_atoll pop bc ; bc = result * pop ix jp l_store_64_dehldehl_mbc ; store result ; SDCC bridge for Classic IF __CLASSIC PUBLIC _atoll_callee defc _atoll_callee = atoll_callee ENDIF
ironman_reactor.asm
mike-bourgeous/led_reactor
1
25669
<filename>ironman_reactor.asm ; ----------------------------------------------------------------------- ; Iron Man-style reactor LED controller ; (C)2010 <NAME> #include <p12f508.inc> ; ----------------------------------------------------------------------- ; Configuration bits: adapt to your setup and needs __CONFIG _IntRC_OSC & _WDT_OFF & _CP_OFF & _MCLRE_OFF ; ----------------------------------------------------------------------- ; constants #define FADE_LOOPS 6 #define CYCLE_LOOPS 3 ; ----------------------------------------------------------------------- ; variables vars UDATA d1 res 1 d2 res 1 d3 res 1 tmp1 res 1 onval res 1 offval res 1 i res 1 loops res 1 ; ----------------------------------------------------------------------- ; oscillator calibration calibration CODE 0x1ff dw 0x0c1e ; ----------------------------------------------------------------------- ; relocatable code PROG CODE start ; Initialize chip settings movwf OSCCAL movlw b'11001111' option movlw 0x00 movwf GPIO tris GPIO ;goto flash_leds goto cycle_leds_init ;goto fade_leds_init ; Turn all outputs on for testing movlw 0xff movwf GPIO goto $ ; PWM fade_leds_init movlw FADE_LOOPS movwf loops fade_leds movlw 0x01 movwf tmp1 clrf offval movlw 0xff movwf onval rising call pwm_cycle incfsz tmp1 goto rising movlw 0xff movwf tmp1 falling call pwm_cycle decfsz tmp1 goto falling decfsz loops goto fade_leds clrf GPIO call Delay_50ms goto cycle_leds_init ; Does a single PWM cycle. Pass duty cycle in tmp1, on value in onval, off value in offval. pwm_cycle ; On phase - tmp1 ns movfw onval movwf GPIO movfw tmp1 movwf i nop pwm_on call Delay_10ns ;goto $+1 ;goto $+1 decfsz i goto pwm_on ; Off phase - (256-tmp1) ns movfw offval movwf GPIO clrf i movfw tmp1 subwf i pwm_off call Delay_10ns ;goto $+1 ;goto $+1 decfsz i goto pwm_off retlw 0 cycle_leds_init movlw CYCLE_LOOPS movwf loops cycle_leds bsf STATUS, C movlw b'11111110' movwf tmp1 movlw 6 movwf i cycle_leds_loop movfw tmp1 movwf GPIO call Delay_50ms rlf tmp1 decfsz i goto cycle_leds_loop decfsz loops goto cycle_leds clrf GPIO goto fade_leds_init flash_leds movlw 0x00 movwf GPIO call Delay_500ms movlw 0x3f movwf GPIO call Delay_500ms goto flash_leds ; loop forever Delay_10ns ;6 cycles goto $+1 goto $+1 goto $+1 ;4 cycles (including call) return Delay_50ms ;49993 cycles movlw 0x0E movwf d1 movlw 0x28 movwf d2 Delay_50ms_0 decfsz d1, f goto $+2 decfsz d2, f goto Delay_50ms_0 ;3 cycles goto $+1 nop ;4 cycles (including call) return Delay_500ms ;499994 cycles movlw 0x03 movwf d1 movlw 0x18 movwf d2 movlw 0x02 movwf d3 Delay_500ms_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_500ms_0 ;2 cycles goto $+1 ;4 cycles (including call) return END
tools-src/gnu/gcc/gcc/ada/widechar.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
27733
<reponame>enfoTek/tomato.linksys.e2000.nvram-mod ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- W I D E C H A R -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 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 2, 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 COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: this package uses the generic subprograms in System.Wch_Cnv, which -- completely encapsulate the set of wide character encoding methods, so no -- modifications are required when adding new encoding methods. with Opt; use Opt; with System.WCh_Cnv; use System.WCh_Cnv; with System.WCh_Con; use System.WCh_Con; package body Widechar is --------------------------- -- Is_Start_Of_Wide_Char -- --------------------------- function Is_Start_Of_Wide_Char (S : Source_Buffer_Ptr; P : Source_Ptr) return Boolean is begin case Wide_Character_Encoding_Method is when WCEM_Hex => return S (P) = ASCII.ESC; when WCEM_Upper | WCEM_Shift_JIS | WCEM_EUC | WCEM_UTF8 => return S (P) >= Character'Val (16#80#); when WCEM_Brackets => return P <= S'Last - 2 and then S (P) = '[' and then S (P + 1) = '"' and then S (P + 2) /= '"'; end case; end Is_Start_Of_Wide_Char; ----------------- -- Length_Wide -- ----------------- function Length_Wide return Nat is begin return WC_Longest_Sequence; end Length_Wide; --------------- -- Scan_Wide -- --------------- procedure Scan_Wide (S : Source_Buffer_Ptr; P : in out Source_Ptr; C : out Char_Code; Err : out Boolean) is function In_Char return Character; -- Function to obtain characters of wide character escape sequence function In_Char return Character is begin P := P + 1; return S (P - 1); end In_Char; function WC_In is new Char_Sequence_To_Wide_Char (In_Char); begin C := Char_Code (Wide_Character'Pos (WC_In (In_Char, Wide_Character_Encoding_Method))); Err := False; exception when Constraint_Error => C := Char_Code (0); P := P - 1; Err := True; end Scan_Wide; -------------- -- Set_Wide -- -------------- procedure Set_Wide (C : Char_Code; S : in out String; P : in out Natural) is procedure Out_Char (C : Character); -- Procedure to store one character of wide character sequence procedure Out_Char (C : Character) is begin P := P + 1; S (P) := C; end Out_Char; procedure WC_Out is new Wide_Char_To_Char_Sequence (Out_Char); begin WC_Out (Wide_Character'Val (C), Wide_Character_Encoding_Method); end Set_Wide; --------------- -- Skip_Wide -- --------------- procedure Skip_Wide (S : String; P : in out Natural) is function Skip_Char return Character; -- Function to skip one character of wide character escape sequence function Skip_Char return Character is begin P := P + 1; return S (P - 1); end Skip_Char; function WC_Skip is new Char_Sequence_To_Wide_Char (Skip_Char); Discard : Wide_Character; begin Discard := WC_Skip (Skip_Char, Wide_Character_Encoding_Method); end Skip_Wide; end Widechar;
programs/oeis/030/A030101.asm
karttu/loda
0
90644
<filename>programs/oeis/030/A030101.asm ; A030101: a(n) is the number produced when n is converted to binary digits, the binary digits are reversed and then converted back into a decimal number. ; 0,1,1,3,1,5,3,7,1,9,5,13,3,11,7,15,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,1,33,17,49,9,41,25,57,5,37,21,53,13,45,29,61,3,35,19,51,11,43,27,59,7,39,23,55,15,47,31,63,1,65,33,97,17,81,49,113,9,73,41,105,25,89,57,121,5,69,37,101,21,85,53,117,13,77,45,109,29,93,61,125,3,67,35,99,19,83,51,115,11,75,43,107,27,91,59,123,7,71,39,103,23,87,55,119,15,79,47,111,31,95,63,127,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159 mov $1,$0 add $0,2 lpb $0,1 div $0,2 sub $0,1 sub $1,$0 mov $2,$0 add $0,2 mul $1,2 sub $1,$2 lpe mul $1,2 div $1,4
oeis/007/A007160.asm
neoneye/loda-programs
11
246390
<gh_stars>10-100 ; A007160: Number of diagonal dissections of a convex (n+6)-gon into n regions. ; Submitted by <NAME>(s2) ; 1,20,225,1925,14014,91728,556920,3197700,17587350,93486536,483367885,2442687975,12109051500,59053512000,283963030560,1348824395160,6338392712550,29503515951000,136173391604250,623760137794794,2837765901615876,12830687578253600,57687379921990000,258036428781495000,1148778180935215740,5092251470031437712,22482616666565081565,98895396544366364075,433523488531780456600,1894348154025766188288,8252975559922289612416,35854933598114873081840,155364230812405655190150,671562047460616464310200 mov $2,$0 mul $0,2 add $0,6 bin $0,$2 mov $1,$2 add $1,4 bin $1,3 mul $0,$1 div $0,4
src/commands-generate.adb
GLADORG/glad-cli
0
10079
<filename>src/commands-generate.adb with Ada.Containers; use Ada.Containers; with Ada.Directories; use Ada.Directories; with Blueprint; use Blueprint; with AAA.Strings; use AAA.Strings; with Ada.Text_IO; with Ada.Command_Line; with Templates_Parser; with CLIC.TTY; with Filesystem; with Commands; package body Commands.Generate is package IO renames Ada.Text_IO; package TT renames CLIC.TTY; ------------- -- Execute -- ------------- overriding procedure Execute ( Cmd : in out Command; Args : AAA.Strings.Vector) is begin if Args.Length > 1 then declare Name : String := Element (Args, 2); Blueprint : String := Args.First_Element; Blueprint_Path : String := Compose(Get_Blueprint_Folder,Blueprint); Current : String := Current_Directory; ToDo : Action := Write; begin if Cmd.Dry_Run then IO.Put_Line(TT.Emph("You specified the dry-run flag, so no changes will be written.")); ToDo := DryRun; end if; Templates_Parser.Insert (Commands.Translations, Templates_Parser.Assoc ("NAME", Name)); if Exists (Blueprint_Path) then Iterate (Blueprint_Path, Current, ToDo); IO.Put_Line (TT.Success( "Successfully generated " & Blueprint) & " " & TT.Warn (TT.Bold (Name))); else IO.Put_Line (TT.Error("Blueprint" & " " & Blueprint_Path & " " & "not found")); end if; end; else IO.Put_Line(TT.Error("Command requires a blueprint and a name to be specified.")); end if; end Execute; overriding function Long_Description(Cmd : Command) return AAA.Strings.Vector is Description : AAA.Strings.Vector := AAA.Strings.Empty_Vector; Blueprints : AAA.Strings.Vector := Filesystem.Read_Directory(Get_Blueprint_Folder, false); begin Append(Description, TT.Description("Generates new code from blueprints.")); Description.New_Line; Description.Append(TT.Underline("Available blueprints")); for A_Blueprint of Blueprints loop Append(Description, TT.Emph (A_Blueprint)); end loop; return Description; end Long_Description; -------------------- -- Setup_Switches -- -------------------- overriding procedure Setup_Switches (Cmd : in out Command; Config : in out CLIC.Subcommand.Switches_Configuration) is use CLIC.Subcommand; begin Define_Switch (Config, Cmd.Dry_Run'Access, "", "-dry-run", "Dry-run"); end Setup_Switches; end Commands.Generate;
Library/Kernel/Graphics/graphicsFontDriver.asm
steakknife/pcgeos
504
21749
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC/GEOS MODULE: graphicsFontDriver.asm FILE: graphicsFontDriver.asm AUTHOR: <NAME>, Mar 3, 1992 ROUTINES: Name Description ---- ----------- GLB GrCallFontDriver Find the correct font driver and call it. GLB FontDrDeleteLRUChar Delete the least recently used character(s) to find free space INT FindLRUChar Find the least recently used character INT AdjustPointers Adjust pointers to chars after deleted char INT ShiftData Shift data over deleted character, update table entry GLB FontDrFindFontInfo Find FontInfo structure for a font GLB FontDrFindOutlineData Find OutlineDataEntry for a font, and calculate styles that need to be implemented algorithmically. GLB FontDrAddFont Add a font to the system GLB FontDrDeleteFont Delete a font from the system GLB FontDrAddFonts INT FontLoadFont GLB FontFindFontFileName GLB FontDrGetFontIDFromFile GLB FontDrFindFileName REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 3/ 3/92 Initial revision DESCRIPTION: This contains common routines for use by the Font Drivers $Id: graphicsFontDriver.asm,v 1.1 97/04/05 01:13:21 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDriverCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrCallFontDriver %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the correct font driver and call it. CALLED BY: GLOBAL PASS: di - handle of GState ax - function to call rest - depends on function called (can be bx, cx, dx, bp) RETURN: carry - set if error DESTROYED: ax (if not returned) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 5/17/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrCallFontDriver proc far uses di .enter push bx, ds call LockFontGStateDS ;ds <- seg addr of font mov di, ax ;di <- function to call mov ax, ds:FB_maker ;ax <- driver ID (FontMaker) call FontDrUnlockFont ;done with font pop bx, ds call GrCallFontDriverID .leave ret GrCallFontDriver endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrDeleteLRUChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete the least recently used character(s) to find free space CALLED BY: Font Drivers (GLOBAL) PASS: ds - seg addr of font buffer ax - size of data to free RETURN: none DESTROYED: none PSEUDO CODE/STRATEGY: while ((cursize + size(char) > MAX_FONT_SIZE) && (chars > 0)) { for (i = first ; i < last ; i++) { LRU = MIN(LRU, char[i].usage); } for (i = first ; i < last ; i++) { if (char[i].ptr > char[LRU].ptr) { char[i].ptr -= char[LRU].size; } } delete(char[LRU]); } KNOWN BUGS/SIDE EFFECTS/IDEAS: Does not resize block smaller -- leaves the newly found space free REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrDeleteLRUChar proc far uses bx, cx, dx, di, si, es .enter segmov es, ds, cx ;ds <- seg addr of font if DBCS_PCGEOS mov cx, ds:FB_lastChar sub cx, ds:FB_firstChar inc cx ;cx <- # of characters else mov cl, ds:FB_lastChar sub cl, ds:FB_firstChar inc cl clr ch ;cx <- # of characters endif deleteChar: call FindLRUChar ;find least recently used cmp si, -1 ;see if no characters left je noChars ;branch if no chars left call AdjustPointers ;adjust pointers after char call ShiftData ;shift data downward mov bx, ds:FB_dataSize ;bx <- current size add bx, ax ;bx <- size + new char sub bx, MAX_FONT_SIZE ;see if small enough ja deleteChar ;if so, keep deleting noChars: EC < push ax > EC < mov ax, ds ;ax <- seg addr of font > EC < call ECCheckFontBufAX > EC < pop ax > .leave ret FontDrDeleteLRUChar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FindLRUChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the least recently used character. CALLED BY: FontDrDeleteLRUChar PASS: ds - seg addr of font cx - # of characters in font RETURN: si - offset of LRU character entry (si == -1 if no characters left) bx - size of character data (including header) di - offset of char data (CharData) DESTROYED: bx, dx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FindLRUChar proc near uses ax, cx, bp .enter mov bx, ds:FB_heapCount ;bx <- current usage counter clr dx ;dx <- current score mov si, -1 ;si <- ptr to LRU mov bp, 0xffff clr di charLoop: cmp ds:FB_charTable[di].CTE_dataOffset, CHAR_MISSING jbe nextChar ;if no data, don't count mov ax, bx ;ax <- heap count if DBCS_PCGEOS ; ; DBCS fonts have the LRU count stored only for regions ; test ds:FB_flags, mask FBF_IS_REGION jz noLRU push si mov si, ds:FB_charTable[di].CTE_dataOffset sub ax, ds:[si].RCD_usage ;ax <- char's score pop si noLRU: else sub ax, ds:FB_charTable[di].CTE_usage ;ax <- char's score endif cmp ax, dx ;see if new oldest jb nextChar ;branch if not ja newLRU ;branch if new LRU cmp ds:FB_charTable[di].CTE_dataOffset, bp ja nextChar ;branch if after current LRU newLRU: mov si, di ;si <- ptr to LRU char mov dx, ax ;dx <- new low score mov bp, ds:FB_charTable[di].CTE_dataOffset nextChar: add di, size CharTableEntry ;advance to next char loop charLoop ;loop while more characters cmp si, -1 ;see if no chars left je afterSize ;branch if no chars left mov di, bp ;di <- ptr to LRU char data test ds:FB_flags, mask FBF_IS_REGION jz bitmapChars ;branch if not region chars mov bx, ds:[di].RCD_size ;bx <- size of character afterSize: .leave ret bitmapChars: ; ; The font is a bitmap font. We don't normally expect to ; need to do the LRU thing on bitmap fonts, but it may ; happen as: pointsize -> 128 && # chars -> 255 ; mov al, ds:[di].CD_pictureWidth ;al <- width in bits add al, 7 ;round to next byte shr al, 1 shr al, 1 shr al, 1 ;al <- width in bytes mov bl, ds:[di].CD_numRows ;bl <- height of char mul bl ;ax <- size of char data add ax, SIZE_CHAR_HEADER ;add size of header mov bx, ax ;bx <- size of char jmp afterSize FindLRUChar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AdjustPointers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Adjust pointers to chars after deleted char. CALLED BY: FontDrDeleteLRUChar PASS: es - seg addr of font cx - # of characters in font di - offset of char data being deleted (CharData) bx - size of character being deleted RETURN: none DESTROYED: dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ AdjustPointers proc near uses cx, di .enter mov dx, di ;dx <- offset of deleted data clr di charLoop: cmp ds:FB_charTable[di].CTE_dataOffset, dx ;see if after char jbe nextChar ;branch if before sub ds:FB_charTable[di].CTE_dataOffset, bx ;adjust pointer nextChar: add di, size CharTableEntry ;advance to next char loop charLoop ;loop while more chars .leave ret AdjustPointers endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ShiftData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shift data over deleted character, update table entry CALLED BY: FontDrDeleteLRUChar PASS: si - offset of char to delete (CharTableEntry) di - offset of char data (CharData) ds, es - seg addr of font bx - size of char to delete RETURN: ds:FB_dataSize - updated to new size DESTROYED: si, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ShiftData proc near uses cx .enter mov ds:FB_charTable[si].CTE_dataOffset, CHAR_NOT_BUILT mov si, di ;es:di <- dest (this char) add si, bx ;ds:si <- source (next char) mov cx, ds:FB_dataSize ;cx <- ptr to end of font sub cx, si ;cx <- # of bytes to shift rep movsb ;shift me jesus sub ds:FB_dataSize, bx ;update size of font .leave ret ShiftData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrFindFontInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find FontInfo structure for a font CALLED BY: Font Drivers (GLOBAL) PASS: ds - seg addr of font info cx -- font ID (FontID) RETURN: ds:di - ptr to FontInfo for font carry - set if found DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 3/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrFindFontInfo proc far uses bx .enter call FarIsFontAvail mov di, bx ;ds:di <- ptr to FontInfo .leave ret FontDrFindFontInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrFindOutlineData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find OutlineDataEntry for a font, and calculate styles that need to be implemented algorithmically. CALLED BY: Font Drivers (GLOBAL) PASS: ds:di - ptr to FontInfo for font SBCS<bx - index of data to load (OutlineDataFlag) > al - style (TextStyle) RETURN: SBCS <ds:di - ptr to OutlineEntry > DBCS <ds:di - ptr to OutlineDataEntry.ODE_extraData > al - styles to implement (TextStyle) DESTROYED: none PSEUDO CODE/STRATEGY: smallest = (all styles); while (! end of list) { if (issubset(font style, requested style)) { smallest = min(weighted difference, smallest); } } return (smallest); - to determine if a set of styles is a subset of the requested styles: issubset = (((requested AND font) XOR font) == 0) - to get the weighted difference of styles (assuming is a subset): difference = (requested AND font) with the styles organized such that the most difficult to emulate with software has the highest value: outline - done in font driver bold - done in font driver italic - done in font driver superscript - done in font driver subscript - done in font driver strike through - done in kernel underline - done in kernel KNOWN BUGS/SIDE EFFECTS/IDEAS: Currently defaults to first set of data if none are subsets of the requested styles. Should *not* be called if there is no outline data. REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 3/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrFindOutlineData proc far uses bx, dx, si, bp .enter if FULL_EXECUTE_IN_PLACE EC < push bx, si > EC < movdw bxsi, dsdi > EC < call ECAssertValidFarPointerXIP > EC < pop bx, si > endif SBCS < push bx > clr dh ;dh <- initial difference mov bp, di add bp, ds:[di].FI_outlineEnd ;bp <- ptr to end of table add di, ds:[di].FI_outlineTab ;di <- ptr to start of table EC < cmp bp, di ;> EC < ERROR_E FONTMAN_FIND_OUTLINE_DATA_CALLED_WITH_BITMAP_FONT ;> mov si, di ;si <- ptr to entry to use ; ; In the loop: ; al - TextStyle requested ; ; ds:di - ptr to current entry ; dl - TextStyle of current entry ; bl - current difference from TextStyle requested ; ; ds:si - ptr to entry to use ; dh - difference of TextStyle for entry to use (ie. smallest) ; FO_loop: cmp di, bp ;at end of list? jae endList ;yes, exit mov dl, ds:[di].ODE_style ;dl <- style of outline cmp dl, al ;an exact match? je exactMatch ;branch if exact match mov bh, al and bh, dl mov bl, bh ;bl <- weighted difference xor bh, dl ;bh <- zero iff subset jne notSubset ;branch if not a subset cmp bl, dh ;cmp with minimum so far jb notSubset ;branch if larger difference mov si, di ;si <- new ptr to entry mov dh, bl ;dh <- new minimum difference notSubset: add di, size OutlineDataEntry ;advance to next entry jmp FO_loop ;and loop exactMatch: mov si, di ;ds:si <- ptr to current entry clr al ;al <- no styles to implement jmp gotStyles endList: xor al, dh ;al <- styles to implement gotStyles: mov di, si ;di <- off of OutlineDataEntry SBCS < pop si ;si <- index of data to load> SBCS < add di, si ;ds:di <- ptr to OutlineEntry> add di, (size ODE_style + size ODE_weight) .leave ret FontDrFindOutlineData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrAddFont %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a font to the system CALLED BY: Font Drivers (GLOBAL) PASS: ds:si - ptr to FontInfo & corresponding entries: PointSizeEntry - for bitmap sizes, if any OutlineDataEntry - for outlines, if any ax - size of FontInfo & corresponding entries cx - FontID for font RETURN: carry - set if error ax - error code (FontAddDeleteError) DESTROYED: none (ax if not returned) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 3/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrAddFont proc far uses ds, si, es, di, cx, bx .enter if FULL_EXECUTE_IN_PLACE EC < push bx > EC < mov bx, ds > EC < call ECAssertValidFarPointerXIP > EC < pop bx > endif EC < call ECCheckFontInfo ;> push cx push ds, si call FarLockInfoBlock ;ds <- seg addr of font info ; ; See if the font is already in the system ; call FarIsFontAvail ;font already in system? jc fontExistsError ;branch if already loaded ; ; See if we have too many fonts. If so, don't add this one. ; If not, up the number of fonts we've got loaded. ; push ds,ax,dx,cx mov dx, FONTS_AVAIL_HANDLE ;dx <- handle of chunk ChunkSizeHandle ds, dx, ax ;ax <- size of chunk mov cx,size FontsAvailEntry clr dx div cx ;ax <- number of ;entries cmp ax,MAX_FONTS pop ds,ax,dx,cx jl cont stc jmp tooManyFonts cont: ; ; Add a chunk for the FontInfo, et al. ; mov cx, ax ;cx <- size of chunk call LMemAlloc mov di, ax ;di <- chunk handle mov di, ds:[di] ;ds:di <- ptr to chunk segmov es, ds ;es:di <- ptr to chunk pop ds, si ;ds:si <- ptr to new FontInfo rep movsb ;copy me jesus segmov ds, es ;ds <- seg addr of font info push ax ;save chunk handle ; ; Add a FontsAvailEntry for the font ; mov ax, FONTS_AVAIL_HANDLE ;ax <- handle of chunk ChunkSizeHandle ds, ax, cx ;cx <- size of chunk push cx ;save old size add cx, (size FontsAvailEntry) ;cx <- new size of chunk call LMemReAlloc ; ; Point the FontsAvailEntry at the FontInfo chunk ; mov si, ax mov si, ds:[si] ;ds:si <- ptr to chunk pop ax ;ax <- old chunk size add si, ax ;ds:si <- ptr to new space pop ds:[si].FAE_infoHandle ;store chunk of FontInfo pop ds:[si].FAE_fontID ;store FontID value mov {char}ds:[si].FAE_fileName, C_NULL ;carry <- clear from add done: call FarUnlockInfoBlock .leave ret fontExistsError: mov ax, FADE_FONT_ALREADY_EXISTS ;ax <- FontAddDeleteError errorCommon: add sp, (size word)*3 ;clean up stack stc ;carry <- set for error jmp done tooManyFonts: mov ax, FADE_TOO_MANY_FONTS jmp errorCommon FontDrAddFont endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrAddFonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Adds fonts given from list of font file names to the system. If a font is already in the system, it will not be replaced. All of the fonts that were successfully added, will have a TRUE value in the last byte of there FileLongName field. CALLED BY: GLOBAL PASS: bx - handle of font file list cx - number of font files to add RETURN: carry = set if error (memory allocation failed) DESTROYED: nothing SIDE EFFECTS: Sends message GWNT_FONTS_ADDED to GCNSLT_FONT_CHANGES All the fonts successfully added, will the last byte in there FontLongName field marked as true. PSEUDO CODE/STRATEGY: save current directory change to the font standard path lock memory for list of font file names passed in alloc memory for list of FontIDs successfully added loop: load in the font info from the font file move on to next font if this fails call FontDrAddFont to add the font if this fails move on to next font save the FontID of the font just added look the font up in the avail list. if the font is not there an error occurred, move on to the next font put the font file name in the fonts avail entry mark the font file name entry as successfully added if there are fonts still to add, move on to the next one end loop unlock the list of font file names send out notification that fonts have been added - this notification includes the list of font files succesffully added restory original directory REVISION HISTORY: Name Date Description ---- ---- ----------- IP 2/24/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrAddFonts proc far fontFileList local hptr push bx fontCount local word push cx fontsAddedCount local word fontInfoHandle local hptr fontsAddedList local word fontsAddedHandle local hptr uses ax,bx,cx,dx,si,di,bp .enter ; if there are no files to add leave ; tst cx LONG jz exit clr ss:[fontsAddedCount] ; call FilePushDir mov ax, SP_FONT call FileSetStandardPath call MemLock ; lock the list of fonts LONG jc almostExit mov es,ax clr dx ;es:dx <- ptr to font ;file name ; ; allocate block for list of successfully added font ID, which ; will be sent out with the notification ; mov_tr ax,cx shl ax,1 mov cx,ALLOC_DYNAMIC_LOCK call MemAllocFar LONG jc allocError mov ss:[fontsAddedList],ax mov ss:[fontsAddedHandle],bx addFontLoop: call FontLoadFont ; bx <- handle to block with font info ; ax <- size font info block & ; corresponding entries ; ; if there is an error loading the font, move on to the next ; font. ; jc nextFontLoadError push ax ;save the size of the font info block & ;entries ; ; add the font ; mov ss:[fontInfoHandle],bx call MemLock mov ds,ax pop ax clr si mov cx,ds:[FI_fontID] call FontDrAddFont ; ; free the memory allocated for the font info ; read in from the font file ; pushf mov bx,ss:[fontInfoHandle] call MemFree popf ; ;if the font already exists or there was any other problem ;adding it move on to the next font ; jc nextFont ; ; add the FontID to list of FontIDs added ; push es mov es,ss:[fontsAddedList] ;store fontID in mov di,ss:[fontsAddedCount] ;buffer shl di,1 EC< EC_BOUNDS es di> mov es:[di],cx inc ss:[fontsAddedCount] pop es ; ; FontDrAddFont adds the fonts, but it set the file name in ; the FontsAvailEntry to Null, so it is set here to the file name ; push es call FarLockInfoBlock call FarIsFontAvail ; ; if the font is not found there adding the fonts has failed ; NEC< jnc cont > EC< ERROR_NC FONT_ADD_FAILED > segxchg ds,es lea di,es:[di].FAE_fileName mov si,dx ; si <- offset to file name mov cx,FONT_FILE_LENGTH EC< EC_BOUNDS es di> LocalCopyNString dec si EC< EC_BOUNDS ds si> mov {byte}ds:[si],TRUE cont:: call FarUnlockInfoBlock pop es nextFont: nextFontLoadError: dec ss:[fontCount] tst ss:[fontCount] jz done add dx, size FileLongName jmp addFontLoop done: ; ; unlock memory list passed in ; mov bx, ss:[fontFileList] call MemUnlock ; ; send out notification that fonts have been added ; mov cx,TRUE mov ax,ss:[fontsAddedCount] mov ds,ss:[fontsAddedList] call FontSendAddDeleteNotification ; tell the world fonts ; have been added ; ; free the memory allocated for the list of FontID's added ; mov bx, ss:[fontsAddedHandle] call MemFree almostExit: call FilePopDir exit: .leave ret allocError: ; ; unlock memory list passed in ; mov bx, ss:[fontFileList] call MemUnlock jmp almostExit FontDrAddFonts endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrFindFileName %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: returns the file name for a font from the fonts avail entry. CALLED BY: Global PASS: cx - FontID ds - locked font info segment RETURN: ds:si - ptr to font file name DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/21/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrFindFileName proc far uses bx,di .enter call FarIsFontAvail lea si,ds:[di].FAE_fileName .leave ret FontDrFindFileName endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrGetFontIDFromFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the font ID from the file CALLED BY: Global PASS: ds:dx - ptr to filename assumes that already in the directory with the font RETURN: cx - FontID if error cx - FID_INVALID carry set if there is an error DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/18/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrGetFontIDFromFile proc far fontID local FontID uses ax,bx,dx,si,di,bp,ds .enter mov al, FileAccessFlags <FE_DENY_WRITE, FA_READ_ONLY > call FileOpen jc openError mov_trash bx,ax ;bx <- file handle ; ; move to location of font id ; clr cx mov dx,size FontFileInfo mov al, FILE_POS_START call FilePosFar ;read in the bytes ; ; read font ID into local fontID ; clr ax mov cx, size FontID lea dx, ss:[fontID] segmov ds,ss call FileReadFar jc readError mov cx,ss:[fontID] closeFile: pushf ; save carry if there ; is an error clr ax call FileCloseFar ; close the file popf exit: .leave ret openError: mov cx,FID_INVALID jmp exit readError: mov cx,FID_INVALID jmp closeFile FontDrGetFontIDFromFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontSendAddDeleteNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends a notification of that fonts have been added/deleted to/from the system along with a list of the FontIDs added/deleted CALLED BY: FontDrAddFonts PASS: ax - number of fonts added or deleted ds - pointer to list of FontID's added or deleted cx - Flag to tell whether to send out and added or deleted notifitcation if it is FALSE then send out a deleted notification, else send out an added notification RETURN: DESTROYED: nothing SIDE EFFECTS: Sends GWNT_FONTS_ADDED notification that fonts have been added to GCNSLT_FONT_CHANGES PSEUDO CODE/STRATEGY: copy the passed in list of FontID's to a new list. put at the beggining of this new list, the number of fonts added or removed. record the message to send send the message REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/ 9/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontSendAddDeleteNotification proc near fontsAddDelCount local word push ax fontsAddDelFlag local word push cx uses ax,bx,cx,dx,si,di,bp .enter ; ; copy the old list of font ID's to a new one, which is the ; exact size of the list ; inc ax ; add a word on for the count shl ax,1 mov cx,ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE call MemAllocFar mov es,ax mov ax,ss:[fontsAddDelCount] clr di EC< EC_BOUNDS es di > stosw ; move count into first word clr si mov_tr cx,ax EC< EC_BOUNDS es di > rep movsw ; copy list EC< dec di > EC< EC_BOUNDS es di> EC< inc di > call MemUnlock ; ; Initialize the reference count for the data block to 1, to ; account for what GCNListSend does. ; mov ax, 1 call MemInitRefCount ; ; Record the MSG_NOTIFY_FILE_CHANGE going to no class in particular. ; mov dx, GWNT_FONTS_DELETED tst ss:[fontsAddDelFlag] jz cont mov dx, GWNT_FONTS_ADDED cont: push bp mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK mov cx, MANUFACTURER_ID_GEOWORKS mov bp, bx clr bx, si mov di, mask MF_RECORD call ObjMessage ; ; send the message ; mov cx, di ; cx <- event handle mov bx, MANUFACTURER_ID_GEOWORKS ; bxax <- list ID mov ax, GCNSLT_FONT_CHANGES mov dx, bp ; dx <- data block mov bp, mask GCNLSF_FORCE_QUEUE call GCNListSend pop bp .leave ret FontSendAddDeleteNotification endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontLoadFont %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Loads a font into a font info structure CALLED BY: FontLoadFont (Internal) PASS: es:dx name of file to load RETURN: bx - Handle of block with FontInfo structure ax - size of FontInfo & corresponding entries DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: open the font file if open failed then return with an open error Read the FontFileInfo structure in check to make sure that it is a font file that we approve of Allocate room for the FontInfo structur plus the associated entries Read the info from the file into this structure Clear the File Handle in the FontInfoStructure Close the file return the FontInfo structure REVISION HISTORY: Name Date Description ---- ---- ----------- IP 2/24/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontLoadFont proc near fontFileInfo local FontFileInfo fontFileHandle local hptr fontInfoHandle local hptr uses cx,dx,di,bp,si,ds .enter ; ; Open the font file using the name passed in ; segmov ds,es mov al, FileAccessFlags <FE_DENY_WRITE, FA_READ_ONLY > call FileOpen LONG jc done ; ; Read the signature and version # from the start of the file. ; mov_trash bx, ax ;put file handle in bx mov ss:[fontFileHandle], bx mov cx, size fontFileInfo ;read in first few bytes lea dx, ss:[fontFileInfo] segmov ds, ss ;ds:dx <- dest buffer clr al ;return errors, please EC< EC_BOUNDS ds dx > call FileReadFar ;read in the bytes EC < jnc noReadError >;no problems, branch EC < cmp ax, ERROR_SHORT_READ_WRITE >;see if small file EC < ERROR_NE GRAPHICS_BAD_FONT_FILE > EC <noReadError: > LONG jc closeFont ; ; Make sure the file's actually a font file that we can handle. ; cmp ss:[fontFileInfo].FFI_signature, FID_SIG_LO LONG jne closeFont ;nope, branch cmp ss:[fontFileInfo].FFI_signature[2], FID_SIG_HI LONG jne closeFont ;nope, branch cmp ss:[fontFileInfo].FFI_majorVer, MAX_MAJOR_VER;can we deal with it? ja closeFont ;nope, branch ; ; At this point, the file is a font file. We will read the file into ; a new chunk and save the font ID and chunk handle in the ; fontsAvail list. ; mov ax, ss:[fontFileInfo].FFI_headerSize;make a chunk for the rest add ax, FI_RESIDENT ;add room to store ;file handle push ax ;save the size of font ;info + corresponding ; ;data ; allocate room for the font info structure & corresponding ; entries ; mov cx, ALLOC_DYNAMIC_LOCK call MemAllocFar jc noMemError mov ss:[fontInfoHandle],bx mov ds,ax pop cx ;cx <- size font info push cx mov dx, offset FI_fontID sub cx, FI_RESIDENT ;not reading file handle clr al mov bx,ss:[fontFileHandle] EC< EC_BOUNDS ds dx> call FileReadFar EC < ERROR_C GRAPHICS_BAD_FONT_FILE > mov ds:[FI_fileHandle], 0 ;clear file handle mov bx, ss:[fontInfoHandle] call MemUnlock pop ax ;return size of Font ;info & corresponding entries closeFont: ; ; need to push and pop ax to save the size of the Font info & ; corresponding entries, if they exist. ; pushf push ax mov ax, FILE_NO_ERRORS mov bx,ss:[fontFileHandle] call FileCloseFar ; close the file pop ax popf done:: mov bx,ss:[fontInfoHandle] .leave ret noMemError: stc jmp closeFont FontLoadFont endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrDeleteFonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove the fonts from the system, associated with the list of file names passed in. If ax is TRUE the font will be deleted if it is in use. Will not delete the font if it is the default font. CALLED BY: PASS: bx - handle of font file list cx - number of font files found ax - force delete flag RETURN: modify list of fonts passed in, see SIDE EFFECTS: carry set if error DESTROYED: nothing SIDE EFFECTS: For every font file that was successfully deleted the last byte of the font filename structure passed in for that font, will be set to TRUE. PSEUDO CODE/STRATEGY: Lock the list of font file names allocate memory for list of successfully deleted FontID's deleteLoop Find the FontID corresponding to the file name Delete the font using the force delete flag. (delete the font whether or not the font is in use) put true in the last byte of the FontFileName record passed in, indicating that the font has been deleted record the FontID of the successfully deleted font move on to the next font end loop unlock the list of font file names send out notification that font files have been deleted. Send the list of FontID's deleted with the notification free the memory allocated for the list of FontID's return REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/ 1/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrDeleteFonts proc far forceDeleteFlag local word push ax fontsDeletedList local word fontsDeletedHandle local hptr fontsDeletedCount local word uses ax,bx,cx,dx,si,di,es,ds .enter tst cx ;no fonts to delete LONG jz exit clr ss:[fontsDeletedCount] push bx call MemLock mov si,ax ;si:dx <-ptr to font file names clr dx ; ; allocate room to store the list of FontID's deleted ; push cx mov ax,cx ;ax <- # of Fonts to delete shl ax,1 mov cx,ALLOC_DYNAMIC_LOCK call MemAllocFar pop cx ; font count LONG jc allocError mov ss:[fontsDeletedList],ax mov ss:[fontsDeletedHandle],bx deleteLoop: call FarLockInfoBlock call FontDrFindFontIdByName call FarUnlockInfoBlock ; preserves flags ; ; if the font was not found, move on to the next font ; jnc nextFont ; based on the carry flag from ; FontDrFindFontIdByName push bx push cx mov cx,bx mov ax,forceDeleteFlag call FontDrDeleteFontOpt EC <WARNING_C FONT_DELETE_FAILED > pop cx pop bx jc nextFont ; font was not deleted mov es,si mov di,dx ; mark font as deleted ; ; mark the font deleted it the FontDrDeleteFont returned ; without an error ; jc nextFont EC< EC_BOUNDS es di> mov {byte}es:[di] + size FileLongName - 1, TRUE ; ; add the Font ID ; push es mov es,ss:[fontsDeletedList] ;store fontID in mov di,ss:[fontsDeletedCount] ;buffer shl di,1 EC< EC_BOUNDS es di> mov es:[di],bx ;es:di <- FontID inc ss:[fontsDeletedCount] pop es nextFont: add dx,size FileLongName loop deleteLoop endLoop:: pop bx call MemUnlock ; ; send out notification that fonts have been deleted ; mov ax,ss:[fontsDeletedCount] tst ax jz noNotification mov cx,FALSE mov ds,ss:[fontsDeletedList] call FontSendAddDeleteNotification ; tell the world fonts ; have been deleted noNotification: ; ; free the memory allocated to store the list of FontID's ; added because the notification has already been sent out ; mov bx,ss:[fontsDeletedHandle] call MemFree clc exit: .leave ret allocError: pop bx call MemUnlock jmp exit FontDrDeleteFonts endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrFindFontIdByName %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Give the file name of a font, returns the font ID of that font CALLED BY: FontDrDeleteFonts PASS: si:dx - ptr to font file name ds - seg address of font block RETURN: bx - FontID Set carry if font found DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Scan through the list of avail fonts, if the font file name of the FontsAvailEntry matches the file name passed, return the FontID and set carry REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/ 1/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrFindFontIdByName proc near uses ax,cx,dx,si,di,bp,es .enter ; ; carry is clear until the correct font is found ; mov cx,si clc mov di, ds:[FONTS_AVAIL_HANDLE] ;di <- ptr to chunk ChunkSizePtr ds, di, ax ;ax <- chunk size add ax, di ;ax -> end of chunk IFA_loop: cmp di, ax ;are we thru the list? jae noMatch ;yes, exit carry clear lea si,ds:[di].FAE_fileName push di movdw esdi,cxdx ;es:di < ptr to file name call LocalCmpStrings pop di je match ;we have a match, branch add di, size FontsAvailEntry ;else move to next entry jmp IFA_loop ;and loop match: mov bx, ds:[di].FAE_fontID ;bx <- chunk handle stc ;indicate is available noMatch: .leave ret FontDrFindFontIdByName endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrDeleteFontOpt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete a font from the system. If ax is true the font is deleted even if it is in use. Will not delete the font if it is the default font. CALLED BY: FontDrDeleteFonts PASS: cx - FontID value for the font ax - flag to force deletion of font RETURN: carry - set if error ax - error code (FontAddDeleteError) DESTROYED: nothing (ax if not returned) SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/ 2/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrDeleteFontOpt proc near uses bx,cx,dx .enter ; ; check to make sure not trying to delete the default font ; push ax push cx call GrGetDefFontID pop bx ;bx <- FontID passed in pop ax cmp cx,bx jz defaultFontError mov cx,bx ;cx <- FontID passed in call FontDrDeleteFontCommon exit: .leave ret defaultFontError: stc mov ax, FADE_DEFAULT_FONT jmp exit FontDrDeleteFontOpt endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrDeleteFont %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete a font from the system CALLED BY: GLOBAL PASS: cx - FontID value for font references to its in use entry RETURN: carry - set if error ax - error code (FontAddDeleteError) DESTROYED: none (ax if not returned) PSEUDO CODE KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/ 3/92 Initial version IP 03/30/94 seperated common code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrDeleteFont proc far .enter clr ax call FontDrDeleteFontCommon .leave ret FontDrDeleteFont endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FontDrDeleteFontCommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete a font from the system CALLED BY: GLOBAL PASS: cx - FontID value for font ax - flag if true deletes the font if there are still references to its in use entry RETURN: carry - set if error ax - error code (FontAddDeleteError) DESTROYED: none (ax if not returned) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/ 2/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FontDrDeleteFontCommon proc near uses bx, cx, dx, ds, si, di forceDeleteFlag local word push ax .enter call FarLockInfoBlock ;ds <- seg addr of font info ; ; See if the font is even in the system ; call FarIsFontAvail ;is font in system? LONG jnc noSuchFontError ;branch if no such font mov dx, di ;ds:dx <- ptr to FontsAvailEntry sub dx, ds:[FONTS_AVAIL_HANDLE] ;dx <- offset of FontsAvailEntry ; ; See if it is in use any where ; mov si, ds:[FONTS_IN_USE_HANDLE] ;ds:si <- ptr to in use chunk ChunkSizePtr ds, si, ax ;ax <- size of chunk add ax, si ;ds:ax <- end of chunk inUseLoop: cmp si, ax ;end of list? jae endList ;all done mov bx, ds:[si].FIUE_dataHandle ;bx <- handle of data tst bx ;entry in use? jz nextFont ;branch if not in use cmp cx, ds:[si].FIUE_attrs.FCA_fontID ;our font? jne nextFont ;branch if not same ;font ; ; if the force delete flag is set, then we want to delete the ; font whether or not there are references to it ; tst ss:[forceDeleteFlag] jnz killIt tst ds:[si].FIUE_refCount ;font in use? jnz inUseError ;branch if font in use jmp cont killIt: ; ; mark the in use entry as invalid ; or ds:[si].FIUE_flags, mask FBF_IS_INVALID ; ; if the there are still references to the font do not free it ; tst ds:[si].FIUE_refCount ;font in use? jnz nextFont cont: ; ; if the ref count is zero then free the font data ; call MemFree clr ds:[si].FIUE_dataHandle nextFont: add si, (size FontsInUseEntry) ;ds:si <- next entry jmp inUseLoop ; ; We've checked (and possibly freed) all references to the ; font. Now nuke its FontsAvailEntry and FontInfo chunk. ; ; ds:di - ptr to FontsAvailEntry from FarIsFontAvail() ; endList: mov ax, ds:[di].FAE_infoHandle ;ax <- chunk handle of FontInfo mov si, ax mov si, ds:[si] ;ds:si <- ptr to FontInfo call RemoveFontFileFromCache call DeleteOutlineEntriesData call LMemFree mov ax, FONTS_AVAIL_HANDLE ;ax <- chunk handle mov bx, dx ;bx <- ofset of deletion mov cx, (size FontsAvailEntry) ;cx <- # of bytes to delete call LMemDeleteAt clc ;carry <- no error done: call FarUnlockInfoBlock ;done with font info .leave ret noSuchFontError: mov ax, FADE_NO_SUCH_FONT ;ax <- FontAddDeleteError errorCommon: stc ;carry <- error jmp done inUseError: mov ax, FADE_FONT_IN_USE ;ax <- FontAddDeleteError jmp errorCommon FontDrDeleteFontCommon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeleteOutlineEntriesData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: frees any memory referenced by handles in the OutlineEntries found in FontInfo CALLED BY: FontDrDeleteFontCommon PASS: ds:si RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Don't need to clear the handle entries because the structure they are in will be freed as soon as this routine returns REVISION HISTORY: Name Date Description ---- ---- ----------- IP 3/31/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeleteOutlineEntriesData proc near if DBCS_PCGEOS PrintMessage <fix DeleteOutlineEntriesData for DBCS> else uses ax,bx,cx,dx,si,di,bp .enter ; ; calculate how many outline data entries there are ; mov bp,ds:[si].FI_outlineTab mov ax,ds:[si].FI_outlineEnd deleteLoop: cmp bp,ax jz endLoop mov bx,ds:[si][bp].ODE_header.OE_handle tst bx jz cont1 ; ; free the memory ; call MemFree cont1: mov bx,ds:[si][bp].ODE_first.OE_handle tst bx jz cont2 ; ; free the memory ; call MemFree cont2: mov bx,ds:[si][bp].ODE_second.OE_handle tst bx jz cont3 ; ; free the memory ; call MemFree cont3: add bp,size OutlineDataEntry jmp deleteLoop endLoop: .leave endif ret DeleteOutlineEntriesData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RemoveFontFileFromCache %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove a font file from the cache and close it CALLED BY: FontDrDeleteFont() PASS: ds - P'locked ds:si - ptr to FontInfo ds:di - ptr to FontsAvailEntry RETURN: none DESTROYED: bx, cx PSEUDO CODE/STRATEGY: NOTE: we don't bother clearing the FI_fileHandle field because the chunk will be deleted after this call, and we have exclusive access to the block so no one will see it in the mean time. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- gene 2/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RemoveFontFileFromCache proc near uses ax, es, di mov bx, ds:[si].FI_fileHandle ;bx <- file handle if open tst bx ;file open? jz quit ;branch if not open .enter ; ; Close the file ; clr al ;al <- flags call FileCloseFar ; ; Find the font in the cache and remove it. We simply ; zero the entry and let RecordNewFontFile() fill it in ; when it needs it. ; mov ax, ds:[di].FAE_fontID ;ax <- FontID mov di, ds:[FONT_FILE_CACHE_HANDLE] ChunkSizePtr ds, di, cx shr cx, 1 ;cx <- # of entries segmov es, ds ;es:di <- ptr to file cache repne scasw ;find font ID EC < ERROR_NE FONTMAN_FILE_CACHE_CORRUPTED ;> mov {FontID}ds:[di][-(size FontID)], FID_INVALID .leave quit: ret RemoveFontFileFromCache endp if ERROR_CHECK COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECCheckFontInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Verify a FontInfo structure CALLED BY: FontDrAddFont() PASS: ds:si - ptr to FontInfo cx - FontID of font RETURN: none DESTROYED: none (flags preserved) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 3/23/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECCheckFontInfo proc near uses ax, dx .enter pushf ; ; FontID match? ; cmp cx, ds:[si].FI_fontID ERROR_NE FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT ; ; Pointsize pointers ordered and large enough? ; mov ax, ds:[si].FI_pointSizeEnd tst ax ;any PointSizeEntry? jz noPointsizes1 cmp ax, (size FontInfo) ;large enough? ERROR_B FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT cmp ax, ds:[si].FI_pointSizeTab ;ordered correctly? ERROR_BE FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT noPointsizes1: ; ; Are there an integral number of PointSizeEntry's? ; sub ax, ds:[si].FI_pointSizeTab ;ax <- size jz noPointsizes2 mov dl, (size PointSizeEntry) ;dl <- size of PointSizeEntry div dl tst ah ;any remainder? ERROR_NZ FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT noPointsizes2: ; ; Outline pointers ordered and large enough? ; mov ax, ds:[si].FI_outlineEnd tst ax ;any OutlineDataEntry's? jz noOutlines1 cmp ax, (size FontInfo) ;large enough? ERROR_B FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT cmp ax, ds:[si].FI_outlineTab ;ordered correctly? ERROR_BE FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT noOutlines1: ; ; Are there an integral number of OutlineDataEntry's? ; sub ax, ds:[si].FI_outlineTab ;ax <- size jz noOutlines2 mov dl, (size OutlineDataEntry) ;dl <- size of OutlineDataEntry div dl tst ah ;any remainder? ERROR_NZ FONTMAN_BAD_FONT_INFO_FOR_ADD_FONT noOutlines2: popf .leave ret ECCheckFontInfo endp endif FontDriverCode ends
Data/Tuple/Equiv/Id.agda
Lolirofle/stuff-in-agda
6
16427
<filename>Data/Tuple/Equiv/Id.agda module Data.Tuple.Equiv.Id where import Lvl open import Data.Tuple as Tuple using (_⨯_ ; _,_) open import Data.Tuple.Equiv open import Relator.Equals open import Relator.Equals.Proofs.Equiv open import Structure.Function open import Structure.Function.Domain open import Structure.Operator open import Type private variable ℓ ℓₒ₁ ℓₒ₂ : Lvl.Level private variable A B : Type{ℓ} private variable f g : A → B private variable p : A ⨯ B instance Tuple-Id-extensionality : Extensionality{A = A}{B = B}([≡]-equiv) Tuple-Id-extensionality = intro Tuple-left-map : (Tuple.left(Tuple.map f g p) ≡ f(Tuple.left(p))) Tuple-left-map = [≡]-intro Tuple-right-map : (Tuple.right(Tuple.map f g p) ≡ g(Tuple.right(p))) Tuple-right-map = [≡]-intro
IceCube/IceCube.help/Contents/Resources/scripts/RunBuildAll.scpt
algi/icecube
1
4073
<gh_stars>1-10 on «event helphdhp» tell application "IceCube" repeat with projectItem in every project run project projectItem end repeat end tell end «event helphdhp»
data/mapObjects/pokemontower6.asm
etdv-thevoid/pokemon-rgb-enhanced
1
16500
PokemonTower6Object: db $1 ; border block db $2 ; warps db $9, $12, $1, POKEMONTOWER_5 db $10, $9, $0, POKEMONTOWER_7 db $0 ; signs db $5 ; objects object SPRITE_MEDIUM, $c, $a, STAY, RIGHT, $1, OPP_CHANNELER, $b object SPRITE_MEDIUM, $9, $5, STAY, DOWN, $2, OPP_CHANNELER, $c object SPRITE_MEDIUM, $10, $5, STAY, LEFT, $3, OPP_CHANNELER, $d object SPRITE_BALL, $6, $8, STAY, NONE, $4, RARE_CANDY object SPRITE_BALL, $e, $e, STAY, NONE, $5, X_ACCURACY ; warp-to EVENT_DISP POKEMONTOWER_6_WIDTH, $9, $12 ; POKEMONTOWER_5 EVENT_DISP POKEMONTOWER_6_WIDTH, $10, $9 ; POKEMONTOWER_7
theorems/experimental/TwoConstancy.agda
cmknapp/HoTT-Agda
0
14749
<gh_stars>0 {-# OPTIONS --without-K #-} open import HoTT open import experimental.TwoConstancyHIT module experimental.TwoConstancy {i j} {A : Type i} {B : Type j} (B-is-gpd : is-gpd B) (f : A → B) (f-is-const₀ : ∀ a₁ a₂ → f a₁ == f a₂) (f-is-const₁ : ∀ a₁ a₂ a₃ → f-is-const₀ a₁ a₂ ∙' f-is-const₀ a₂ a₃ == f-is-const₀ a₁ a₃) where private abstract lemma₁ : ∀ a (t₂ : TwoConstancy A) → point a == t₂ lemma₁ a = TwoConstancy-elim {P = λ t₂ → point a == t₂} (λ _ → =-preserves-level 1 TwoConstancy-level) (λ b → link₀ a b) (λ b₁ b₂ → ↓-cst=idf-in' $ link₁ a b₁ b₂) (λ b₁ b₂ b₃ → set-↓-has-all-paths-↓ $ TwoConstancy-level _ _ ) lemma₂ : ∀ (a₁ a₂ : A) → lemma₁ a₁ == lemma₁ a₂ [ (λ t₁ → ∀ t₂ → t₁ == t₂) ↓ link₀ a₁ a₂ ] lemma₂ a₁ a₂ = ↓-cst→app-in $ TwoConstancy-elim {P = λ t₂ → lemma₁ a₁ t₂ == lemma₁ a₂ t₂ [ (λ t₁ → t₁ == t₂) ↓ link₀ a₁ a₂ ]} (λ _ → ↓-preserves-level 1 λ _ → =-preserves-level 1 TwoConstancy-level) (λ b → ↓-idf=cst-in $ ! $ link₁ a₁ a₂ b) (λ b₁ b₂ → prop-has-all-paths-↓ $ ↓-level λ _ → TwoConstancy-level _ _) (λ b₁ b₂ b₃ → prop-has-all-paths-↓ $ contr-is-prop $ ↓-level λ _ → ↓-level λ _ → TwoConstancy-level _ _) TwoConstancy-has-all-paths : has-all-paths (TwoConstancy A) TwoConstancy-has-all-paths = TwoConstancy-elim {P = λ t₁ → ∀ t₂ → t₁ == t₂} (λ _ → Π-level λ _ → =-preserves-level 1 TwoConstancy-level) lemma₁ lemma₂ (λ a₁ a₂ a₃ → prop-has-all-paths-↓ $ ↓-level λ t₁ → Π-is-set λ t₂ → TwoConstancy-level t₁ t₂) TwoConstancy-is-prop : is-prop (TwoConstancy A) TwoConstancy-is-prop = all-paths-is-prop TwoConstancy-has-all-paths cst-extend : Trunc -1 A → B cst-extend = TwoConstancy-rec B-is-gpd f f-is-const₀ f-is-const₁ ∘ Trunc-rec TwoConstancy-is-prop point -- The beta rule. -- This is definitionally true, so you don't need it. cst-extend-β : cst-extend ∘ [_] == f cst-extend-β = idp
programs/oeis/213/A213036.asm
neoneye/loda
22
162229
<filename>programs/oeis/213/A213036.asm ; A213036: n^2-[2n/3]^2, where [] = floor. ; 0,1,3,5,12,16,20,33,39,45,64,72,80,105,115,125,156,168,180,217,231,245,288,304,320,369,387,405,460,480,500,561,583,605,672,696,720,793,819,845,924,952,980,1065,1095,1125,1216,1248,1280,1377,1411 mov $2,$0 lpb $2 add $1,$0 sub $0,1 add $1,$0 trn $2,3 lpe mov $0,$1
src/el-methods-proc_2.adb
My-Colaborations/ada-el
0
13674
<reponame>My-Colaborations/ada-el ----------------------------------------------------------------------- -- EL.Methods.Proc_2 -- Procedure Binding with 2 arguments -- Copyright (C) 2010, 2011, 2012, 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.Beans.Objects; package body EL.Methods.Proc_2 is use EL.Expressions; -- ------------------------------ -- Returns True if the method is a valid method which accepts the arguments -- defined by the package instantiation. -- ------------------------------ function Is_Valid (Method : in EL.Expressions.Method_Info) return Boolean is begin if Method.Binding = null then return False; else return Method.Binding.all in Binding'Class; end if; end Is_Valid; -- ------------------------------ -- Execute the method describe by the method expression -- and with the given context. The method signature is: -- -- procedure F (Obj : in out <Bean>; -- Param1 : in Param1_Type; -- Param2 : in Param2_Type); -- -- where <Bean> inherits from <b>Readonly_Bean</b> -- (See <b>Bind</b> package) -- -- Raises <b>Invalid_Method</b> if the method referenced by -- the method expression does not exist or does not match -- the signature. -- ------------------------------ procedure Execute (Method : in EL.Expressions.Method_Expression'Class; Param1 : in Param1_Type; Param2 : in Param2_Type; Context : in EL.Contexts.ELContext'Class) is Info : constant Method_Info := Method.Get_Method_Info (Context); begin if Info.Binding = null then raise EL.Expressions.Invalid_Method with "Method not found"; end if; -- If the binding has the wrong type, we are trying to invoke -- a method with a different signature. if not (Info.Binding.all in Binding'Class) then raise EL.Expressions.Invalid_Method with "Invalid signature for method '" & Info.Binding.Name.all & "'"; end if; declare Proxy : constant Binding_Access := Binding (Info.Binding.all)'Access; begin Proxy.Method (Util.Beans.Objects.To_Bean (Info.Object), Param1, Param2); end; end Execute; -- ------------------------------ -- Proxy for the binding. -- The proxy declares the binding definition that links -- the name to the function and it implements the necessary -- object conversion to translate the <b>Readonly_Bean</b> -- object to the target object type. -- ------------------------------ package body Bind is procedure Method_Access (O : access Util.Beans.Basic.Readonly_Bean'Class; P1 : Param1_Type; P2 : Param2_Type) is Object : constant access Bean := Bean (O.all)'Access; begin Method (Object.all, P1, P2); end Method_Access; end Bind; end EL.Methods.Proc_2;
mailsendtotodoist.applescript
markgrovs/MailSendToTodoist
2
3166
property apiToken : "INSERT TODOIST API TOKEN HERE" property allProjects : {} property defaultProjectName : "Inbox" property appName : "Send to Todoist from Mac Mail" property appDomain : "us.markgroves" on alfred_script(q) set date_string to "" if q contains "d:" then -- pull out due date string set date_string to text ((offset of "d:" in q) + 2) thru -1 of q set q to text 1 thru ((offset of "d:" in q) - 2) of q end if log ("date_string: " & date_string) log ("query: " & q) -- Add need Todoist item based on Input set RS to my addItem(q, "", date_string) -- Retrieve link from Mail set link to my get_link() log "link: " & link -- Add link as a note in Todoist my addNote(RS, link) return q end alfred_script -- Slightly modified version of Efficient Computing's AppleScript: http://efficientcomputing.commons.gc.cuny.edu/2012/03/17/copy-email-message-in-mail-app-to-evernote-applescript/ on get_link() tell application "Mail" set prevTIDs to AppleScript's text item delimiters set clipcat to "" set format to "td" set seperator to "," set selectedMails to the selection repeat with theMessage in selectedMails --get information from message set theMessageDate to the date received of theMessage set theMessageSender to sender of theMessage set theMessageSubject to the subject of the theMessage set theMessageURL to "message://%3c" & theMessage's message id & "%3e" --make a short header set theHeader to the all headers of theMessage set theShortHeader to (paragraph 1 of theHeader & return & paragraph 2 of theHeader & return & paragraph 3 of theHeader & return & paragraph 4 of theHeader & return & return) --format the message to url set clipcat to clipcat & " " & theMessageURL & " (" & my replace_chars(theMessageSubject, "&", "-") & ")" end repeat set AppleScript's text item delimiters to "(" set temp to every text item of clipcat set AppleScript's text item delimiters to "(" set clipcat to temp as string set AppleScript's text item delimiters to prevTIDs --set the clipboard to clipcat --copy clipcat to stdout log "This Link: " & clipcat return clipcat end tell end get_link on addItem(itemContent, projectName, date_string) log "addItem()" if date_string is "" then set Response to my todoistRequest("addItem?priority=1&content=" & itemContent, apiToken) else set Response to my todoistRequest("addItem?priority=1&content=" & itemContent & "&date_string=" & date_string, apiToken) end if log "Response: " & Response return Response end addItem on addNote(itemID, noteContent) log "addNote()" my todoistRequest("addNote?item_id=" & itemID & "&content=" & noteContent, apiToken) end addNote on todoistRequest(request, token) log "todoistRequest()" tell application "JSON Helper" if request does not contain "?" then set fullRequest to request & "?token=" & token else set fullRequest to request & "&token=" & token end if set JSONResponse to fetch JSON from "http://todoist.com/API/" & fullRequest with cleaning feed if result is "" then error "Invalid or empty API response from " & request log (JSONResponse) set myID to |id| of JSONResponse log ("This is the ID :" & myID) return myID end tell end todoistRequest on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars
Python/C5 - MIPS/T2 - binary.asm
mrbinx/mrbinx_python
0
1982
#FIT1008 Prac 5 Task 2 - <NAME> 25461257, <NAME> 25216384 .data prompt_input: .asciiz "Please input a positive integer: " prompt_error: .asciiz "Please enter a valid positive integer greater than zero." .text main: #copy $sp into $fp add $fp, $0, $sp j binary binary: #print input prompt la $a0, prompt_input addi $v0, $0, 4 syscall addi $v0, $0, 5 syscall #allocate stack for binary() addi $sp, $sp, -16 #initialise sw $v0, -4($fp) #n sw $0, -8($fp) #rev_binary sw $0, -12($fp) #length sw $0, -16($fp) lw $t9, -4($fp) #load from n # if n > 0 sgt $t0, $t9, $0 beq $t0, $0, error lw $t0, -4($fp) #t0 = n addi $t1, $0, 4 # t1 = 4 mult $t0, $t1 # 4*n mflo $t1 # t1 = 4*n addi $a0, $t1, 4 # a0 = 4*n + 4 addi $v0, $0, 9 #allocate memory syscall sw $v0, -8($fp) # store rev_binary address lw $t0, -8($fp) # load rev_binary lw $t1, -4($fp) # load n sw $t1, ($t0) # store n into rev_binary lw $t2, -16($fp) # t2 = i = 0 j loop_append loop_append: # append 0s into list bge $t2, $t1, next addi $t4, $0, 4 # t4 = 4 mult $t4, $t2 # 4 * i mflo $t3 add $t3, $t3, $t4 # t3 = 4*i + 4 add $t3, $t3, $t0 # address + 4 + 4*i sw $0, ($t3) # store 0 into t3 address #lw $a0, ($t3) #addi $v0, $0, 1 #syscall lw $t2, -16($fp) addi $t2, $t2, 1 # increment i sw $t2,-16($fp) j loop_append next: sw $0, -12($fp) # length = 0 j loop_mod loop_mod: lw $t0, -4($fp) # t0 = n sgt $t1, $t0, $0 # if n > 0 beq $t1, $0, next_2 addi $t2, $0, 2 # t2 = 2 lw $t0, -4($fp) # t0 = n div $t0, $t2 # n / 2 mfhi $t3 # take n mod 2 lw $t5, -8($fp) # load address lw $t1, -12($fp) # load length addi $t4, $0, 4 # t4 = 4 mult $t1, $t4 # length * 4 mflo $t6 # t6 = length * 4 add $t6, $t4, $t6 # t6 = 4 + length * 4 add $t5, $t5, $t6 # t5 = address + 4 + length * 4 sw $t3, ($t5) # store n mod 2 into ($t5) lw $t0, -4($fp) # t0 = n div $t0, $t2 mfhi $t3 # n % 2 sub $t0, $t0, $t3 # n = n - n%2 div $t0, $t2 # n / 2 mflo $t0 sw $t0, -4($fp) # store n lw $t1, -12($fp) # load length addi $t1, $t1, 1 # length = length - 1 sw $t1, -12($fp) # store length #lw $a0, ($t5) #addi $v0, $0, 1 #syscall j loop_mod next_2: lw $t0, -12($fp) # load length addi $t0, $t0, -1 # length -1 sw $t0, -12($fp) # store length j loop_print loop_print: lw $t0, -12($fp) sge $t1, $t0, $0 beq $t1, $0, quit lw $t2, -8($fp) # load address lw $t1, -12($fp) # load length addi $t4, $0, 4 # t4 = 4 mult $t1, $t4 # length * 4 mflo $t3 # t3 = length * 4 add $t3, $t4, $t3 # t3 = 4 + length * 4 add $t2, $t2, $t3 # t2 = address + 4 + length * 4 lw $a0, ($t2) # print (address) addi $v0, $0, 1 syscall lw $t0, -12($fp) # load length addi $t0, $t0, -1 # decrement length sw $t0, -12($fp) # store length j loop_print error: #prints error la $a0, prompt_error addi $v0, $0, 4 syscall j quit quit: #stopping program addi $v0, $0, 10 syscall
SOAS/Metatheory/SecondOrder/Unit.agda
JoeyEremondi/agda-soas
39
222
open import SOAS.Metatheory.Syntax -- Unit law of metasubstitution module SOAS.Metatheory.SecondOrder.Unit {T : Set}(Syn : Syntax {T}) where open Syntax Syn open import SOAS.Metatheory.FreeMonoid Syn open import SOAS.Metatheory.SecondOrder.Metasubstitution Syn open import SOAS.Families.Core {T} open import SOAS.Common open import SOAS.Context open import SOAS.Variable open import SOAS.Construction.Structure as Structure open import SOAS.ContextMaps.Combinators open import SOAS.ContextMaps.CategoryOfRenamings {T} import SOAS.Abstract.Coalgebra {T} as →□ open →□.Sorted open →□.Unsorted using (⊤ᵇ) renaming (Coalg to UCoalg ; Coalg⇒ to UCoalg⇒) import SOAS.Abstract.Box {T} as □ ; open □.Sorted open import SOAS.Abstract.Monoid open import SOAS.Abstract.ExpStrength open import SOAS.Coalgebraic.Monoid open import SOAS.Metatheory Syn open import SOAS.Metatheory.Monoid ⅀F ⅀:Str open import SOAS.ContextMaps.Properties open Theory private variable Γ Δ Π : Ctx α β : T 𝔛 𝔜 ℨ : Familyₛ -- Metasubstitution unit is a coalgebra homomorphisem from ⊤ ms-unitᵇ⇒ : UCoalg⇒ ⊤ᵇ [ 𝔛 ⊸ (𝕋ᵇ 𝔛) ]ᵇ (λ _ → ms-unit) ms-unitᵇ⇒ {𝔛} = record { ⟨r⟩ = λ{ {Γ = Γ}{Δ}{ρ} → iext (dext λ {Π} 𝔪 → sym (begin 𝕣𝕖𝕟 𝔛 (ms-unit 𝔪) (Π ∔∣ ρ) ≡⟨ Renaming.𝕥⟨𝕞⟩ 𝔛 ⟩ 𝕞𝕧𝕒𝕣 𝔛 𝔪 (λ p → 𝕣𝕖𝕟 𝔛 (𝕧𝕒𝕣 𝔛 (inl Π p)) (Π ∔∣ ρ)) ≡⟨ 𝕞≈₂ 𝔛 (λ v → Renaming.𝕥⟨𝕧⟩ 𝔛) ⟩ 𝕞𝕧𝕒𝕣 𝔛 𝔪 (λ v → 𝕧𝕒𝕣 𝔛 ((Π ∔∣ ρ) (inl Π v))) ≡⟨ 𝕞≈₂ 𝔛 (λ v → cong (𝕧𝕒𝕣 𝔛) (∔.+₁∘i₁ {f = id′ᵣ Π}{g = ρ})) ⟩ 𝕞𝕧𝕒𝕣 𝔛 𝔪 (λ v → 𝕧𝕒𝕣 𝔛 (∔.i₁ v)) ∎))} } where open ≡-Reasoning -- Right unit of metasubstitution □msub-runitᵃ⇒ : MetaAlg⇒ 𝔛 (𝕋ᵃ 𝔛) (□ᵃ 𝔛 (𝕋ᵃ 𝔛)) λ t ρ → □msub t ρ ms-unit □msub-runitᵃ⇒ {𝔛} = record { ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → dext λ ρ → begin □msub (𝕒𝕝𝕘 𝔛 t) ρ ms-unit ≡⟨ cong (λ - → - ms-unit) □MS.𝕥⟨𝕒⟩ ⟩ 𝕒𝕝𝕘 𝔛 (□estr [ 𝔛 ⊸ 𝕋ᵇ 𝔛 ]ᵇ (𝕋 𝔛) (⅀₁ □msub t) ρ ms-unit) ≡⟨ cong (𝕒𝕝𝕘 𝔛) (estr-unit′ ms-unitᵇ⇒) ⟩ 𝕒𝕝𝕘 𝔛 (⅀₁ (λ e′ → e′ ms-unit) (str ℐᴮ ⟅ 𝔛 ⇨ 𝕋 𝔛 ⟆ (⅀₁ □msub t) ρ)) ≡˘⟨ cong (𝕒𝕝𝕘 𝔛) (str-nat₂ ((λ e′ → e′ ms-unit)) (⅀₁ □msub t) ρ) ⟩ 𝕒𝕝𝕘 𝔛 (str ℐᴮ (𝕋 𝔛) (⅀₁ (λ { h′ ς → h′ ς ms-unit }) (⅀₁ □msub t)) ρ) ≡˘⟨ congr ⅀.homomorphism (λ - → 𝕒𝕝𝕘 𝔛 (str ℐᴮ (𝕋 𝔛) - ρ)) ⟩ 𝕒𝕝𝕘 𝔛 (str ℐᴮ (𝕋 𝔛) (⅀₁ (λ{ t ρ → □msub t ρ ms-unit}) t) ρ) ∎ } ; ⟨𝑣𝑎𝑟⟩ = λ{ {v = v} → dext λ ρ → cong (λ - → - ms-unit) □MS.𝕥⟨𝕧⟩} ; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{ε} → dext λ ρ → begin □msub (𝕞𝕧𝕒𝕣 𝔛 𝔪 ε) ρ ms-unit ≡⟨ cong (λ - → - ms-unit) □MS.𝕥⟨𝕞⟩ ⟩ 𝕤𝕦𝕓 𝔛 (ms-unit 𝔪) (copair (𝕋 𝔛) (λ v → □msub (ε v) ρ ms-unit) (𝕧𝕒𝕣 𝔛)) ≡⟨ Substitution.𝕥⟨𝕞⟩ 𝔛 ⟩ 𝕞𝕧𝕒𝕣 𝔛 𝔪 (λ v → 𝕤𝕦𝕓 𝔛 (𝕧𝕒𝕣 𝔛 (∔.i₁ v)) (copair (𝕋 𝔛) (λ v → □msub (ε v) ρ ms-unit) (𝕧𝕒𝕣 𝔛))) ≡⟨ 𝕞≈₂ 𝔛 (λ v → begin 𝕤𝕦𝕓 𝔛 (𝕧𝕒𝕣 𝔛 (∔.i₁ v)) (copair (𝕋 𝔛) (λ 𝔫 → □msub (ε 𝔫) ρ ms-unit) (𝕧𝕒𝕣 𝔛)) ≡⟨ Mon.lunit (𝕋ᵐ 𝔛) ⟩ copair (𝕋 𝔛) (λ 𝔫 → □msub (ε 𝔫) ρ ms-unit) (𝕧𝕒𝕣 𝔛) (∔.i₁ v) ≡⟨ copair∘i₁ (𝕋 𝔛) v ⟩ □msub (ε v) ρ ms-unit ∎) ⟩ 𝕞𝕧𝕒𝕣 𝔛 𝔪 (λ v → □msub (ε v) ρ ms-unit) ∎ } } where open ≡-Reasoning □msub-runit : (t : 𝕋 𝔛 α Γ)(ρ : Γ ↝ Δ) → □msub t ρ ms-unit ≡ 𝕣𝕖𝕟 𝔛 t ρ □msub-runit {𝔛} t ρ = sym (cong (λ - → - ρ) (Renaming.𝕤𝕖𝕞! 𝔛 □msub-runitᵃ⇒ t))
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_ch11.ads
djamal2727/Main-Bearing-Analytical-Model
0
13559
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 1 1 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2020, 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. -- -- -- ------------------------------------------------------------------------------ -- Expand routines for chapter 11 constructs with Types; use Types; package Exp_Ch11 is procedure Expand_N_Exception_Declaration (N : Node_Id); procedure Expand_N_Handled_Sequence_Of_Statements (N : Node_Id); procedure Expand_N_Raise_Constraint_Error (N : Node_Id); procedure Expand_N_Raise_Expression (N : Node_Id); procedure Expand_N_Raise_Program_Error (N : Node_Id); procedure Expand_N_Raise_Statement (N : Node_Id); procedure Expand_N_Raise_Storage_Error (N : Node_Id); -- Data structures for gathering information to build exception tables -- See runtime routine Ada.Exceptions for full details on the format and -- content of these tables. procedure Expand_At_End_Handler (HSS : Node_Id; Blk_Id : Entity_Id); -- Given handled statement sequence HSS for which the At_End_Proc field -- is set, and which currently has no exception handlers, this procedure -- expands the special exception handler required. This procedure also -- create a new scope for the given block, if Blk_Id is not Empty. procedure Expand_Exception_Handlers (HSS : Node_Id); -- This procedure expands exception handlers, and is called as part -- of the processing for Expand_N_Handled_Sequence_Of_Statements and -- is also called from Expand_At_End_Handler. N is the handled sequence -- of statements that has the exception handler(s) to be expanded. This -- is also called to expand the special exception handler built for -- accept bodies (see Exp_Ch9.Build_Accept_Body). function Find_Local_Handler (Ename : Entity_Id; Nod : Node_Id) return Node_Id; -- This function searches for a local exception handler that will handle -- the exception named by Ename. If such a local hander exists, then the -- corresponding N_Exception_Handler is returned. If no such handler is -- found then Empty is returned. In order to match and return True, the -- handler may not have a choice parameter specification. Nod is the raise -- node that references the handler. function Get_Local_Raise_Call_Entity return Entity_Id; -- This function is provided for use by the back end in conjunction with -- generation of Local_Raise calls when an exception raise is converted to -- a goto statement. If Local_Raise is defined, its entity is returned, -- if not, Empty is returned (in which case the call is silently skipped). -- WARNING: There is a matching C declaration of this subprogram in fe.h function Get_RT_Exception_Entity (R : RT_Exception_Code) return Entity_Id; -- This function is provided for use by the back end in conjunction with -- generation of Local_Raise calls when an exception raise is converted to -- a goto statement. The argument is the reason code which would be used -- to determine which Rcheck_nn procedure to call. The returned result is -- the exception entity to be passed to Local_Raise. -- WARNING: There is a matching C declaration of this subprogram in fe.h procedure Get_RT_Exception_Name (Code : RT_Exception_Code); -- This procedure is provided for use by the back end to obtain the name of -- the Rcheck procedure for Code. The name is appended to Namet.Name_Buffer -- without the __gnat_rcheck_ prefix. -- WARNING: There is a matching C declaration of this subprogram in fe.h procedure Possible_Local_Raise (N : Node_Id; E : Entity_Id); -- This procedure is called whenever node N might cause the back end -- to generate a local raise for a local Constraint/Program/Storage_Error -- exception. It deals with generating a warning if there is no local -- handler (and restriction No_Exception_Propagation is set), or if there -- is a local handler marking that it has a local raise. E is the entity -- of the corresponding exception. procedure Warn_If_No_Local_Raise (N : Node_Id); -- Called for an exception handler that is not the target of a local raise. -- Issues warning if No_Exception_Propagation restriction is set. N is the -- node for the handler. -- WARNING: There is a matching C declaration of this subprogram in fe.h end Exp_Ch11;
Appl/Preferences/PrefMgr/prefmgrApplication.asm
steakknife/pcgeos
504
86297
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: prefmgrApplication.asm AUTHOR: <NAME> ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 10/13/92 Initial version. DESCRIPTION: $Id: prefmgrApplication.asm,v 1.1 97/04/04 16:27:34 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppDetach %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Take care of nuking the current module, in addition to whatever our superclass does. CALLED BY: MSG_META_DETACH PASS: *ds:si = PrefMgrApplication object ^ldx:bp = ack OD cx = ack ID RETURN: DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 12/ 6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppDetach method dynamic PrefMgrApplicationClass, MSG_META_DETACH push ax, cx, dx ifdef USE_EXPRESS_MENU call PrefMgrDestroyExistingExpressMenuObjects endif ; ; Remove the app object from file system notification ; mov cx, ds:[LMBH_handle] mov dx, si mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_FILE_SYSTEM call GCNListRemove pop ax, cx, dx mov di, offset PrefMgrApplicationClass ; ; There's a strange bug in the UI, where if a GenApplication ; subclass handles MSG_META_DETACH and calls ObjEnableDetach, ; the ACK can be sent back to the process more than once (if ; detach is called more than once). The work-around is to ; avoid calling ObjEnableDetach, etc. if we've already been ; called. ; tst es:[moduleHandle] jnz continue GOTO ObjCallSuperNoLock continue: call ObjInitDetach call ObjIncDetach push dx, bp mov dx, ds:[LMBH_handle] mov bp, si call FreeModule pop dx, bp call ObjCallSuperNoLock call ObjEnableDetach ret PrefMgrAppDetach endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppLoadOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup ss:[bp] - GenOptionsParams RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 9/23/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppLoadOptions method dynamic PrefMgrApplicationClass, MSG_GEN_LOAD_OPTIONS push ds, si mov cx, ss mov ds, cx lea dx, ss:[bp].GOP_key lea si, ss:[bp].GOP_category call InitFileReadInteger pop ds, si jc done mov di, ds:[si] add di, ds:[di].Gen_offset mov ds:[di].GAI_appFeatures, ax call ObjMarkDirty done: ret PrefMgrAppLoadOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppAttach %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Turn off the internal modules, if our flags say to do so. Add ourselves to the file change notification list, and scan for modules PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 9/27/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ifdef PREFMGR InternalModuleTableEntry struct IMTE_flag PrefMgrFeatures <> IMTE_object optr InternalModuleTableEntry ends internalModuleTable InternalModuleTableEntry \ <mask PMF_INTERNAL_1, TextTrigger>, <mask PMF_INTERNAL_2, ModemTrigger>, <mask PMF_INTERNAL_3, PrinterTrigger> endif PrefMgrAppAttach method dynamic PrefMgrApplicationClass, MSG_META_ATTACH ; ; Position the window appropriately (if we are running under ; the Consumer UI (Global PC UI). "Appropriately" is on top ; of the array of triggers in the Utilities screen. Different ; positions are set for different screen sizes. ; call UserGetDefaultUILevel cmp ax, UIIL_INTRODUCTORY LONG jne continueAttach push bx, cx, dx, di, si, bp mov dx, (size AddVarDataParams) + (size SpecWinSizePair) sub sp, dx mov bp, sp mov si, bp add si, size AddVarDataParams mov ss:[bp].AVDP_data.segment, ss mov ss:[bp].AVDP_data.offset, si mov ss:[bp].AVDP_dataSize, size SpecWinSizePair mov ss:[bp].AVDP_dataType, \ HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT mov ss:[si].SWSP_x, mask SWSS_RATIO or PCT_25 mov ss:[si].SWSP_y, mask SWSS_RATIO or PCT_25 call UserGetDisplayType and ah, mask DT_DISP_SIZE cmp ah, DS_STANDARD shl offset DT_DISP_SIZE je addVardata mov ss:[si].SWSP_x, mask SWSS_RATIO or PCT_30 mov ss:[si].SWSP_y, mask SWSS_RATIO or PCT_30 addVardata: mov ax, MSG_META_ADD_VAR_DATA mov bx, handle PrefMgrPrimary mov si, offset PrefMgrPrimary mov di, mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK call ObjMessage ; ; Also don't allow window to be moved in the CUI ; mov ax, MSG_META_ADD_VAR_DATA mov dx, (size AddVarDataParams) mov bp, sp mov ss:[bp].AVDP_data.segment, 0 mov ss:[bp].AVDP_data.offset, 0 mov ss:[bp].AVDP_dataSize, 0 mov ss:[bp].AVDP_dataType, HINT_NOT_MOVABLE mov di, mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK call ObjMessage add sp, (size AddVarDataParams) + (size SpecWinSizePair) pop bx, cx, dx, di, si, bp ; ; Call our superclass to complete attach process ; continueAttach: mov ax, MSG_META_ATTACH mov di, offset PrefMgrApplicationClass call ObjCallSuperNoLock ; ; Add this object to the FileChangeNotification list ; mov ax, MSG_PREF_MGR_APPLICATION_SCAN_FOR_MODULES call ObjCallInstanceNoLock mov cx, ds:[LMBH_handle] mov dx, si mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_FILE_SYSTEM call GCNListAdd ; ; Hide any modules as needed (see PrefMgrAppLoadOptions) ; ifdef PREFMGR mov di, ds:[si] add di, ds:[di].Gen_offset mov cx, ds:[di].GAI_appFeatures clr bp startLoop: test cx, cs:[internalModuleTable][bp].IMTE_flag jnz next movdw bxsi, cs:[internalModuleTable][bp].IMTE_object mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE clr di call ObjMessage next: add bp, size InternalModuleTableEntry cmp bp, size internalModuleTable jl startLoop endif ret PrefMgrAppAttach endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppScanForModules %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/14/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppScanForModules method dynamic PrefMgrApplicationClass, MSG_PREF_MGR_APPLICATION_SCAN_FOR_MODULES ifdef USE_EXPRESS_MENU call PrefMgrDestroyExistingExpressMenuObjects else ; ; Remove all the module triggers. To do this, create a ; MSG_GEN_DESTROY for GenTriggerClass ; push si ; app object mov ax, MSG_GEN_DESTROY mov bx, segment GenTriggerClass mov si, offset GenTriggerClass mov di, mask MF_RECORD mov dl, VUM_DELAYED_VIA_APP_QUEUE clr bp call ObjMessage ; di - event handle ; ; Now, send it to the children of the PrefDialogGroup ; mov cx, di mov ax, MSG_GEN_SEND_TO_CHILDREN LoadBXSI PrefMgrDialogGroup mov di, mask MF_FIXUP_DS call ObjMessage pop si ; app object endif ; ; Go to the SYSTEM\PREF directory and scan for modules. ; call PrefMgrSetPath call FileGetCurrentPathIDs jnc gotIDs clr ax gotIDs: call ObjMarkDirty mov di, ds:[si] add di, ds:[di].PrefMgrApplication_offset xchg ds:[di].PMAI_pathIDs, ax tst ax jz afterFree call LMemFree afterFree: call ScanForModulesLow ret PrefMgrAppScanForModules endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppNotifyFileChange %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: See if we should rescan PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup bp - handle of FileChangeNotificationData dx - FileChangeNotificationType RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/14/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppNotifyFileChange method dynamic PrefMgrApplicationClass, MSG_NOTIFY_FILE_CHANGE uses ax, dx, bp, es .enter mov bx, bp call MemLock push bx ; notification block handle mov es, ax clr di call PrefMgrAppNotifyFileChangeLow jnc done mov ax, MSG_PREF_MGR_APPLICATION_SCAN_FOR_MODULES mov bx, ds:[LMBH_handle] clr cx, dx, bp mov di, mask MF_FORCE_QUEUE or mask MF_CHECK_DUPLICATE call ObjMessage done: pop bx ; notification block handle call MemUnlock .leave mov di, offset PrefMgrApplicationClass GOTO ObjCallSuperNoLock PrefMgrAppNotifyFileChange endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppNotifyFileChangeLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Common routine to handle a file change CALLED BY: PrefMgrApplicationNotifyFileChange, PrefMgrAppNotifyFileChangeLow PASS: *ds:si - PrefMgrApplicationClass object dx - FileChangeNotificationType es:di - FileChangeNotificationData RETURN: carry SET if should rescan, carry clear otherwise DESTROYED: ax,bx,cx,dx,di,bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/14/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppNotifyFileChangeLow proc near class PrefMgrApplicationClass EC < cmp dx, FileChangeNotificationType > EC < ERROR_AE ILLEGAL_VALUE mov bx, dx shl bx jmp cs:[notificationTable][bx] notificationTable nptr.near \ notifyCreate, ; FCNT_CREATE notifyRename, ; FCNT_RENAME notifyOpen, ; FCNT_OPEN notifyDelete, ; FCNT_DELETE notifyContents, ; FCNT_CONTENTS notifyAttributes, ; FCNT_ATTRIBUTES notifyFormat, ; FCNT_DISK_FORMAT notifyClose, ; FCNT_CLOSE notifyBatch, ; FCNT_BATCH notifySPAdd, ; FCNT_ADD_SP_DIRECTORY notifySPDelete, ; FCNT_DELETE_SP_DIRECTORY notifyFileUnread, ; FCNT_FILE_UNREAD notifyFileRead ; FCNT_FILE_READ .assert ($-notificationTable)/2 eq FileChangeNotificationType notifyCreate: movdw cxdx, es:[di].FCND_id mov bp, es:[di].FCND_disk GOTO PrefMgrAppCheckIDIsOurs ;------------------- notifyOpen: notifyContents: notifyAttributes: notifyFormat: notifyClose: notifyFileUnread: notifyFileRead: noRescan: clc ret ;------------------- notifyDelete: notifyRename: movdw cxdx, es:[di].FCND_id GOTO PrefMgrAppCheckModuleIDs ;------------------- notifySPAdd: notifySPDelete: mov ax, es:[di].FCND_disk cmp ax, SP_SYSTEM je rescan CheckHack <SP_TOP eq 1> dec ax jnz noRescan rescan: stc ret ;------------------- notifyBatch: mov bx, es:[FCBND_end] mov di, offset FCBND_items batchLoop: cmp di, bx ; done with all entries? jae batchLoopDone ; (carry clear) ; ; Perform another notification. Fetch the type out ; mov dx, es:[di].FCBNI_type push di, dx, bx ; ; Point to the start of the stuff that resembles a ; FileChangeNotificationData structure and recurse ; add di, offset FCBNI_disk call PrefMgrAppNotifyFileChangeLow pop di, dx, bx jc batchLoopDone ; ; Move on to next item ; add di, size FileChangeBatchNotificationItem CheckHack <FCNT_CREATE eq 0 and FCNT_RENAME eq 1> cmp dx, FCNT_RENAME ja batchLoop add di, size FileLongName jmp batchLoop batchLoopDone: ret PrefMgrAppNotifyFileChangeLow endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppCheckIDIsOurs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Determine whether the passed file ID matches one of the file IDs associated with this folder. CALLED BY: PrefMgrAppCheckIDIsOurs PASS: *ds:si - PrefMgrApplicationClass object cx:dx - file ID bp - disk handle, or 0 to just compare IDs RETURN: if match: carry set else carry clear DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/ 2/93 copied from GeoManager %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppCheckIDIsOurs proc near class PrefMgrApplicationClass uses ax,bx .enter mov bx, ds:[si] add bx, ds:[bx].PrefMgrApplication_offset mov bx, ds:[bx].PMAI_pathIDs tst bx jz done ; ; Figure the offset past the last entry. ; mov bx, ds:[bx] ChunkSizePtr ds, bx, ax add ax, bx ; ds:ax <- end call PrefMgrAppCheckIDAgainstListCommon done: .leave ret PrefMgrAppCheckIDIsOurs endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppCheckIDAgainstListCommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check the passed ID against the list CALLED BY: PrefMgrAppCheckIDIsOurs PASS: cx:dx - file ID bp - disk handle (or zero) ds:bx - file ID list ds:ax - end of list RETURN: carry SET if found DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 3/ 5/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppCheckIDAgainstListCommon proc near .enter compareLoop: ; ; See if this entry matches the passed ID ; cmp cx, ds:[bx].FPID_id.high jne next cmp dx, ds:[bx].FPID_id.low jne next cmp bp, ds:[bx].FPID_disk je done next: ; ; Nope -- advance to next, please. ; add bx, size FilePathID cmp bx, ax jb compareLoop stc done: cmc ; return carry *set* if found .leave ret PrefMgrAppCheckIDAgainstListCommon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppCheckModuleIDs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Look in the module array for this item. Note that we'll get a false match if a file is deleted on a different disk that has the same file ID as one of our modules. This is no big deal -- we'll just do an unnecessary rescan. CALLED BY: PrefMgrAppNotifyFileChangeLow PASS: cx:dx - file ID RETURN: carry SET if match DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/14/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppCheckModuleIDs proc near uses es .enter segmov es, dgroup, ax mov ax, offset PrefMgrAppCheckModuleCB call TocGetFileHandle push bx ; file handle push es:[moduleArray] push cs, ax ; callback clr ax push ax, ax ; first element dec ax push ax, ax ; do 'em all clr dx ; element counter call HugeArrayEnum .leave ret PrefMgrAppCheckModuleIDs endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppCheckModuleCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Callback routine to check file IDs CALLED BY: PrefMgrAppCheckModuleIDs via HugeArrayEnum PASS: ds:di - PrefModuleElement cx:dx - file ID to check RETURN: if match carry set else carry clear DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/14/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppCheckModuleCB proc far cmp cx, ds:[di].PME_fileID.high je found cmp dx, ds:[di].PME_fileID.low je found clc done: ret found: stc jmp done PrefMgrAppCheckModuleCB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppRemovingDisk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 2/14/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppRemovingDisk method dynamic PrefMgrApplicationClass, MSG_META_REMOVING_DISK push cx mov di, offset PrefMgrApplicationClass call ObjCallSuperNoLock pop cx ; ; See if the module that's currently in-use lives on the ; passed disk. ; mov bx, es:[moduleHandle] tst bx jz done push ds clr ax call MemLock mov ds, ax test ds:[GH_geodeAttr], mask GA_KEEP_FILE_OPEN jz unlock mov ax, ds:[GH_geoHandle] unlock: call MemUnlock pop ds tst ax jz done mov_tr bx, ax call FileGetDiskHandle cmp bx, cx jne done tst es:[moduleUI].handle jz afterRemove mov ax, MSG_GEN_APPLICATION_REMOVE_ALL_BLOCKING_DIALOGS call ObjCallInstanceNoLock afterRemove: clr dx call FreeModule done: .leave ret PrefMgrAppRemovingDisk endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrApplicationResolveVariant %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 4/ 8/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrApplicationResolveVariant method dynamic PrefMgrApplicationClass, MSG_META_RESOLVE_VARIANT_SUPERCLASS cmp cx, Pref_offset jne gotoSuper mov cx, segment GenApplicationClass mov dx, offset GenApplicationClass ret gotoSuper: mov di, offset PrefMgrApplicationClass GOTO ObjCallSuperNoLock PrefMgrApplicationResolveVariant endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppVisibilityNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 4/ 8/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrAppVisibilityNotification method dynamic PrefMgrApplicationClass, MSG_GEN_APPLICATION_VISIBILITY_NOTIFICATION tst bp jnz done cmpdw cxdx, es:[moduleUI] jne done mov ax, MSG_PREF_MGR_APPLICATION_FREE_MODULE mov di, mask MF_FORCE_QUEUE mov bx, ds:[LMBH_handle] call ObjMessage ; ; If we are in single-module mode, exit the app now. ; segmov ds, dgroup tst ds:[singleModuleMode] jz done mov ax, MSG_META_QUIT mov di, mask MF_FORCE_QUEUE call ObjMessage done: ret PrefMgrAppVisibilityNotification endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrApplicationFreeModule %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Free the currently-loaded module PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 4/ 8/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefMgrApplicationFreeModule method dynamic PrefMgrApplicationClass, MSG_PREF_MGR_APPLICATION_FREE_MODULE clr dx call FreeModule ret PrefMgrApplicationFreeModule endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefMgrAppLostFocusExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: For Express Menu Preferences, nuke the current module when another app comes in front of it. PASS: *ds:si - PrefMgrApplicationClass object ds:di - PrefMgrApplicationClass instance data es - dgroup RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 4/ 8/94 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ifdef USE_EXPRESS_MENU PrefMgrAppLostTargetExcl method dynamic PrefMgrApplicationClass, MSG_META_LOST_TARGET_EXCL mov di, offset PrefMgrApplicationClass call ObjCallSuperNoLock clr dx call FreeModule ret PrefMgrAppLostTargetExcl endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PMAMetaIacpNewConnection %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Switch to the module specified by the IACP client. CALLED BY: MSG_META_IACP_NEW_CONNECTION PASS: *ds:si = PrefMgrApplicationClass object es = segment of PrefMgrApplicationClass ax = message # cx = handle of AppLaunchBlock passed to IACPConnect. DO NOT FREE THIS BLOCK. dx = non-zero if recipient was just launched (i.e. it received the AppLaunchBlock in its MSG_META_ATTACH call) bp = IACPConnection that is now open. RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ayuen 9/16/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PMAMetaIacpNewConnection method dynamic PrefMgrApplicationClass, MSG_META_IACP_NEW_CONNECTION push cx, dx mov di, offset PrefMgrApplicationClass call ObjCallSuperNoLock pop cx, dx ; ; If the app was just launched, the MSG_GEN_PROCESS_OPEN_APPLICATION ; handler would've already brought up the right module. So we don't ; need to do anything. ; tst dx jnz done ; => just launched ; ; Switch to the passed module if a module name is passed in ; ALB_dataFile. ; mov bx, cx call MemLock mov es, ax mov di, offset ALB_dataFile ; es:di = ALB_dataFile LocalIsNull es:[di] jz unlock call SwitchToModuleByName unlock: call MemUnlock done: .leave ret PMAMetaIacpNewConnection endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Crtl-E to bring up a debug dialog box PASS: *ds:si - PrefMgrGenPrimaryClass object ds:di - PrefMgrGenPrimaryClass instance data es - dgroup cx = character value dl = CharFlags dh = ShiftState bp low = ToggleState bp high = scan code Return: carry set if character was handled by someone (and should not be used elsewhere). DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- edwin 2/25/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ifdef GPC_ONLY systemCategoryString char "system", 0 versionKeyString char "version", 0 serialNumberKeyString char "serialNumber", 0 PrefMgrGenPrimaryKbd method dynamic PrefMgrGenPrimaryClass, MSG_META_FUP_KBD_CHAR test dl, mask CF_FIRST_PRESS jz done test dh, mask SS_LCTRL or mask SS_RCTRL jz done push ax, bx, cx, dx, bp, si cmp cl, 'i' je infoDB cmp cl, 'I' je infoDB cmp cl, 'e' je debugModeDB cmp cl, 'E' jne donePop ; ; Display the appropriate "Debug Mode" DB to the user ; debugModeDB: GetResourceHandleNS DebugModeDB, bx mov si, offset DebugModeDB mov ax, MSG_PDGI_INITIALIZE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage GetResourceHandleNS DebugModeDB, bx mov si, offset DebugModeDB mov ax, MSG_GEN_INTERACTION_INITIATE mov di, mask MF_FORCE_QUEUE call ObjMessage ; ; We're done - exit out of here ; donePop: pop ax, bx, cx, dx, bp, si done: mov di, offset PrefMgrGenPrimaryClass call ObjCallSuperNoLock ret ; ; Display the serial number and version information ; infoDB: push ds, es sub sp, 100 ; 50 for ver, 50 for ser num segmov es, ss mov di, sp ; buffer for version => ES:DI segmov ds, cs, cx mov si, offset systemCategoryString mov dx, offset versionKeyString mov bp, InitFileReadFlags <IFCC_INTACT, 0, 0, 50> call InitFileReadString jcxz noVersion readSerialNumber: add di, 50 ; buffer for serial # => ES:DI mov cx, cs mov dx, offset serialNumberKeyString mov bp, InitFileReadFlags <IFCC_INTACT, 0, 0, 50> call InitFileReadString jcxz noSerialNumber displayInfoDB: clr ax pushdw axax ; SDP_helpContext pushdw axax ; SDP_customTriggers pushdw esdi ; SDP_stringArg2 (serial number) sub di, 50 pushdw esdi ; SDP_stringArg1 (version str) mov bx, handle Strings mov si, offset Strings:VersionNumberString call StringLock ; string => DX:BP pushdw dxbp ; SDP_customString mov ax, CustomDialogBoxFlags <0, CDT_NOTIFICATION, \ GIT_NOTIFICATION, 0> push ax call UserStandardDialog call MemUnlock ; unlock Strings block add sp, 100 pop ds, es jmp donePop ; ; No version was found in the .INI file. This should never ; happen, so to make life esy on ourselves we'll just blast ; an error string into the buffer we allocated on the stack ; noVersion: push di mov al, '0' stosb mov al, '.' stosb mov al, '0' stosb clr ax stosb pop di jmp readSerialNumber ; ; No serial number was found in the .INI file. This should never ; happen, so to make life esy on ourselves we'll just blast ; an error string into the buffer we allocated on the stack ; noSerialNumber: push di mov al, 'n' stosb mov al, 'o' stosb mov al, 'n' stosb mov al, 'e' stosb clr ax stosb pop di jmp displayInfoDB PrefMgrGenPrimaryKbd endm PrefMgrGenPrimaryOpen method dynamic PrefMgrGenPrimaryClass, MSG_VIS_OPEN mov di, offset PrefMgrGenPrimaryClass call ObjCallSuperNoLock mov bx, handle DebugCategory call MemLock mov cx, ax mov ds, ax mov si, offset DebugCategory mov si, ds:[si] ; ds:si - category ASCIIZ string mov di, offset DebugKey mov dx, ds:[di] ; cx:dx - key ASCIIZ string call InitFileReadBoolean jc noFoundKey tst ax jz noFoundKey ; ; Replace the Preferences text moniker ; GetResourceHandleNS PrefMgrPrimary, bx mov si, offset PrefMgrPrimary mov cx, handle PrefMgrText2Moniker mov dx, offset PrefMgrText2Moniker mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR mov bp, VUM_DELAYED_VIA_UI_QUEUE mov di, mask MF_FORCE_QUEUE call ObjMessage noFoundKey: mov bx, handle DebugCategory call MemUnlock ret PrefMgrGenPrimaryOpen endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MSG_PDGI_INITIALIZE for PrefDebugGenInteractionClass %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Initialize the db with the right triggers. Pass: Nothing Returns: Nothing DESTROYED: ax, cx, dx, bp -- destroyed REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- edwin 2/25/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefDebugOpen method dynamic PrefDebugGenInteractionClass, MSG_PDGI_INITIALIZE mov bx, handle DebugCategory call MemLock mov cx, ax mov ds, ax mov si, offset DebugCategory mov si, ds:[si] ; ds:si - category ASCIIZ string mov di, offset DebugKey mov dx, ds:[di] ; cx:dx - key ASCIIZ string call InitFileReadBoolean jc noFoundKey tst ax jz noFoundKey ; ; current in debug mode. Show the right UI. ; GetResourceHandleNS NoDebugModeText, bx mov si, offset NoDebugModeText call PrefDebugSetNotUsable mov si, offset DebugModeText call PrefDebugSetUsable mov si, offset SwitchNoDebug call PrefDebugSetUsable mov si, offset SwitchDebug call PrefDebugSetNotUsable jmp done noFoundKey: ; ; Currently in no debug mode. Show the right UI. ; GetResourceHandleNS NoDebugModeText, bx mov si, offset NoDebugModeText call PrefDebugSetUsable mov si, offset DebugModeText call PrefDebugSetNotUsable mov si, offset SwitchNoDebug call PrefDebugSetNotUsable mov si, offset SwitchDebug call PrefDebugSetUsable done: mov bx, handle DebugCategory call MemUnlock ret PrefDebugOpen endm PrefDebugSetNotUsable proc far uses bx .enter mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_DELAYED_VIA_UI_QUEUE mov di, mask MF_FORCE_QUEUE call ObjMessage .leave ret PrefDebugSetNotUsable endp PrefDebugSetUsable proc far uses bx .enter mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_UI_QUEUE mov di, mask MF_FORCE_QUEUE call ObjMessage .leave ret PrefDebugSetUsable endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MSG_PDGI_SET_DEBUG_MODE MSG_PDGI_SET_NO_DEBUG_MODE for PrefDebugGenInteractionClass %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Writing to the ini file about the debug mode. Pass: Nothing Returns: Nothing DESTROYED: ax, cx, dx, bp -- destroyed REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- edwin 2/25/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefDebugSetDebug method dynamic PrefDebugGenInteractionClass, MSG_PDGI_SET_DEBUG_MODE ; ; write to the ini file ; mov bx, handle DebugCategory call MemLock mov cx, ax mov ds, ax mov si, offset DebugCategory mov si, ds:[si] ; ds:si - category ASCIIZ string mov di, offset DebugKey mov dx, ds:[di] ; cx:dx - key ASCIIZ string mov ax, 1 call InitFileWriteBoolean ; ; Make a copy of noDriveLink ; mov di, offset DebugNoDriveLink mov dx, ds:[di] ; cx:dx - key ASCIIZ string mov bp, InitFileReadFlags <IFCC_INTACT, 1, 0, 0> call InitFileReadString push cx call MemLock mov cx, ds mov di, offset DebugNoDriveLinkSafe mov dx, ds:[di] ; cx:dx - key ASCIIZ string mov es, ax clr di ; es:di - data call InitFileWriteString call MemUnlock ; ; Erase noDriveLink ; mov di, offset DebugNoDriveLink mov dx, ds:[di] ; cx:dx - key ASCIIZ string pop di call InitFileWriteString mov bx, handle DebugCategory call MemUnlock ; ; Take care of the UIs ; GetResourceHandleNS DebugModeDB, bx mov si, offset DebugModeDB mov ax, MSG_GEN_INTERACTION_ACTIVATE_COMMAND mov cx, IC_DISMISS mov di, mask MF_FORCE_QUEUE call ObjMessage GetResourceHandleNS DebugActivatedDB, bx mov si, offset DebugActivatedDB mov ax, MSG_GEN_INTERACTION_INITIATE mov di, mask MF_FORCE_QUEUE call ObjMessage ret PrefDebugSetDebug endm PrefDebugSetNoDebug method dynamic PrefDebugGenInteractionClass, MSG_PDGI_SET_NO_DEBUG_MODE .enter ; ; write to the ini file ; mov bx, handle DebugCategory call MemLock mov cx, ax mov ds, ax mov si, offset DebugCategory mov si, ds:[si] ; ds:si - category ASCIIZ string mov di, offset DebugKey mov dx, ds:[di] ; cx:dx - key ASCIIZ string clr ax call InitFileWriteBoolean mov di, offset DebugNoDriveLinkSafe mov dx, ds:[di] ; cx:dx - key ASCIIZ string call InitFileDeleteEntry mov di, offset DebugNoDriveLink mov dx, ds:[di] ; cx:dx - key ASCIIZ string call InitFileDeleteEntry mov bx, handle DebugCategory call MemUnlock ; ; Take care of the UIs ; GetResourceHandleNS DebugModeDB, bx mov si, offset DebugModeDB mov ax, MSG_GEN_INTERACTION_ACTIVATE_COMMAND mov cx, IC_DISMISS mov di, mask MF_FORCE_QUEUE call ObjMessage GetResourceHandleNS DebugModeDB, bx mov si, offset DebugModeDB mov ax, MSG_PDGI_SYS_SHUTDOWN mov di, mask MF_FORCE_QUEUE call ObjMessage .leave ret PrefDebugSetNoDebug endm PrefDebugSysShutDown method dynamic PrefDebugGenInteractionClass, MSG_PDGI_SYS_SHUTDOWN GetResourceHandleNS DebugActivatedDB, bx mov si, offset DebugActivatedDB mov ax, MSG_GEN_INTERACTION_ACTIVATE_COMMAND mov cx, IC_DISMISS mov di, mask MF_FORCE_QUEUE call ObjMessage mov ax, SST_RESTART call SysShutdown ret PrefDebugSysShutDown endm endif ifdef GPC_VERSION COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE for PrinterGenDynamicListClass %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Disable "Set as Default Printer" trigger if the selected printer is already the default printer. Pass: Nothing Returns: Nothing DESTROYED: ax, cx, dx, bp -- destroyed REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- edwin 3/19/99 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrinterListModified method dynamic PrinterGenDynamicListClass, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE, MSG_GEN_ITEM_GROUP_MAKE_ITEM_VISIBLE mov di, offset PrinterGenDynamicListClass call ObjCallSuperNoLock ; Grab the current printer number ; mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION mov di, mask MF_CALL mov bx, handle PrinterInstalledList mov si, offset PrinterInstalledList call ObjMessage ; selection => AX cmp ax, GIGS_NONE ; a valid selection ?? je done ; nope, so we're done mov bx, ax tst bx jz getDefault ; Convert the device number into the printer number (the ; default printer count needs to ignore all non-printer ; types of devices) ; call ConvertToPrinterNumber mov bx, ax getDefault: call SpoolGetDefaultPrinter ; printer # => AX cmp ax, bx je disableTrigger mov ax, MSG_GEN_SET_ENABLED jmp ok enabled: mov ax, MSG_META_DELETE_VAR_DATA mov cx, ATTR_GEN_FOCUS_HELP mov di, mask MF_CALL call ObjMessage done: ret disableTrigger: mov ax, MSG_GEN_SET_NOT_ENABLED ok: GetResourceHandleNS PrinterDefault, bx mov si, offset PrinterDefault mov dl, VUM_DELAYED_VIA_UI_QUEUE mov di, mask MF_FORCE_QUEUE call ObjMessage GetResourceHandleNS PrinterDefault, bx mov si, offset PrinterDefault cmp ax, MSG_GEN_SET_NOT_ENABLED jne enabled mov dx, size AddVarDataParams + (size optr) sub sp, dx mov bp, sp mov ax, handle PrinterUI mov di, offset HelpOnHelp mov ({optr}ss:[bp][(size AddVarDataParams)]).handle, ax mov ({optr}ss:[bp][(size AddVarDataParams)]).offset, di lea ax, ss:[bp][(size AddVarDataParams)] mov ss:[bp].AVDP_data.segment, ss mov ss:[bp].AVDP_data.offset, ax mov ss:[bp].AVDP_dataSize, size optr mov ss:[bp].AVDP_dataType, ATTR_GEN_FOCUS_HELP mov ax, MSG_META_ADD_VAR_DATA mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_STACK call ObjMessage add sp, size AddVarDataParams + (size optr) jmp done PrinterListModified endm endif
src/test/ref/struct-38.asm
jbrandwood/kickc
2
82333
<reponame>jbrandwood/kickc<filename>src/test/ref/struct-38.asm // Complex C-struct - copying a sub-struct with 2-byte members from C-standard layout to Unwound layout // Commodore 64 PRG executable file .file [name="struct-38.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const MOVE_TO = 0 .const SPLINE_TO = 1 .const OFFSET_STRUCT_SEGMENT_TO = 1 .const OFFSET_STRUCT_SPLINEVECTOR16_Y = 2 .label SCREEN = $400 .segment Code main: { .label to_x = 3 .label to_y = 5 .label j = 2 lda #0 sta.z j tax __b1: // struct SplineVector16 to = letter_c[i].to txa asl asl asl stx.z $ff clc adc.z $ff tay lda letter_c+OFFSET_STRUCT_SEGMENT_TO,y sta.z to_x lda letter_c+OFFSET_STRUCT_SEGMENT_TO+1,y sta.z to_x+1 lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y,y sta.z to_y lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y+1,y sta.z to_y+1 // SCREEN[j++] = to.x lda.z j asl tay lda.z to_x sta SCREEN,y lda.z to_x+1 sta SCREEN+1,y // SCREEN[j++] = to.x; inc.z j // SCREEN[j++] = to.y lda.z j asl tay lda.z to_y sta SCREEN,y lda.z to_y+1 sta SCREEN+1,y // SCREEN[j++] = to.y; inc.z j // for( byte i: 0..2) inx cpx #3 bne __b1 // } rts } .segment Data // True type letter c letter_c: .byte MOVE_TO .word 'a', 'b', 0, 0 .byte SPLINE_TO .word 'c', 'd', $67, $a9 .byte SPLINE_TO .word 'e', 'f', $4b, $c3
src/ada/src/utils/bounded_dynamic_arrays.ads
VVCAS-Sean/OpenUxAS
88
6255
generic type Component is private; type List_Index is range <>; type List is array (List_Index range <>) of Component; Default_Value : Component; with function "=" (Left, Right : List) return Boolean is <>; package Bounded_Dynamic_Arrays is pragma Pure; Maximum_Length : constant List_Index := List_Index'Last; -- The physical maximum for the upper bound of the wrapped List array -- values. Defined for readability in predicates. subtype Natural_Index is List_Index'Base range 0 .. Maximum_Length; subtype Index is List_Index range 1 .. Maximum_Length; -- The representation internally uses a one-based array, hence the -- predicate on the generic formal List_Index integer type. type Sequence (Capacity : Natural_Index) is private with Default_Initial_Condition => Empty (Sequence); -- A wrapper for List array values in which Capacity represents the -- physical upper bound. Capacity is, therefore, the maximum number of -- Component values possibly contained by the associated Sequence instance. -- However, not all of the physical capacity of a Sequence need be used at -- any moment, leading to the notion of a logical current length ranging -- from zero to Capacity. Null_List : constant List (List_Index'First .. List_Index'First - 1) := (others => Default_Value); function Null_Sequence return Sequence with Post => Null_Sequence'Result.Capacity = 0 and Length (Null_Sequence'Result) = 0 and Value (Null_Sequence'Result) = Null_List and Null_Sequence'Result = Null_List; function Instance (Content : List) return Sequence with Pre => Content'Length <= Maximum_Length, Post => Length (Instance'Result) = Content'Length and Value (Instance'Result) = Content and Instance'Result = Content and Instance'Result.Capacity = Content'Length and Contains (Instance'Result, Content), Global => null, Depends => (Instance'Result => Content); function Instance (Capacity : Natural_Index; Content : Component) return Sequence with Pre => Capacity >= 1, Post => Length (Instance'Result) = 1 and Value (Instance'Result) (1) = Content and Instance'Result.Capacity = Capacity and Instance'Result = Content and Contains (Instance'Result, Content), Global => null; -- Depends => (Instance'Result => (Capacity, Content)); function Instance (Capacity : Natural_Index; Content : List) return Sequence with Pre => Content'Length <= Capacity, Post => Instance'Result.Capacity = Capacity and Length (Instance'Result) = Content'Length and Value (Instance'Result) = Content and Instance'Result = Content and Contains (Instance'Result, Content), Global => null; -- Depends => (Instance'Result => (Capacity, Content)); function Value (This : Sequence) return List with Post => Value'Result'Length = Length (This) and Value'Result'First = 1 and Value'Result'Last = Length (This), Inline; -- Returns the content of this sequence. The value returned is the -- "logical" value in that only that slice which is currently assigned -- is returned, as opposed to the entire physical representation. function Value (This : Sequence; Position : Index) return Component with Pre => Position in 1 .. Length (This), Inline; function Length (This : Sequence) return Natural_Index with Inline; -- Returns the logical length of This, i.e., the length of the slice of -- This that is currently assigned a value. function Empty (This : Sequence) return Boolean with Post => Empty'Result = (Length (This) = 0), Inline; procedure Clear (This : out Sequence) with Post => Empty (This) and Length (This) = 0 and Value (This) = Null_List and This = Null_Sequence, Global => null, Depends => (This => This), Inline; procedure Copy (Source : Sequence; To : in out Sequence) with Pre => To.Capacity >= Length (Source), Post => Value (To) = Value (Source) and Length (To) = Length (Source) and To = Source and Contains_At (To, 1, Source), Global => null, Depends => (To =>+ Source); -- Copies the logical value of Source, the RHS, to the LHS sequence To. The -- prior value of To is lost. procedure Copy (Source : List; To : in out Sequence) with Pre => To.Capacity >= Source'Length, Post => Value (To) = Source and then Length (To) = Source'Length and then To = Source and then Contains_At (To, 1, Source), Global => null, Depends => (To =>+ Source); -- Copies the value of the array Source, the RHS, to the LHS sequence To. -- The prior value of To is lost. procedure Copy (Source : Component; To : in out Sequence) with Pre => To.Capacity > 0, Post => Value (To) (1) = Source and Length (To) = 1 and To = Source and Contains_At (To, 1, Source), Global => null, Depends => (To =>+ Source); -- Copies the value of the individual array component Source, the RHS, to -- the LHS sequence To. The prior value of To is lost. overriding function "=" (Left, Right : Sequence) return Boolean with Inline; function "=" (Left : Sequence; Right : List) return Boolean with Inline; function "=" (Left : List; Right : Sequence) return Boolean with Inline; function "=" (Left : Sequence; Right : Component) return Boolean with Inline; function "=" (Left : Component; Right : Sequence) return Boolean with Inline; function Normalized (L : List) return List with Pre => L'Length <= Maximum_Length, Post => Normalized'Result'First = 1 and Normalized'Result'Last = L'Length and Normalized'Result = L; -- Slides the input into a 1-based array function "&" (Left : Sequence; Right : Sequence) return Sequence with Pre => Length (Left) <= Maximum_Length - Length (Right), Post => Value ("&"'Result) = Value (Left) & Value (Right) and Value ("&"'Result)'First = 1 and Length ("&"'Result) = Length (Left) + Length (Right) and "&"'Result.Capacity = Length (Left) + Length (Right); function "&" (Left : Sequence; Right : List) return Sequence with Pre => Length (Left) <= Maximum_Length - Right'Length, Post => Value ("&"'Result) = Value (Left) & Right and Value ("&"'Result)'First = 1 and Length ("&"'Result) = Length (Left) + Right'Length and "&"'Result.Capacity = Length (Left) + Right'Length; function "&" (Left : List; Right : Sequence) return Sequence with Pre => Left'Length <= Maximum_Length - Length (Right), Post => Value ("&"'Result) = Normalized (Left) & Value (Right) and Value ("&"'Result)'First = 1 and Length ("&"'Result) = Left'Length + Length (Right) and "&"'Result.Capacity = Left'Length + Length (Right); function "&" (Left : Sequence; Right : Component) return Sequence with Pre => Length (Left) <= Maximum_Length - 1, Post => Value ("&"'Result) = Value (Left) & Right and Value ("&"'Result)'First = 1 and Length ("&"'Result) = Length (Left) + 1 and "&"'Result.Capacity = Length (Left) + 1; function "&" (Left : Component; Right : Sequence) return Sequence with Pre => Length (Right) <= Maximum_Length - 1, Post => Value ("&"'Result) = Left & Value (Right) and Value ("&"'Result)'First = 1 and Length ("&"'Result) = 1 + Length (Right) and "&"'Result.Capacity = 1 + Length (Right); procedure Append (Tail : Sequence; To : in out Sequence) with Pre => Length (Tail) <= To.Capacity - Length (To), Post => Value (To) = Value (To'Old) & Value (Tail) and Length (To) = Length (To'Old) + Length (Tail); -- and -- To = Value (To'Old) & Value (Tail); -- caused crash... procedure Append (Tail : List; To : in out Sequence) with Pre => Tail'Length <= To.Capacity - Length (To), Post => Value (To) = Value (To'Old) & Tail and Length (To) = Length (To'Old) + Tail'Length; procedure Append (Tail : Component; To : in out Sequence) with Pre => Length (To) <= To.Capacity - 1, Post => Value (To) = Value (To'Old) & Tail and Length (To) = Length (To'Old) + 1; procedure Amend (This : in out Sequence; By : Sequence; Start : Index) with Pre => Start <= Length (This) and Start - 1 in 1 .. This.Capacity - Length (By) and Start <= Maximum_Length - Length (By), Post => Value (This) (Start .. Start + Length (By) - 1) = Value (By) and (if Start + Length (By) - 1 > Length (This'Old) then Length (This) = Start + Length (By) - 1 else Length (This) = Length (This'Old)) and Contains_At (This, Start, By) and Unchanged (This'Old, This, Start, Length (By)), Global => null, Depends => (This =>+ (By, Start)); -- Overwrites the content of This, beginning at Start, with the logical -- value of the Sequence argument By procedure Amend (This : in out Sequence; By : List; Start : Index) with Pre => Start <= Length (This) and Start - 1 in 1 .. This.Capacity - By'Length and Start <= Maximum_Length - By'Length, Post => Value (This) (Start .. Start + By'Length - 1) = By and (if Start + By'Length - 1 > Length (This'Old) then Length (This) = Start + By'Length - 1 else Length (This) = Length (This'Old)) and Contains_At (This, Start, By) and Unchanged (This'Old, This, Start, By'Length), Global => null, Depends => (This =>+ (By, Start)); -- Overwrites the content of This, beginning at Start, with the value of -- List argument By procedure Amend (This : in out Sequence; By : Component; Start : Index) with Pre => Start <= Length (This) and Start <= Maximum_Length - 1, Post => Value (This) (Start) = By and Length (This) = Length (This)'Old and Contains_At (This, Start, By) and Unchanged (This'Old, This, Start, 1), Global => null, Depends => (This =>+ (By, Start)); -- Overwrites the content of This, at position Start, with the value of -- the single Component argument By function Location (Fragment : Sequence; Within : Sequence) return Natural_Index with Pre => Length (Fragment) > 0, Post => Location'Result in 0 .. Within.Capacity and (if Length (Fragment) > Within.Capacity then Location'Result = 0) and (if Length (Fragment) > Length (Within) then Location'Result = 0) and (if Location'Result > 0 then Contains_At (Within, Location'Result, Fragment)); -- Returns the starting index of the logical value of the sequence Fragment -- in the sequence Within, if any. Returns 0 when the fragment is not -- found. -- NB: The implementation is not the best algorithm... function Location (Fragment : List; Within : Sequence) return Natural_Index with Pre => Fragment'Length > 0, Post => Location'Result in 0 .. Length (Within) and (if Fragment'Length > Within.Capacity then Location'Result = 0) and (if Fragment'Length > Length (Within) then Location'Result = 0) and (if Location'Result > 0 then Contains_At (Within, Location'Result, Fragment)); -- Returns the starting index of the value of the array Fragment in the -- sequence Within, if any. Returns 0 when the fragment is not found. -- NB: The implementation is a simple linear search... function Location (Fragment : Component; Within : Sequence) return Natural_Index with Post => Location'Result in 0 .. Length (Within) and (if Location'Result > 0 then Contains_At (Within, Location'Result, Fragment)); -- Returns the index of the value of the component Fragment within the -- sequence Within, if any. Returns 0 when the fragment is not found. function Contains (Within : Sequence; Fragment : Component) return Boolean with Inline; function Contains (Within : Sequence; Fragment : List) return Boolean with Pre => Length (Within) - Fragment'Length <= Maximum_Length - 1, Post => (if Fragment'Length = 0 then Contains'Result) and (if Fragment'Length > Length (Within) then not Contains'Result), Inline; function Contains (Within : Sequence; Fragment : Sequence) return Boolean with Pre => Length (Within) - Length (Fragment) <= Maximum_Length - 1, Post => (if Length (Fragment) = 0 then Contains'Result) and (if Length (Fragment) > Length (Within) then not Contains'Result), Inline; function Contains_At (Within : Sequence; Start : Index; Fragment : Sequence) return Boolean with Inline; function Contains_At (Within : Sequence; Start : Index; Fragment : List) return Boolean; -- with Inline, -- Pre => Start <= Length (Within) and then -- Start - 1 <= Length (Within) - Fragment'Length; function Contains_At (Within : Sequence; Position : Index; Fragment : Component) return Boolean with Inline; function Unchanged (Original : Sequence; Current : Sequence; Slice_Start : Index; Slice_Length : Natural_Index) return Boolean -- Returns whether the Original content is the same as the Current content, -- except for the slice beginning at Slice_Start and having Slice_Length -- number of components. with Pre => Original.Capacity = Current.Capacity and Slice_Start <= Length (Original) and Slice_Start - 1 <= Original.Capacity - Slice_Length and Slice_Start <= Maximum_Length - Slice_Length, Ghost; private type Sequence (Capacity : Natural_Index) is record Current_Length : Natural_Index := 0; Content : List (1 .. Capacity) := (others => Default_Value); end record with Predicate => Current_Length in 0 .. Capacity; ------------ -- Length -- ------------ function Length (This : Sequence) return Natural_Index is (This.Current_Length); ----------- -- Value -- ----------- function Value (This : Sequence) return List is (This.Content (1 .. This.Current_Length)); ----------- -- Value -- ----------- function Value (This : Sequence; Position : Index) return Component is (This.Content (Position)); ----------- -- Empty -- ----------- function Empty (This : Sequence) return Boolean is (This.Current_Length = 0); -------------- -- Contains -- -------------- function Contains (Within : Sequence; Fragment : Component) return Boolean is (for some K in 1 .. Length (Within) => Within.Content (K) = Fragment); ----------------- -- Contains_At -- ----------------- function Contains_At (Within : Sequence; Start : Index; Fragment : List) return Boolean is ((Start - 1 <= Within.Current_Length - Fragment'Length) and then Within.Content (Start .. (Start + Fragment'Length - 1)) = Fragment); -- note that this includes the case of a null slice on each side, eg -- when Start = 1 and Fragment'Length = 0, which is intended to return -- True ----------------- -- Contains_At -- ----------------- function Contains_At (Within : Sequence; Start : Index; Fragment : Sequence) return Boolean is (Contains_At (Within, Start, Value (Fragment))); ----------------- -- Contains_At -- ----------------- function Contains_At (Within : Sequence; Position : Index; Fragment : Component) return Boolean is (Position in 1 .. Within.Current_Length and then Within.Content (Position) = Fragment); -------------- -- Contains -- -------------- function Contains (Within : Sequence; Fragment : List) return Boolean is -- We want to return True when the fragment is empty (eg "") because we -- want to use Contains in the postcondition to Instance, and we want to -- allow creating an instance that is empty (because "&" can work with -- empty fragments/instances). Therefore we must allow a zero length -- Fragment. -- -- Also, note that we need to explicitly check for the empty fragment -- (using the short-circuit form) because otherwise the expression -- "(Within.Current_Length - Fragment'Length + 1)" would go past the -- current length. (Fragment'Length = 0 or else -- But also, for Within to possibly contain the slice Fragment, -- the length of the fragment cannot be greater than the length -- of Within.Content. (Fragment'Length in 1 .. Within.Current_Length and then (for some K in Within.Content'First .. (Within.Current_Length - Fragment'Length + 1) => Contains_At (Within, K, Fragment)))); -------------- -- Contains -- -------------- function Contains (Within : Sequence; Fragment : Sequence) return Boolean is (Contains (Within, Value (Fragment))); --------------- -- Unchanged -- --------------- function Unchanged (Original : Sequence; Current : Sequence; Slice_Start : Index; Slice_Length : Natural_Index) return Boolean is -- First we verify the part before the ammended slice, if any. If there -- is none before, this will compare against a null slice and so will -- return True. (Current.Content (1 .. Slice_Start - 1) = Original.Content (1 .. Slice_Start - 1) and then -- Now we verify the part after the ammended slice, if any, but also -- noting that the ammended part might extend past the end of the -- original. In other words, ammending a sequence can extend the -- length of the original. Current.Content (Slice_Start + Slice_Length .. Original.Current_Length) = Original.Content (Slice_Start + Slice_Length .. Original.Current_Length)); --------- -- "=" -- --------- overriding function "=" (Left, Right : Sequence) return Boolean is (Value (Left) = Value (Right)); --------- -- "=" -- --------- function "=" (Left : Sequence; Right : List) return Boolean is (Value (Left) = Right); --------- -- "=" -- --------- function "=" (Left : List; Right : Sequence) return Boolean is (Right = Left); --------- -- "=" -- --------- function "=" (Left : Sequence; Right : Component) return Boolean is (Left.Current_Length = 1 and then Left.Content (1) = Right); --------- -- "=" -- --------- function "=" (Left : Component; Right : Sequence) return Boolean is (Right = Left); end Bounded_Dynamic_Arrays;
orka/src/gl/interface/gl-rasterization.ads
onox/orka
52
25607
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2013 - 2014 <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 GL.Types; private with GL.Low_Level; package GL.Rasterization is pragma Preelaborate; use GL.Types; type Polygon_Mode_Type is (Point, Line, Fill); procedure Set_Polygon_Mode (Value : Polygon_Mode_Type); function Polygon_Mode return Polygon_Mode_Type; procedure Set_Polygon_Offset (Factor, Units : Single; Clamp : Single := 0.0); -- Offset the depth values of a polygon -- -- If Clamp /= 0.0 then the resulting offset is clamped. function Polygon_Offset_Factor return Single; function Polygon_Offset_Units return Single; function Polygon_Offset_Clamp return Single; ----------------------------------------------------------------------------- -- Culling -- ----------------------------------------------------------------------------- -- Enable culling by enabling Cull_Face in package GL.Toggles type Orientation is (Clockwise, Counter_Clockwise); type Face_Selector is (Front, Back, Front_And_Back); procedure Set_Front_Face (Face : Orientation); function Front_Face return Orientation; procedure Set_Cull_Face (Selector : Face_Selector); function Cull_Face return Face_Selector; private for Polygon_Mode_Type use (Point => 16#1B00#, Line => 16#1B01#, Fill => 16#1B02#); for Polygon_Mode_Type'Size use Low_Level.Enum'Size; ----------------------------------------------------------------------------- for Orientation use (Clockwise => 16#0900#, Counter_Clockwise => 16#0901#); for Orientation'Size use Low_Level.Enum'Size; for Face_Selector use (Front => 16#0404#, Back => 16#0405#, Front_And_Back => 16#0408#); for Face_Selector'Size use Low_Level.Enum'Size; end GL.Rasterization;
test/interaction/Issue3264.agda
cruhland/agda
1,989
315
-- Andreas, 2018-10-15, issue #3264 reported by <NAME> -- Refine should not say "cannot refine" just because of a termination error. f : Set → Set f A = {!f!} -- C-c C-r -- EXPECTED ANSWER: -- -- ?1 : Set -- ———— Errors ———————————————————————————————————————————————— -- Termination checking failed for the following functions: -- f -- Problematic calls: -- f (?1 (A = A)) -- when checking that the expression f ? has type Set
src/Internals/protypo-code_trees-interpreter.ads
fintatarta/protypo
0
26106
<reponame>fintatarta/protypo with Protypo.Api.Symbols; with Protypo.Api.Consumers; with Protypo.Api.Engine_Values.Engine_Value_Vectors; with Ada.Containers.Doubly_Linked_Lists; package Protypo.Code_Trees.Interpreter is use Protypo.Api.Engine_Values; procedure Run (Program : Parsed_Code; Symbol_Table : Api.Symbols.Table; Consumer : Api.Consumers.Consumer_Access); Bad_Iterator : exception; Bad_Field : exception; private type Symbol_Table_Access is not null access Api.Symbols.Table; type Break_Type is (Exit_Statement, Return_Statement, None); type Break_Status (Breaking_Reason : Break_Type := None) is record case Breaking_Reason is when None => null; when Exit_Statement => Loop_Label : Label_Type; when Return_Statement => Result : Api.Engine_Values.Engine_Value_Vectors.Vector; end case; end record; No_Break : constant Break_Status := (Breaking_Reason => None); use type Api.Consumers.Consumer_Access; package Consumer_Stacks is new Ada.Containers.Doubly_Linked_Lists (Api.Consumers.Consumer_Access); subtype Consumer_Stack is Consumer_Stacks.List; type Interpreter_Type is tagged limited record Break : Break_Status; Symbol_Table : Api.Symbols.Table; Saved_Consumers : Consumer_Stack; Consumer_Without_Escape_Cursor : Api.Symbols.Protypo_Tables.Cursor; Consumer_With_Escape_Cursor : Api.Symbols.Protypo_Tables.Cursor; end record; type Interpreter_Access is not null access Interpreter_Type; procedure Push_Consumer (Interpreter : Interpreter_Access; Consumer : Api.Consumers.Consumer_Access); procedure Pop_Consumer (Interpreter : Interpreter_Access); function Do_Escape (Status : Interpreter_Access; Input : String) return String; -- Apply the #...# escape expression inside Input. end Protypo.Code_Trees.Interpreter;
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_368.asm
ljhsiun2/medusa
9
244593
<filename>Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_368.asm .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x2679, %r15 xor %rsi, %rsi and $0xffffffffffffffc0, %r15 movntdqa (%r15), %xmm7 vpextrq $1, %xmm7, %r14 nop nop cmp $31794, %rbp lea addresses_D_ht+0xfe79, %rbx nop nop add $54083, %rax mov $0x6162636465666768, %r13 movq %r13, %xmm3 vmovups %ymm3, (%rbx) nop nop nop nop sub $7222, %rbx lea addresses_UC_ht+0x11379, %rax nop nop nop xor %r15, %r15 movl $0x61626364, (%rax) nop nop xor $59275, %r13 lea addresses_A_ht+0x1eb27, %rsi lea addresses_UC_ht+0x3c79, %rdi clflush (%rdi) nop nop nop nop add $33076, %rbp mov $122, %rcx rep movsw nop xor $19566, %r14 lea addresses_WT_ht+0x15af9, %r14 and %rbx, %rbx mov $0x6162636465666768, %r15 movq %r15, (%r14) nop nop nop nop dec %r13 lea addresses_WT_ht+0xee79, %rcx nop nop dec %rsi mov $0x6162636465666768, %rbp movq %rbp, %xmm1 and $0xffffffffffffffc0, %rcx movaps %xmm1, (%rcx) nop nop sub %rbp, %rbp lea addresses_A_ht+0xd581, %rsi nop nop nop cmp $56115, %rax mov $0x6162636465666768, %rdi movq %rdi, (%rsi) nop nop add $756, %rcx lea addresses_D_ht+0x19179, %rcx sub %r13, %r13 mov (%rcx), %r14d nop sub $37618, %r14 lea addresses_normal_ht+0x10fb4, %rsi lea addresses_A_ht+0xcaf9, %rdi dec %rax mov $84, %rcx rep movsq nop xor $49810, %rcx lea addresses_D_ht+0xeb29, %rbp nop nop nop nop nop sub $2113, %rax mov (%rbp), %ecx nop nop nop nop xor %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %rcx push %rdi push %rdx // Load lea addresses_UC+0x11bef, %rdx clflush (%rdx) nop nop nop nop cmp %r15, %r15 mov (%rdx), %di nop add $12209, %r11 // Faulty Load lea addresses_WC+0x19e79, %rdx nop nop nop nop nop and %r15, %r15 mov (%rdx), %r13w lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rdx pop %rdi pop %rcx pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
source/league/league-strings-debug.adb
svn2github/matreshka
24
24888
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2009-2010, <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 Ada.Strings.Unbounded; with Matreshka.Internals.Unicode.Ucd; with Matreshka.Internals.Utf16; package body League.Strings.Debug is use Ada.Strings.Unbounded; use Matreshka.Internals.Strings; use Matreshka.Internals.Unicode; use Matreshka.Internals.Unicode.Ucd; use Matreshka.Internals.Utf16; function Code_Point_Image (Item : Code_Point) return String; function Collation_Weight_Image (Item : Collation_Weight) return String; ---------------------- -- Code_Point_Image -- ---------------------- function Code_Point_Image (Item : Code_Point) return String is To_Hex_Digit : constant array (Code_Point range 0 .. 15) of Character := "0123456789ABCDEF"; begin if Item <= 16#FFFF# then return Result : String (1 .. 4) do Result (4) := To_Hex_Digit (Item mod 16); Result (3) := To_Hex_Digit ((Item / 16) mod 16); Result (2) := To_Hex_Digit ((Item / 256) mod 16); Result (1) := To_Hex_Digit ((Item / 4096) mod 16); end return; else return Result : String (1 .. 6) do Result (6) := To_Hex_Digit (Item mod 16); Result (5) := To_Hex_Digit ((Item / 16) mod 16); Result (4) := To_Hex_Digit ((Item / 256) mod 16); Result (3) := To_Hex_Digit ((Item / 4096) mod 16); Result (2) := To_Hex_Digit ((Item / 65536) mod 16); Result (1) := To_Hex_Digit ((Item / 1048576) mod 16); end return; end if; end Code_Point_Image; ---------------------------- -- Collation_Weight_Image -- ---------------------------- function Collation_Weight_Image (Item : Collation_Weight) return String is To_Hex_Digit : constant array (Collation_Weight range 0 .. 15) of Character := "0123456789ABCDEF"; Result : String (1 .. 4); begin Result (4) := To_Hex_Digit (Item mod 16); Result (3) := To_Hex_Digit ((Item / 16) mod 16); Result (2) := To_Hex_Digit ((Item / 256) mod 16); Result (1) := To_Hex_Digit ((Item / 4096) mod 16); return Result; end Collation_Weight_Image; ----------------- -- Debug_Image -- ----------------- function Debug_Image (Item : Sort_Key) return String is D : constant Shared_Sort_Key_Access := Item.Data; Result : Unbounded_String; begin Append (Result, '['); for J in 1 .. D.Last loop if J /= 1 then Append (Result, ' '); end if; if D.Data (J) = 0 then Append (Result, "|"); else Append (Result, Collation_Weight_Image (D.Data (J))); end if; end loop; Append (Result, ']'); return To_String (Result); end Debug_Image; ----------------- -- Debug_Image -- ----------------- function Debug_Image (Item : Universal_String) return String is D : constant Shared_String_Access := Item.Data; Result : Unbounded_String; Index : Utf16_String_Index := 0; Code : Code_Point; begin while Index < D.Unused loop if Index /= 0 then Append (Result, ' '); end if; Unchecked_Next (D.Value, Index, Code); Append (Result, Code_Point_Image (Code)); end loop; return To_String (Result); end Debug_Image; end League.Strings.Debug;
programs/oeis/040/A040881.asm
karttu/loda
1
92301
; A040881: Continued fraction for sqrt(912). ; 30,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60,5,60 sub $0,1 mod $0,2 mul $0,11 add $0,2 pow $0,2 mov $1,$0 div $1,15 mul $1,5 add $1,5
template.asm
harshboi/Assembly-and-Computer-Architecture
0
347
<reponame>harshboi/Assembly-and-Computer-Architecture TITLE Program Template (template.asm) ; Author: <NAME> ; Course / Project ID: CS 271 Date: 1/26/2018 ; Description: Program 2 INCLUDE Irvine32.inc ;.386 ;.model flat,stdcall ;.stack 4096 ExitProcess proto,dwExitCode:dword _min EQU 10 _max EQU 200 _lo EQU 100 _hi EQU 999 .data ; declare variables here name WORD DUP(?) _title BYTE "Sorting Random Integers Programmed by Harshvardhan",0 description BYTE "This program generates random numbers in the range [100 .. 999], displays the original list, sorts the list, and calculates the median value. Finally, it displays the list sorted in descending order. ",0 question0 BYTE "How many numbers should be generated? [10 .. 200]: ",0 output0 BYTE "The unsorted random numbers:",0 output1 BYTE "The median is ",0 output2 BYTE "The sorted list is:",0 error BYTE "Out of range. Try again.",0 min DWORD _min max DWORD _max lo DWORD _lo hi DWORD _hi num_gen DWORD ? array DWORD _max DUP(?) j DWORD ? temp DWORD ? temp1 DWORD ? spaces BYTE " ",0 mybytes BYTE 12h,34h,56h,78h b WORD 1234h .code main proc ; write your code here CALL Randomize push OFFSET _title push OFFSET description CALL introduction push OFFSET num_gen CALL getdata push OFFSET array ;0 36 PUSH num_gen ;4 32 PUSH lo ;8 28 PUSH hi ;12 24 16 CALL fillarray ;16 20 push num_gen ;4 as array is still on the stack0 CALL _SORT push num_gen CALL sorted invoke ExitProcess,0 main ENDP ;--------------------------------------------------------------------------------------------------------- ; INTRODUCTION ; Print general information about the program ;--------------------------------------------------------------------------------------------------------- introduction PROC push edx ; Pushes all the flags push ebp mov ebp,esp mov edx, OFFSET _title CALL WriteString CALL CRLF CALL CRLF mov edx, OFFSET description CALL WriteString CALL CRLF CALL CRLF pop ebp pop edx ret 8 introduction ENDP ;--------------------------------------------------------------------------------------------------------- ;GETDATA ; gets the range of numbers ; ALL VALUES POPPED INSIDE + ADDRESS OF NUM_GEN ;--------------------------------------------------------------------------------------------------------- getdata PROC push eax push edx push esp push ebp mov edx, OFFSET question0 CALL WriteString Call ReadInt CALL CRLF mov ebp, [esp+20] mov [ebp], eax validate: cmp eax, min jl error_detected cmp eax, max jg error_detected jmp all_good error_detected: mov edx, OFFSET error CALL WriteString CALL CRLF mov edx, OFFSET question0 CALL WriteString CALL ReadInt mov [ebp],eax jmp validate all_good: pop ebp pop esp pop edx pop eax ret 4 getdata ENDP ;--------------------------------------------------------------------------------------------------------- ;FILLARRAY ;Fills the array with random numbers ;--------------------------------------------------------------------------------------------------------- fillarray PROC push eax ;20 push ecx ;24 push edx ;28 push ebp ;32 mov ebp,esp ; Moves the offset of the stack pointer mov esi,[ebp+32] ; Moves the OFFSET of the arraymov mov ecx,[ebp+28] ; Moves the total number of array elements to be obtained mov temp,ecx mov edx, 0 L1: mov eax,[ebp+20] ; Move the value for max into eax ;mov temp,eax sub eax,[ebp+24] ; subtract low from eax (high) ;mov temp,eax inc eax ; Increment for the random range function to stop at the previous value CALL RandomRange add eax, [ebp+24] ; Gets a value in the range 100, 999 mov [esi+edx],eax mov eax,[esi+edx] mov temp,eax add edx,4 loop L1 pop ebp pop edx pop ecx pop eax ret 12 ; Will not pop the array fillarray ENDP ;--------------------------------------------------------------------------------------------------------- ; Sort ; Will sort the array ;--------------------------------------------------------------------------------------------------------- _SORT PROC push ebp push eax push ecx mov ebp, esp mov ecx, [ebp+16] ; ecx = num_gen upper_loop: mov edi, [ebp+20] ;array's current element mov eax, ecx lower_loop: mov edx, [edi] mov ebx, [edi+4] cmp ebx, edx jle next_iteration ; Performs the comparison mov [edi], ebx ; Will switch the numbers mov [edi+4], edx next_iteration: add edi, 4 loop lower_loop mov ecx, eax loop upper_loop pop ecx pop eax pop ebp ret 4 _SORT ENDP ;--------------------------------------------------------------------------------------------------------- ; Sorted ; Prints the sorted array ;--------------------------------------------------------------------------------------------------------- SORTED PROC mov edx, OFFSET output0 CALL WriteString CALL CRLF mov ebp,esp mov ecx,[ebp+4] mov edi,[ebp+8] mov eax,0 mov ebx,0 mov edx,0 mov esi,0 L1: mov eax,[edi+4*ebx] cmp edx,10 jge _placeholder _back: CALL WriteDec mov esi,edx mov edx, OFFSET spaces CALL WriteString mov edx,esi mov esi,0 inc edx add ebx,1 loop L1 JMP EXITt _placeholder: CALL CRLF mov edx,0 jmp _back exitt: ret 8 SORTED ENDP end main
3-mid/opengl/source/lean/text/private/opengl-fontimpl.ads
charlie5/lace
20
8938
<reponame>charlie5/lace<gh_stars>10-100 with openGL.Glyph.Container, freetype.Face, freetype.charMap, Freetype_C, interfaces.C.Pointers; limited with openGL.Font; private with freetype.face_Size; package openGL.FontImpl -- -- Implements an openGL font. -- is type Item is tagged limited private; type View is access all Item'Class; --------- -- Types -- type RenderMode is (RENDER_FRONT, RENDER_BACK, RENDER_SIDE, RENDER_ALL); for RenderMode use (RENDER_FRONT => 16#0001#, RENDER_BACK => 16#0002#, RENDER_SIDE => 16#0004#, RENDER_ALL => 16#ffff#); type TextAlignment is (ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_JUSTIFY); for TextAlignment use (ALIGN_LEFT => 0, ALIGN_CENTER => 1, ALIGN_RIGHT => 2, ALIGN_JUSTIFY => 3); -- unsigned_char_Pointer -- use Interfaces; type unsigned_char_array is array (C.size_t range <>) of aliased C.unsigned_char; package unsigned_char_Pointers is new C.Pointers (Index => C.size_t, Element => C.unsigned_char, Element_array => unsigned_char_array, default_Terminator => 0); subtype unsigned_char_Pointer is unsigned_char_Pointers.Pointer; --------- -- Forge -- procedure define (Self : access Item; ftFont : access Font.item'Class; fontFilePath : in String); procedure define (Self : access Item; ftFont : access Font.item'Class; pBufferBytes : access C.unsigned_char; bufferSizeInBytes : in Integer); procedure destruct (Self : in out Item); --------------- -- 'Protected' ~ For derived class use only. -- function Err (Self : in Item) return freetype_c.FT_Error; function attach (Self : access Item; fontFilePath : in String) return Boolean; function attach (Self : access Item; pBufferBytes : access C.unsigned_char; bufferSizeInBytes : in Integer) return Boolean; function FaceSize (Self : access Item; Size : in Natural; x_Res, y_Res : in Natural) return Boolean; function FaceSize (Self : in Item) return Natural; procedure Depth (Self : in out Item; Depth : in Real); procedure Outset (Self : in out Item; Outset : in Real); procedure Outset (Self : in out Item; Front : in Real; Back : in Real); procedure GlyphLoadFlags (Self : in out Item; Flags : in freetype_c.FT_Int); function CharMap (Self : access Item; Encoding : in freetype_c.FT_Encoding) return Boolean; function CharMapCount (Self : in Item) return Natural; function CharMapList (Self : access Item) return freetype.face.FT_Encodings_view; function Ascender (Self : in Item) return Real; function Descender (Self : in Item) return Real; function LineHeight (Self : in Item) return Real; function BBox (Self : access Item; Text : in String; Length : in Integer; Position : in Vector_3; Spacing : in Vector_3) return Bounds; function Advance (Self : access Item; Text : in String; Length : in Integer; Spacing : in Vector_3) return Real; function kern_Advance (Self : in Item; From, To : in Character) return Real; function x_PPEM (Self : in Item) return Real; function x_Scale (Self : in Item) return Real; function y_Scale (Self : in Item) return Real; function render (Self : access Item; Text : in String; Length : in Integer; Position : in Vector_3; Spacing : in Vector_3; renderMode : in Integer) return Vector_3; private type glyph_Container_view is access all openGL.Glyph.Container.item'Class; type Item is tagged limited record Face : aliased freetype.Face.item; -- Current face object. charSize : freetype.face_Size.item; -- Current size object. load_Flags : freetype_c.FT_Int; -- The default glyph loading flags. Err : freetype_c.FT_Error; -- Current error code. Zero means no error. Intf : access Font.item'Class; -- A link back to the interface of which we implement. glyphList : Glyph_Container_view; -- An object that holds a list of glyphs Pen : Vector_3; -- Current pen or cursor position; end record; function CheckGlyph (Self : access Item; Character : in freetype.charmap.CharacterCode) return Boolean; -- -- Check that the glyph at <code>chr</code> exist. If not load it. -- -- Character: The character index. -- -- Returns true if the glyph can be created. end openGL.FontImpl;
case-studies/performance/verification/alloy/ppc/tests/aclwdrr017.als
uwplse/memsynth
19
3793
<filename>case-studies/performance/verification/alloy/ppc/tests/aclwdrr017.als module tests/aclwdrr017 open program open model /** PPC aclwdrr017 "Fre SyncdWR Fre Rfe LwSyncdRR" Cycle=Fre SyncdWR Fre Rfe LwSyncdRR Relax=ACLwSyncdRR Safe=Fre SyncdWR { 0:r2=y; 0:r4=x; 1:r2=x; 2:r2=x; 2:r4=y; } P0 | P1 | P2 ; li r1,1 | li r1,1 | lwz r1,0(r2) ; stw r1,0(r2) | stw r1,0(r2) | lwsync ; sync | | lwz r3,0(r4) ; lwz r3,0(r4) | | ; exists (0:r3=0 /\ 2:r1=1 /\ 2:r3=0) **/ one sig x, y extends Location {} one sig P1, P2, P3 extends Processor {} one sig op1 extends Write {} one sig op2 extends Sync {} one sig op3 extends Read {} one sig op4 extends Write {} one sig op5 extends Read {} one sig op6 extends Lwsync {} one sig op7 extends Read {} fact { P1.write[1, op1, y, 1] P1.sync[2, op2] P1.read[3, op3, x, 0] P2.write[4, op4, x, 1] P3.read[5, op5, x, 1] P3.lwsync[6, op6] P3.read[7, op7, y, 0] } Allowed: run { Allowed_PPC } for 4 int expect 1
thirdparty/adasdl/thin/adasdl/AdaSDL/binding/sdl-rwops.ads
Lucretia/old_nehe_ada95
0
14754
-- ----------------------------------------------------------------- -- -- AdaSDL -- -- Binding to Simple Direct Media Layer -- -- Copyright (C) 2001 A.M.F.Vargas -- -- <NAME> -- -- Ponta Delgada - Azores - Portugal -- -- http://www.adapower.net/~avargas -- -- E-mail: <EMAIL> -- -- ----------------------------------------------------------------- -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- ----------------------------------------------------------------- -- -- **************************************************************** -- -- This is an Ada binding to SDL ( Simple DirectMedia Layer from -- -- Sam Lantinga - www.libsld.org ) -- -- **************************************************************** -- -- In order to help the Ada programmer, the comments in this file -- -- are, in great extent, a direct copy of the original text in the -- -- SDL header files. -- -- **************************************************************** -- with System; with Interfaces.C; with Interfaces.C.Strings; with Interfaces.C_Streams; with SDL.Types; use SDL.Types; -- This is a set of routines from SDL lib that doesn't -- have a dependency from the SDL Ada package. package SDL.RWops is package C renames Interfaces.C; package C_Streams renames Interfaces.C_Streams; package CS renames Interfaces.C.Strings; type void_ptr is new System.Address; type FILE_ptr is new C_Streams.FILEs; type RWops; type RWops_ptr is access all RWops; -- Seek to 'offset' relative to whence, one of stdio's -- whence values: SEEK_SET, SEEK_CUR, SEEK_END -- returns the finnal offset in the data source. type Seek_Type is access function ( context : RWops_ptr; offset : C.int; whence : C.int) return C.int; pragma Convention (C, Seek_Type); -- Read up to 'num' objects each of size 'objsize' from -- the data source to the ares pointed by 'ptr'. -- Returns number of objects read, or -1 if the read failed. type Read_Type is access function ( context : RWops_ptr; ptr : void_ptr; size : C.int; maxnum : C.int) return C.int; pragma Convention (C, Read_Type); -- Write exactly 'num' objects each of size 'objsize' from -- the area pointed by 'ptr' to data source. -- Returns 'num', or -1 if the write failed. type Write_Type is access function ( context : RWops_ptr; ptr : void_ptr; size : C.int; num : C.int) return C.int; pragma Convention (C, Write_Type); -- Close and free an allocated SDL_FSops structure. type Close_Type is access function ( context : RWops_ptr) return C.int; pragma Convention (C, Close_Type); type Stdio_Type is record autoclose : C.int; fp : FILE_ptr; end record; pragma Convention (C, Stdio_Type); type Uint8_ptr is access all Uint8; type Mem_Type is record base, here, stop : Uint8_ptr; end record; pragma Convention (C, Mem_Type); type Unknown_Type is record data1 : void_ptr; end record; pragma Convention (C, Unknown_Type); type Hidden_Select_Type is (Is_Stdio, Is_Mem, Is_Unknown); type Hidden_Union_Type (Hidden_Select : Hidden_Select_Type := Is_Stdio) is record case Hidden_Select is when Is_Stdio => stdio : Stdio_Type; when Is_Mem => mem : Mem_Type; when Is_Unknown => unknown : Unknown_Type; end case; end record; pragma Convention (C, Hidden_Union_Type); pragma Unchecked_Union (Hidden_Union_Type); -- This is the read/write operation structure -- very basic */ type RWops is record seek : Seek_Type; read : Read_Type; write : Read_Type; close : Close_Type; type_union : Uint32; hidden : Hidden_Union_Type; end record; function RWFromFile ( file : CS.chars_ptr; mode : CS.chars_ptr) return RWops_ptr; pragma Import (C, RWFromFile, "SDL_RWFromFile"); function RW_From_File ( file : String; mode : String) return RWops_ptr; pragma Inline (RW_From_File); function RWFromFP ( file : FILE_ptr; autoclose : C.int) return RWops_ptr; pragma Import (C, RWFromFP, "SDL_RWFromFP"); function RWFromMem ( mem : void_ptr; size : C.int) return RWops_ptr; pragma Import (C, RWFromMem, "SDL_RWFromMem"); function AllocRW return RWops_ptr; pragma Import (C, AllocRW, "SDL_AllocRW"); procedure FreeRW ( area : RWops_ptr); pragma Import (C, FreeRW, "SDL_FreeRW"); function RWSeek ( ctx : RWops_ptr; offset : C.int; whence : C.int) return C.int; pragma Inline (RWSeek); function RWtell ( ctx : RWops_ptr) return C.int; pragma Inline (RWtell); function RWread ( ctx : RWops_ptr; ptr : void_ptr; size : C.int; n : C.int) return C.int; pragma Inline (RWread); function RWwrite ( ctx : RWops_ptr; ptr : void_ptr; size : C.int; n : C.int) return C.int; pragma Inline (RWwrite); function RWclose ( ctx : RWops_ptr) return C.int; pragma Inline (RWclose); end SDL.RWops;
src/planets.adb
onox/orka-demo
3
11282
<gh_stars>1-10 with Ada.Numerics.Generic_Elementary_Functions; package body Planets is package EF is new Ada.Numerics.Generic_Elementary_Functions (Orka.Float_64); function Get_Vector (Latitude, Longitude : Orka.Float_64) return Matrices.Vectors.Vector4 is Lon_Rad : constant Orka.Float_64 := Matrices.Vectors.To_Radians (Longitude); Lat_Rad : constant Orka.Float_64 := Matrices.Vectors.To_Radians (Latitude); XY : constant Orka.Float_64 := EF.Cos (Lat_Rad); X : constant Orka.Float_64 := XY * EF.Cos (Lon_Rad); Y : constant Orka.Float_64 := XY * EF.Sin (Lon_Rad); Z : constant Orka.Float_64 := EF.Sin (Lat_Rad); begin pragma Assert (Matrices.Vectors.Normalized ((X, Y, Z, 0.0))); return (X, Y, Z, 1.0); end Get_Vector; function Flattened_Vector (Planet : Planet_Characteristics; Direction : Matrices.Vector4; Altitude : Orka.Float_64) return Matrices.Vectors.Vector4 is E2 : constant Orka.Float_64 := 2.0 * Planet.Flattening - Planet.Flattening**2; N : constant Orka.Float_64 := Planet.Semi_Major_Axis / EF.Sqrt (1.0 - E2 * Direction (Orka.Z)**2); begin return (Direction (Orka.X) * (N + Altitude), Direction (Orka.Y) * (N + Altitude), Direction (Orka.Z) * (N * (1.0 - E2) + Altitude), 1.0); end Flattened_Vector; function Geodetic_To_ECEF (Planet : Planet_Characteristics; Latitude, Longitude, Altitude : Orka.Float_64) return Matrices.Vector4 is begin return Flattened_Vector (Planet, Get_Vector (Latitude, Longitude), Altitude); end Geodetic_To_ECEF; function Radius (Planet : Planet_Characteristics; Direction : Matrices.Vector4) return Orka.Float_64 is begin return Matrices.Vectors.Length (Flattened_Vector (Planet, Direction, 0.0)); end Radius; function Radius (Planet : Planet_Characteristics; Latitude, Longitude : Orka.Float_64) return Orka.Float_64 is begin return Radius (Planet, Get_Vector (Latitude, Longitude)); end Radius; end Planets;
libsrc/_DEVELOPMENT/adt/p_list/c/sdcc_iy/p_list_push_back_callee.asm
meesokim/z88dk
0
87392
; void *p_list_push_back_callee(p_list_t *list, void *item) SECTION code_adt_p_list PUBLIC _p_list_push_back_callee _p_list_push_back_callee: pop af pop hl pop de push af INCLUDE "adt/p_list/z80/asm_p_list_push_back.asm"
Transynther/x86/_processed/AVXALIGN/_zr_/i3-7100_9_0x84_notsx.log_362_1970.asm
ljhsiun2/medusa
9
174759
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0x1c00d, %rcx nop nop sub $46784, %r14 movb $0x61, (%rcx) nop inc %r12 lea addresses_WT_ht+0x13a0d, %r14 nop nop and %rax, %rax movb (%r14), %r8b nop nop nop nop nop sub $15349, %r15 lea addresses_WT_ht+0x12d91, %r8 nop nop inc %r12 mov $0x6162636465666768, %r15 movq %r15, %xmm1 movups %xmm1, (%r8) nop and $43101, %r14 lea addresses_WT_ht+0x1580d, %rsi lea addresses_WT_ht+0xdf0d, %rdi nop nop sub %r14, %r14 mov $72, %rcx rep movsw nop nop nop and %rcx, %rcx lea addresses_WC_ht+0xfecd, %rsi lea addresses_D_ht+0x2c0d, %rdi nop nop nop xor $27646, %r12 mov $90, %rcx rep movsq xor $55663, %r8 lea addresses_WT_ht+0x428d, %rdi nop nop sub $56879, %r15 mov (%rdi), %rcx inc %r15 lea addresses_D_ht+0x1a40d, %rsi lea addresses_normal_ht+0x132cd, %rdi nop nop nop sub $20664, %r8 mov $30, %rcx rep movsl nop nop add %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r14 push %rax push %rbp push %rbx // Store mov $0x6471f50000000a0d, %rbx nop nop nop nop sub $12023, %rax movl $0x51525354, (%rbx) add $7410, %r12 // Store lea addresses_D+0x1c10d, %r12 nop nop nop nop nop add %rbp, %rbp movb $0x51, (%r12) nop nop nop nop add %r13, %r13 // Faulty Load lea addresses_US+0x1180d, %r14 nop nop nop nop nop cmp $36033, %r10 movb (%r14), %r12b lea oracles, %r13 and $0xff, %r12 shlq $12, %r12 mov (%r13,%r12,1), %r12 pop %rbx pop %rbp pop %rax pop %r14 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 7, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'00': 362} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Equality/Setoid.agda
omega12345/agda-mode
0
12724
<filename>test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Equality/Setoid.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Semi-heterogeneous vector equality over setoids ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Relation.Binary module Data.Vec.Relation.Binary.Equality.Setoid {a ℓ} (S : Setoid a ℓ) where open import Data.Nat.Base using (ℕ; zero; suc; _+_) open import Data.Vec open import Data.Vec.Relation.Binary.Pointwise.Inductive as PW using (Pointwise) open import Function open import Level using (_⊔_) open import Relation.Binary open import Relation.Binary.PropositionalEquality as P using (_≡_) open Setoid S renaming (Carrier to A) ------------------------------------------------------------------------ -- Definition of equality infix 4 _≋_ _≋_ : ∀ {m n} → REL (Vec A m) (Vec A n) (a ⊔ ℓ) _≋_ = Pointwise _≈_ open Pointwise public using ([]; _∷_) open PW public using (length-equal) ------------------------------------------------------------------------ -- Relational properties ≋-refl : ∀ {n} → Reflexive (_≋_ {n}) ≋-refl = PW.refl refl ≋-sym : ∀ {n m} → Sym _≋_ (_≋_ {m} {n}) ≋-sym = PW.sym sym ≋-trans : ∀ {n m o} → Trans (_≋_ {m}) (_≋_ {n} {o}) (_≋_) ≋-trans = PW.trans trans ≋-isEquivalence : ∀ n → IsEquivalence (_≋_ {n}) ≋-isEquivalence = PW.isEquivalence isEquivalence ≋-setoid : ℕ → Setoid a (a ⊔ ℓ) ≋-setoid = PW.setoid S ------------------------------------------------------------------------ -- map open PW public using ( map⁺) ------------------------------------------------------------------------ -- ++ open PW public using (++⁺ ; ++⁻ ; ++ˡ⁻; ++ʳ⁻) ++-identityˡ : ∀ {n} (xs : Vec A n) → [] ++ xs ≋ xs ++-identityˡ _ = ≋-refl ++-identityʳ : ∀ {n} (xs : Vec A n) → xs ++ [] ≋ xs ++-identityʳ [] = [] ++-identityʳ (x ∷ xs) = refl ∷ ++-identityʳ xs map-++-commute : ∀ {b m n} {B : Set b} (f : B → A) (xs : Vec B m) {ys : Vec B n} → map f (xs ++ ys) ≋ map f xs ++ map f ys map-++-commute f [] = ≋-refl map-++-commute f (x ∷ xs) = refl ∷ map-++-commute f xs ------------------------------------------------------------------------ -- concat open PW public using (concat⁺; concat⁻) ------------------------------------------------------------------------ -- replicate replicate-shiftʳ : ∀ {m} n x (xs : Vec A m) → replicate {n = n} x ++ (x ∷ xs) ≋ replicate {n = 1 + n} x ++ xs replicate-shiftʳ zero x xs = ≋-refl replicate-shiftʳ (suc n) x xs = refl ∷ (replicate-shiftʳ n x xs)
polynomial/clenshaw/chebychev_quadrature.ads
jscparker/math_packages
30
10885
-- -- PACKAGE Chebychev_Quadrature -- -- The package provides tables and procedures for Gaussian quadrature -- based on Chebychev polynomials (Gaussian-Chebychev quadrature). -- The number of points used in the quadrature (callocation points) -- is the generic formal parameter: No_Of_Gauss_Points. -- -- Usually not the best quadrature routine, but works well in special -- cases. -- -- Use the following fragment to calculate the definite integral -- of a function F(X) in an interval (X_Starting, X_Final): -- -- Find_Gauss_Nodes (X_Starting, X_Final, X_gauss); -- -- for I in Gauss_Index loop -- F_val(I) := F (X_gauss(I)); -- end loop; -- -- Evaluate the function at the callocation points just once. -- -- Get_Integral (F_val, X_Starting, X_Final, Area); -- generic type Real is digits <>; No_Of_Gauss_Points : Positive; with function Cos (X : Real) return Real is <>; with function Sin (X : Real) return Real is <>; package Chebychev_Quadrature is type Gauss_Index is new Positive range 1 .. No_Of_Gauss_Points; type Gauss_Values is array(Gauss_Index) of Real; -- Plug X_Starting and X_Final into the following to get the -- the points X_gauss at which the function to -- be integrated must be evaluated: procedure Find_Gauss_Nodes (X_Starting : in Real; X_Final : in Real; X_gauss : out Gauss_Values); type Function_Values is array(Gauss_Index) of Real; -- Fill array F_val of this type with values function F: -- -- for I in Gauss_Index loop -- F_val(I) := F (X_gauss(I)); -- end loop; procedure Get_Integral (F_val : in Function_Values; X_Starting : in Real; X_Final : in Real; Area : out Real); end Chebychev_Quadrature;
libsrc/osca/get_driver_list.asm
andydansby/z88dk-mk2
1
83245
; ; Old School Computer Architecture - interfacing FLOS ; <NAME>, 2011 ; ; Get pointer to driver table ; ; $Id: get_driver_list.asm,v 1.1 2011/08/03 08:13:40 stefano Exp $ ; INCLUDE "flos.def" XLIB get_driver_list get_driver_list: call kjt_get_device_info ld h,d ld l,e ret
src/Fragment/Equational/Model/Base.agda
yallop/agda-fragment
18
3746
{-# OPTIONS --without-K --exact-split --safe #-} open import Fragment.Equational.Theory module Fragment.Equational.Model.Base (Θ : Theory) where open import Fragment.Equational.Model.Satisfaction {Σ Θ} open import Fragment.Algebra.Algebra (Σ Θ) hiding (∥_∥/≈) open import Fragment.Algebra.Free (Σ Θ) open import Level using (Level; _⊔_; suc) open import Function using (_∘_) open import Data.Fin using (Fin) open import Data.Nat using (ℕ) open import Relation.Binary using (Setoid) private variable a ℓ : Level Models : Algebra {a} {ℓ} → Set (a ⊔ ℓ) Models S = ∀ {n} → (eq : eqs Θ n) → S ⊨ (Θ ⟦ eq ⟧ₑ) module _ (S : Setoid a ℓ) where record IsModel : Set (a ⊔ ℓ) where field isAlgebra : IsAlgebra S models : Models (algebra S isAlgebra) open IsAlgebra isAlgebra public record Model : Set (suc a ⊔ suc ℓ) where field ∥_∥/≈ : Setoid a ℓ isModel : IsModel ∥_∥/≈ ∥_∥ₐ : Algebra ∥_∥ₐ = algebra ∥_∥/≈ (IsModel.isAlgebra isModel) ∥_∥ₐ-models : Models ∥_∥ₐ ∥_∥ₐ-models = IsModel.models isModel open Algebra (algebra ∥_∥/≈ (IsModel.isAlgebra isModel)) hiding (∥_∥/≈) public open Model public
programs/oeis/005/A005881.asm
neoneye/loda
22
243247
<reponame>neoneye/loda<gh_stars>10-100 ; A005881: Theta series of planar hexagonal lattice (A2) with respect to edge. ; 2,2,0,4,2,0,4,0,0,4,4,0,2,2,0,4,0,0,4,4,0,4,0,0,6,0,0,0,4,0,4,4,0,4,0,0,4,2,0,4,2,0,0,0,0,8,4,0,4,0,0,4,0,0,4,4,0,0,4,0,2,0,0,4,4,0,8,0,0,4,0,0,0,6,0,4,0,0,4,0,0,4,0,0,6,4,0,4,0,0,4,4,0,0,4,0,4,0,0,4 mul $0,2 seq $0,1158 ; sigma_3(n): sum of cubes of divisors of n. mod $0,9 mul $0,2
src/GUI/clock_window.ads
Fabien-Chouteau/coffee-clock
7
16690
<filename>src/GUI/clock_window.ads<gh_stars>1-10 ------------------------------------------------------------------------------- -- -- -- Coffee Clock -- -- -- -- Copyright (C) 2016-2017 <NAME> -- -- -- -- Coffee Clock 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. -- -- -- -- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------- with Giza.Widget.Button; use Giza.Widget; with Giza.Context; with Giza.Window; with Giza.Events; use Giza.Events; with Giza.Types; use Giza.Types; with Settings_Window; with Clock_Widget; with Date_Widget; with HAL.Real_Time_Clock; package Clock_Window is subtype Parent is Giza.Window.Instance; type Instance is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; overriding procedure On_Init (This : in out Instance); overriding procedure On_Displayed (This : in out Instance); overriding procedure On_Hidden (This : in out Instance); overriding procedure Draw (This : in out Instance; Ctx : in out Giza.Context.Class; Force : Boolean := False); overriding function On_Position_Event (This : in out Instance; Evt : Position_Event_Ref; Pos : Point_T) return Boolean; procedure Set_Time (This : in out Instance; Time : HAL.Real_Time_Clock.RTC_Time); procedure Set_Date (This : in out Instance; Date : HAL.Real_Time_Clock.RTC_Date); private type Instance is new Parent with record Settings_Btn : aliased Button.Instance; Settings : aliased Settings_Window.Instance; Clock : aliased Clock_Widget.Instance; Date : aliased Date_Widget.Instance (Show_Day_Of_Week => False); end record; end Clock_Window;
libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80_frexp_callee.asm
jpoikela/z88dk
640
247836
; double __CALLEE__ frexp(double value, int *exp) SECTION code_clib SECTION code_fp_math48 PUBLIC cm48_sccz80_frexp_callee EXTERN cm48_sccz80p_dcallee1, am48_frexp cm48_sccz80_frexp_callee: pop af pop hl ; hl = *exp push af call cm48_sccz80p_dcallee1 ; AC'= value jp am48_frexp
programs/oeis/253/A253210.asm
neoneye/loda
22
167692
; A253210: a(n) = 7^n + 6. ; 7,13,55,349,2407,16813,117655,823549,5764807,40353613,282475255,1977326749,13841287207,96889010413,678223072855,4747561509949,33232930569607,232630513987213,1628413597910455,11398895185373149,79792266297612007,558545864083284013 mov $1,7 pow $1,$0 add $1,6 mov $0,$1
_build/dispatcher/jmp_ippsGFpMethod_p224r1_ab5583aa.asm
zyktrcn/ippcp
1
95642
<gh_stars>1-10 extern m7_ippsGFpMethod_p224r1:function extern n8_ippsGFpMethod_p224r1:function extern y8_ippsGFpMethod_p224r1:function extern e9_ippsGFpMethod_p224r1:function extern l9_ippsGFpMethod_p224r1:function extern n0_ippsGFpMethod_p224r1:function extern k0_ippsGFpMethod_p224r1:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsGFpMethod_p224r1 .Larraddr_ippsGFpMethod_p224r1: dq m7_ippsGFpMethod_p224r1 dq n8_ippsGFpMethod_p224r1 dq y8_ippsGFpMethod_p224r1 dq e9_ippsGFpMethod_p224r1 dq l9_ippsGFpMethod_p224r1 dq n0_ippsGFpMethod_p224r1 dq k0_ippsGFpMethod_p224r1 segment .text global ippsGFpMethod_p224r1:function (ippsGFpMethod_p224r1.LEndippsGFpMethod_p224r1 - ippsGFpMethod_p224r1) .Lin_ippsGFpMethod_p224r1: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsGFpMethod_p224r1: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsGFpMethod_p224r1] mov r11, qword [r11+rax*8] jmp r11 .LEndippsGFpMethod_p224r1:
src/fot/FOTC/Data/Stream/PropertiesATP.agda
asr/fotc
11
17075
<filename>src/fot/FOTC/Data/Stream/PropertiesATP.agda ------------------------------------------------------------------------------ -- Streams properties ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Data.Stream.PropertiesATP where open import FOTC.Base open import FOTC.Base.List open import FOTC.Data.Conat open import FOTC.Data.Conat.Equality.Type open import FOTC.Data.List open import FOTC.Data.Stream ------------------------------------------------------------------------------ -- Because a greatest post-fixed point is a fixed-point, then the -- Stream predicate is also a pre-fixed point of the functional -- StreamF, i.e. -- -- StreamF Stream ≤ Stream (see FOTC.Data.Stream.Type). -- See Issue https://github.com/asr/apia/issues/81 . Stream-inA : D → Set Stream-inA xs = ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Stream xs' {-# ATP definition Stream-inA #-} Stream-in : ∀ {xs} → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Stream xs' → Stream xs Stream-in h = Stream-coind Stream-inA h' h where postulate h' : ∀ {xs} → Stream-inA xs → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Stream-inA xs' {-# ATP prove h' #-} -- See Issue https://github.com/asr/apia/issues/81 . zeros-StreamA : D → Set zeros-StreamA xs = xs ≡ zeros {-# ATP definition zeros-StreamA #-} zeros-Stream : Stream zeros zeros-Stream = Stream-coind zeros-StreamA h refl where postulate h : ∀ {xs} → zeros-StreamA xs → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ zeros-StreamA xs' {-# ATP prove h #-} -- See Issue https://github.com/asr/apia/issues/81 . ones-StreamA : D → Set ones-StreamA xs = xs ≡ ones {-# ATP definition ones-StreamA #-} ones-Stream : Stream ones ones-Stream = Stream-coind ones-StreamA h refl where postulate h : ∀ {xs} → ones-StreamA xs → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ ones-StreamA xs' {-# ATP prove h #-} postulate ∷-Stream : ∀ {x xs} → Stream (x ∷ xs) → Stream xs {-# ATP prove ∷-Stream #-} -- Adapted from (Sander 1992, p. 59). -- See Issue https://github.com/asr/apia/issues/81 . streamLengthR : D → D → Set streamLengthR m n = ∃[ xs ] Stream xs ∧ m ≡ length xs ∧ n ≡ ∞ {-# ATP definition streamLengthR #-} streamLength : ∀ {xs} → Stream xs → length xs ≈ ∞ streamLength {xs} Sxs = ≈-coind streamLengthR h₁ h₂ where postulate h₁ : ∀ {m n} → streamLengthR m n → m ≡ zero ∧ n ≡ zero ∨ (∃[ m' ] ∃[ n' ] m ≡ succ₁ m' ∧ n ≡ succ₁ n' ∧ streamLengthR m' n') {-# ATP prove h₁ #-} postulate h₂ : streamLengthR (length xs) ∞ {-# ATP prove h₂ #-} ------------------------------------------------------------------------------ -- References -- -- Sander, <NAME>. (1992). A Logic of Functional Programs with an -- Application to Concurrency. PhD thesis. Department of Computer -- Sciences: Chalmers University of Technology and University of -- Gothenburg.
alloy4fun_models/trashltl/models/11/95B2JdMEtdyb44wYH.als
Kaixi26/org.alloytools.alloy
0
3339
<reponame>Kaixi26/org.alloytools.alloy open main pred id95B2JdMEtdyb44wYH_prop12 { eventually (some f : File | f in Trash) } pred __repair { id95B2JdMEtdyb44wYH_prop12 } check __repair { id95B2JdMEtdyb44wYH_prop12 <=> prop12o }
experiments/litmus/amd/3/thread.1.asm
phlo/concubine
0
17204
<filename>experiments/litmus/amd/3/thread.1.asm ADDI 1 STORE 1 ADDI 1 STORE 1 LOAD 0
oeis/041/A041057.asm
neoneye/loda-programs
11
80184
<reponame>neoneye/loda-programs ; A041057: Denominators of continued fraction convergents to sqrt(34). ; Submitted by <NAME> ; 1,1,5,6,65,71,349,420,4549,4969,24425,29394,318365,347759,1709401,2057160,22281001,24338161,119633645,143971806,1559351705,1703323511,8372645749,10075969260,109132338349,119208307609,585965568785,705173876394,7637704332725,8342878209119,41009217169201,49352095378320,534530170952401,583882266330721,2870059236275285,3453941502606006,37409474262335345,40863415764941351,200863137322100749,241726553087042100,2618128668192521749,2859855221279563849,14057549553310777145,16917404774590340994 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,3 mod $2,$1 mul $2,9 add $3,$1 add $3,$2 mov $2,$1 lpe dif $2,2 mov $0,$2
.emacs.d/elpa/wisi-2.1.1/sal-gen_bounded_definite_vectors-gen_sorted.adb
caqg/linux-home
0
26389
<reponame>caqg/linux-home -- Abstract : -- -- See spec. -- -- Copyright (C) 2018 - 2019 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- As a special exception under Section 7 of GPL version 3, you are granted -- additional permissions described in the GCC Runtime Library Exception, -- version 3.1, as published by the Free Software Foundation. pragma License (Modified_GPL); package body SAL.Gen_Bounded_Definite_Vectors.Gen_Sorted is overriding procedure Append (Container : in out Vector; New_Item : in Element_Type) is begin raise Programmer_Error; end Append; overriding procedure Prepend (Container : in out Vector; New_Item : in Element_Type) is begin raise Programmer_Error; end Prepend; overriding procedure Insert (Container : in out Vector; New_Item : in Element_Type; Before : in Extended_Index) is begin raise Programmer_Error; end Insert; procedure Insert (Container : in out Vector; New_Item : in Element_Type; Ignore_If_Equal : in Boolean := False) is K : constant Base_Peek_Type := To_Peek_Index (Container.Last); J : Base_Peek_Type := K; begin if K + 1 > Container.Elements'Last then raise Container_Full; elsif K = 0 then -- Container empty Container.Last := Container.Last + 1; Container.Elements (1) := New_Item; return; end if; loop exit when J < 1; case Element_Compare (New_Item, Container.Elements (J)) is when Less => J := J - 1; when Equal => if Ignore_If_Equal then return; else -- Insert after J exit; end if; when Greater => -- Insert after J exit; end case; end loop; if J = 0 then -- Insert before all Container.Elements (2 .. K + 1) := Container.Elements (1 .. K); Container.Elements (1) := New_Item; else -- Insert after J Container.Elements (J + 2 .. K + 1) := Container.Elements (J + 1 .. K); Container.Elements (J + 1) := New_Item; end if; Container.Last := Container.Last + 1; end Insert; end SAL.Gen_Bounded_Definite_Vectors.Gen_Sorted;
src/gl/interface/gl-objects-lists.ads
Roldak/OpenGLAda
79
14894
<filename>src/gl/interface/gl-objects-lists.ads -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" generic type Object_Type (<>) is new GL_Object with private; with function Generate_From_Id (Id : UInt) return Object_Type; package GL.Objects.Lists is pragma Preelaborate; type List (<>) is tagged private; type Cursor is private; No_Element : constant Cursor; function Create (Raw : UInt_Array) return List; function First (Object : List) return Cursor; function Last (Object : List) return Cursor; function Next (Current : Cursor) return Cursor; function Previous (Current : Cursor) return Cursor; function Has_Next (Current : Cursor) return Boolean; function Has_Previous (Current : Cursor) return Boolean; function Element (Current : Cursor) return Object_Type; private type List (Count : Size) is tagged record Contents : UInt_Array (1 .. Count); end record; type List_Access is access constant List; type Cursor is record Object : List_Access; Index : Size; end record; No_Element : constant Cursor := Cursor'(null, 0); end GL.Objects.Lists;
programs/oeis/188/A188045.asm
jmorken/loda
1
173348
<filename>programs/oeis/188/A188045.asm<gh_stars>1-10 ; A188045: Positions of 0 in A188044; complement of A188046. ; 2,4,7,9,12,14,19,21,24,26,31,33,36,38,41,43,48,50,53,55,60,62,65,67,70,72,77,79,82,84,89,91,94,96,101,103,106,108,111,113,118,120,123,125,130,132,135,137,140,142,147,149,152,154,159,161,164,166,171,173,176,178,181,183,188,190,193,195,200,202,205,207,210,212,217,219,222,224,229,231,234,236,239,241,246,248,251,253,258,260,263,265,270,272,275,277,280,282,287,289,292,294,299,301,304,306,309,311,316,318,321,323,328,330,333,335,340,342,345,347,350,352,357,359,362,364,369,371,374,376,379,381,386,388,391,393,398,400,403,405,408,410,415,417,420,422,427,429,432,434,439,441,444,446,449,451,456,458,461,463,468,470,473,475,478,480,485,487,490,492,497,499,502,504,509,511,514,516,519,521,526,528,531,533,538,540,543,545,548,550,555,557,560,562,567,569,572,574,579,581,584,586,589,591,596,598,601,603,608,610,613,615,618,620,625,627,630,632,637,639,642,644,647,649,654,656,659,661,666,668,671,673,678,680,683,685,688,690,695,697,700,702,707,709,712,714,717,719,724,726 mov $31,$0 mov $33,$0 add $33,1 lpb $33 mov $0,$31 sub $33,1 sub $0,$33 mov $27,$0 mov $29,2 lpb $29 clr $0,27 mov $0,$27 sub $29,1 add $0,$29 sub $0,1 sub $2,$0 mov $0,$2 sub $0,2 div $0,2 cal $0,189380 ; a(n) = n + floor(n*s/r) + floor(n*t/r); r=1, s=-1+sqrt(2), t=1+sqrt(2). mov $1,$0 mov $30,$29 lpb $30 mov $28,$1 sub $30,1 lpe lpe lpb $27 mov $27,0 sub $28,$1 lpe mov $1,$28 add $1,2 add $32,$1 lpe mov $1,$32
engine/events/checksave.asm
Dev727/ancientplatinum
28
161550
<filename>engine/events/checksave.asm CheckSave:: ld a, BANK(sCheckValue1) ; aka BANK(sCheckValue2) call GetSRAMBank ld a, [sCheckValue1] ld b, a ld a, [sCheckValue2] ld c, a call CloseSRAM ld a, b cp SAVE_CHECK_VALUE_1 jr nz, .ok ld a, c cp SAVE_CHECK_VALUE_2 jr nz, .ok ld c, $1 ret .ok ld c, $0 ret
Engine/Irq/IrqSmpsRaster.asm
wide-dot/thomson-to8-game-engine
11
97135
<reponame>wide-dot/thomson-to8-game-engine * --------------------------------------------------------------------------- * IrqSmpsRaster/IrqSmps * ------ * IRQ Subroutine to play sound with SN76489/YM2413 and render some Raster lines * * input REG : [dp] with value E7 (from Monitor ROM) * reset REG : none * * IrqOn * reset REG : [a] * * IrqOff * reset REG : [a] * * IrqSync * input REG : [a] screen line (0-199) * [x] timer value * reset REG : [d] * * IrqSync * reset REG : [d] * --------------------------------------------------------------------------- irq_routine equ $6027 irq_timer_ctrl equ $E7C5 irq_timer equ $E7C6 irq_one_frame equ 312*64-1 ; one frame timer (lines*cycles_per_lines-1), timer launch at -1 Irq_Raster_Page fdb $00 Irq_Raster_Start fdb $0000 Irq_Raster_End fdb $0000 IrqOn lda $6019 ora #$20 sta $6019 ; STATUS register andcc #$EF ; tell 6809 to activate irq rts IrqOff lda $6019 anda #$DF sta $6019 ; STATUS register orcc #$10 ; tell 6809 to activate irq rts IrqSync ldb #$42 stb irq_timer_ctrl ldb #8 ; ligne * 64 (cycles par ligne) / 8 (nb cycles boucle tempo) mul tfr d,y leay -32,y ; manual adjustment IrqSync_1 tst $E7E7 ; bmi IrqSync_1 ; while spot is in a visible screen line IrqSync_2 tst $E7E7 ; bpl IrqSync_2 ; while spot is not in a visible screen line IrqSync_3 leay -1,y ; bne IrqSync_3 ; wait until desired line stx irq_timer ; spot is at the end of desired line rts IrqSmps _GetCartPageA sta IrqSmps_end+1 ; backup data page ldd Vint_runcount addd #1 std Vint_runcount sts @a+2 ; backup system stack lds #IRQSysStack ; set tmp system stack for IRQ jsr ReadJoypads jsr MusicFrame @a lds #0 ; (dynamic) restore system stack IrqSmps_end lda #$00 ; (dynamic) _SetCartPageA ; restore data page jmp $E830 ; return to caller ; This space allow the use of system stack inside IRQ calls ; otherwise the writes in sys stack will erase data when S is in use ; (outside of IRQ) for another task than sys stack, ex: stack blast copy fill 0,32 IRQSysStack IrqSmpsRaster _GetCartPageA sta IrqSmpsRaster_end+1 ; backup data page lda Irq_Raster_Page _SetCartPageA ; load Raster data page ldx Irq_Raster_Start lda #32 IrqSmpsRaster_1 bita <$E7 beq IrqSmpsRaster_1 ; while spot is not in a visible screen col IrqSmpsRaster_2 bita <$E7 bne IrqSmpsRaster_2 ; while spot is in a visible screen col mul ; tempo mul ; tempo nop IrqSmpsRaster_render tfr a,b ; tempo tfr a,b ; tempo tfr a,b ; tempo ldd 1,x std >*+8 lda ,x sta <$DB ldd #$0000 stb <$DA sta <$DA leax 3,x cmpx Irq_Raster_End bne IrqSmpsRaster_render ldd Vint_runcount addd #1 std Vint_runcount sts @a+2 ; backup system stack lds #IRQSysStack ; set tmp system stack for IRQ jsr ReadJoypads jsr MusicFrame @a lds #0 ; (dynamic) restore system stack IrqSmpsRaster_end lda #$00 _SetCartPageA ; restore data page jmp $E830 ; return to caller
gyak/gyak1-2/faktor.adb
balintsoos/LearnAda
0
8908
<reponame>balintsoos/LearnAda with Ada.Integer_Text_IO; procedure Faktor is N : Integer; Fakt : Integer := 1; begin Ada.Integer_Text_IO.Get( N ); for I in 1..N loop Fakt := Fakt * I; end loop; Ada.Integer_Text_IO.Put( Fakt ); end Faktor;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1004.asm
ljhsiun2/medusa
9
8039
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x165a7, %rsi lea addresses_UC_ht+0x82fb, %rdi nop nop nop nop add %rdx, %rdx mov $46, %rcx rep movsb nop nop nop nop nop xor %rcx, %rcx lea addresses_UC_ht+0xf2a7, %rsi lea addresses_WC_ht+0x4ce7, %rdi clflush (%rdi) nop and %rax, %rax mov $87, %rcx rep movsl nop nop xor $40072, %rdi lea addresses_UC_ht+0x45a7, %rsi lea addresses_normal_ht+0x114a7, %rdi nop nop nop xor %r14, %r14 mov $69, %rcx rep movsq nop nop nop nop nop dec %rax lea addresses_WC_ht+0x17fed, %rsi lea addresses_UC_ht+0xdca7, %rdi and %rbx, %rbx mov $37, %rcx rep movsw nop nop nop nop add %r14, %r14 lea addresses_WC_ht+0x67a7, %r14 nop nop nop cmp %rdx, %rdx movl $0x61626364, (%r14) nop nop nop nop sub %rdx, %rdx lea addresses_WC_ht+0xaba7, %rax nop nop nop nop nop add $32567, %rdx mov (%rax), %ecx nop dec %r14 lea addresses_D_ht+0xf827, %rsi lea addresses_WT_ht+0x123a7, %rdi nop nop nop nop nop add $60349, %r10 mov $78, %rcx rep movsq nop nop nop xor %r14, %r14 lea addresses_D_ht+0xc863, %rax nop nop nop nop dec %rcx mov $0x6162636465666768, %rdx movq %rdx, %xmm4 vmovups %ymm4, (%rax) nop nop add %r10, %r10 lea addresses_normal_ht+0x1b527, %rcx nop xor %rdi, %rdi movl $0x61626364, (%rcx) nop nop nop sub $36056, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %rbp push %rcx push %rdi push %rsi // Store lea addresses_WT+0x18b7, %r12 nop nop inc %r15 mov $0x5152535455565758, %rcx movq %rcx, (%r12) // Exception!!! nop nop nop nop nop mov (0), %r15 add %r12, %r12 // REPMOV lea addresses_normal+0xb3a7, %rsi lea addresses_RW+0x35a7, %rdi clflush (%rdi) nop and $41972, %r15 mov $62, %rcx rep movsb nop nop nop sub $42005, %r13 // Faulty Load lea addresses_normal+0xb3a7, %rdi xor %r15, %r15 mov (%rdi), %ebp lea oracles, %r15 and $0xff, %rbp shlq $12, %rbp mov (%r15,%rbp,1), %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_RW', 'congruent': 9, 'same': False}, 'OP': 'REPM'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'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 */
programs/oeis/173/A173950.asm
neoneye/loda
22
22773
<gh_stars>10-100 ; A173950: a(n) = 1 if 6 divides (prime(n) + 1), a(n) = -1 if 6 divides (prime(n) - 1), a(n) = 0 otherwise. ; 0,0,1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,-1,1,1,1,-1,-1 seq $0,40 ; The prime numbers. mov $1,1 sub $1,$0 sub $1,$0 gcd $0,2 add $0,2 mod $1,$0 pow $1,$1 mov $0,$1
programs/oeis/063/A063497.asm
karttu/loda
1
246436
<gh_stars>1-10 ; A063497: Number of atoms in first n shells of type I hyperfullerene. ; 0,60,300,840,1800,3300,5460,8400,12240,17100,23100,30360,39000,49140,60900,74400,89760,107100,126540,148200,172200,198660,227700,259440,294000,331500,372060,415800,462840,513300,567300,624960,686400,751740,821100,894600,972360,1054500,1141140,1232400,1328400,1429260,1535100,1646040,1762200,1883700,2010660,2143200,2281440,2425500,2575500,2731560,2893800,3062340,3237300,3418800,3606960,3801900,4003740,4212600,4428600,4651860,4882500,5120640,5366400,5619900,5881260,6150600,6428040,6713700,7007700,7310160,7621200,7940940,8269500,8607000,8953560,9309300,9674340,10048800,10432800,10826460,11229900,11643240,12066600,12500100,12943860,13398000,13862640,14337900,14823900,15320760,15828600,16347540,16877700,17419200,17972160,18536700,19112940,19701000,20301000,20913060,21537300,22173840,22822800,23484300,24158460,24845400,25545240,26258100,26984100,27723360,28476000,29242140,30021900,30815400,31622760,32444100,33279540,34129200,34993200,35871660,36764700,37672440,38595000,39532500,40485060,41452800,42435840,43434300,44448300,45477960,46523400,47584740,48662100,49755600,50865360,51991500,53134140,54293400,55469400,56662260,57872100,59099040,60343200,61604700,62883660,64180200,65494440,66826500,68176500,69544560,70930800,72335340,73758300,75199800,76659960,78138900,79636740,81153600,82689600,84244860,85819500,87413640,89027400,90660900,92314260,93987600,95681040,97394700,99128700,100883160,102658200,104453940,106270500,108108000,109966560,111846300,113747340,115669800,117613800,119579460,121566900,123576240,125607600,127661100,129736860,131835000,133955640,136098900,138264900,140453760,142665600,144900540,147158700,149440200,151745160,154073700,156425940,158802000,161202000,163626060,166074300,168546840,171043800,173565300,176111460,178682400,181278240,183899100,186545100,189216360,191913000,194635140,197382900,200156400,202955760,205781100,208632540,211510200,214414200,217344660,220301700,223285440,226296000,229333500,232398060,235489800,238608840,241755300,244929300,248130960,251360400,254617740,257903100,261216600,264558360,267928500,271327140,274754400,278210400,281695260,285209100,288752040,292324200,295925700,299556660,303217200,306907440,310627500 mul $0,-2 bin $0,3 sub $1,$0 div $1,4 mul $1,60
lib/mmc1_macros.asm
cppchriscpp/do-sheep-dream-of-velcro
9
89717
MMC1_CTRL =$8000 MMC1_CHR0 =$a000 MMC1_CHR1 =$c000 MMC1_PRG =$e000 ; MMC1 needs a reset stub in every bank that will put us into a known state. This defines it for all banks. .macro resetstub_in segname .segment segname .scope resetstub_entry: sei ldx #$FF txs stx MMC1_CTRL ; Writing $80-$FF anywhere in $8000-$FFFF resets MMC1 jmp start .addr nmi, resetstub_entry, $0000 .endscope .endmacro ; Quick-n-dirty macro to write to an mmc1 register, which goes one bit at a time, 5 bits wide. .macro mmc1_register_write addr .repeat 4 sta addr lsr .endrepeat sta addr .endmacro
Appl/Calendar/DayPlan/dayplanPreference.asm
steakknife/pcgeos
504
243824
<reponame>steakknife/pcgeos COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: Calendar/DayPlan FILE: dayplanPreference.asm AUTHOR: <NAME>, May 31, 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/31/90 Initial revision DESCRIPTION: Contains all the routines that initialize, read, and write the preference options. $Id: dayplanPreference.asm,v 1.1 97/04/04 14:47:31 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceLoadOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Loads all of the preference settings CALLED BY: UI (MSG_META_LOAD_OPTIONS) PASS: DS:DI = DayPlanClass specific instance data ES = DGroup RETURN: Nothing DESTROYED: AX, BX, CX, DX, BP, DI PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/31/90 Initial version Don 6/22/90 Added the beginup information SS 3/21/95 To Do list changes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceLoadOptions method DayPlanClass, MSG_META_LOAD_OPTIONS .enter ; Load all the options not stored in UI "gadgets" ; mov bp, offset PrefReadInteger ; callback routine => BP call PreferenceReadWrite ; read from the init file call PreferenceResetTimes ; reset the time strings ; Now setup all of the dialog box gadgetry, and mark myself dirty ; mov ax, MSG_DP_CHANGE_PREFERENCES call ObjCallInstanceNoLock ; send the method to myself mov ax, si ; chunk => SI mov bx, mask OCF_DIRTY ; mark the chunk dirty call ObjSetFlags ; Set the default start-up mode. If it's both, do nothing ; mov di, ds:[si] add di, ds:[di].DayPlan_offset ; DayPlanInstance => DS:DI mov cl, ds:[di].DPI_startup ; startup choices => CL if _TODO ; if To Do list, we startup call LoadOptions ; with Calendar/Events else cmp cl, mask VI_BOTH je done ; Switch to the correct view (calendar or events) ; mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION mov bp, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE clr dx mov ch, dh GetResourceHandleNS MenuBlock, bx mov si, offset MenuBlock:ViewViewList call SelectAndSendApply ; Turn off the View->Both ; mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE mov bp, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_MODIFIED_STATE clr cx, dx mov si, offset MenuBlock:ViewBothList call SelectAndSendApply done: endif .leave ret PreferenceLoadOptions endp if _TODO else SelectAndSendApply proc near clr di call ObjMessage_pref_low mov_tr ax, bp ; modified message => AX mov cx, mask VI_BOTH ; set this one modified clr di call ObjMessage_pref_low ; set the modified bit mov ax, MSG_GEN_APPLY clr di GOTO ObjMessage_pref_low SelectAndSendApply endp endif if _TODO COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LoadOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks which load options are requested and brings the Geoplanner up with the correct view. CALLED BY: PreferenceLoadOption PASS: cl = viewInfo (VT_CALENDAR shl offset VI_TYPE, VT_CALENDAR_AND_TODO_LIST shl offset VI_TYPE,...) RETURN: nothing DESTROYED: ax,bx,cx,dx,si,di SIDE EFFECTS: PSEUDO CODE/STRATEGY: if we're loading the Calendar/Events view--do nothing otherwise set the selection for the View menu "press" that button with MSG_..._SET_MODIFIED_STATE MSG_GEN_APPLY REVISION HISTORY: Name Date Description ---- ---- ----------- SS 3/21/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LoadOptions proc near .enter cmp cl, VT_CALENDAR_AND_EVENTS shl offset VI_TYPE ; cal/events ? je done ; do nothing mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr dx mov ch, dh GetResourceHandleNS MenuBlock, bx mov si, offset MenuBlock:ViewViewList clr di call ObjMessage mov ax, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE mov cx, 1 clr di call ObjMessage mov ax, MSG_GEN_APPLY clr di call ObjMessage done: .leave ret LoadOptions endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceSaveOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Saves all of the preference settings CALLED BY: UI (MSG_META_SAVE_OPTONS) PASS: DS:DI = DayPlanClass specific instance data ES = DGroup RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, SI, DS PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/31/90 Initial version Don 6/22/90 Added the startup information %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceSaveOptions method DayPlanClass, MSG_META_SAVE_OPTIONS .enter ; Write out all of the options not stored in gadgets ; mov bp, offset PrefWriteInteger ; callback routine => BP call PreferenceReadWrite ; write to the init file ; Finally, commit all of the changes ; call InitFileCommit ; update the file to disk .leave ret PreferenceSaveOptions endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceResetOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset the Preference options to the default value as if the application had just been started (default values from .UI files + any .INI file changes) CALLED BY: GLOBAL (MSG_META_RESET_OPTIONS) PASS: *DS:SI = DayPlanClass object DS:DI = DayPlanClassInstance RETURN: Nothing DESTROYED: AX, CX, DX, BP PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 2/15/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceResetOptions method dynamic DayPlanClass, MSG_META_RESET_OPTIONS .enter ; ; Restore the default Preference settings ; mov {word} ds:[di].DPI_beginMinute, DEFAULT_START_TIME mov {word} ds:[di].DPI_endMinute, DEFAULT_END_TIME mov ds:[di].DPI_interval, DEFAULT_INTERVAL mov ds:[di].DPI_prefFlags, DEFAULT_PREF_FLAGS or \ PF_GLOBAL or PF_SINGLE mov ds:[di].DPI_startup, DEFAULT_VIEW_INFO mov {word} es:[precedeMinute], 0 clr es:[precedeDay] ; ; Reset the UI in the Prefences dialog box to match these defaults ; mov bp, offset PrefReadInteger call PreferenceReadWrite ; read from the init file mov ax, MSG_PREF_RESET_OPTIONS call ObjCallInstanceNoLock ; ; Ask the UI to reload any default (network or ROM) .INI values ; push si mov ax, MSG_META_LOAD_OPTIONS mov si, offset PrefBlock:PreferencesBox call ObjMessage_pref_call pop si ; ; Finally, queue a message for the DayPlan object, telling it ; to re-display the EventView relative to our option changes. ; We queue the event so that all of the notifications of any ; .INI default value changes will have been received by the time ; the DayPlan object updates its display. ; mov ax, MSG_DP_CHANGE_PREFERENCES mov bx, ds:[LMBH_handle] mov di, mask MF_FORCE_QUEUE call ObjMessage_pref_low .leave ret PreferenceResetOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferencePrefResetOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset all of the options in the preferences dialog box CALLED BY: UI (MSG_PREF_RESET_OPTIONS) PASS: DS:*SI = DayPlanClass instance data DS:DI = DayPlanClass specific instance data ES = DGroup RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, BP PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 8/12/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferencePrefResetOptions method DayPlanClass, MSG_PREF_RESET_OPTIONS .enter ; Reset all of the various UI gadgets ; push si ; save DayPlan chunk handle mov cl, ds:[di].DPI_prefFlags and cl, PF_TEMPLATE or PF_HEADERS mov si, offset PrefBlock:DisplayChoicesList call PrefSetBooleanGroup mov cl, ds:[di].DPI_interval clr ch mov si, offset PrefBlock:DayInterval call PrefSetRange mov cl, es:[precedeMinute] clr ch mov si, offset PrefBlock:PrecedeMinutes call PrefSetRange mov cl, es:[precedeHour] clr ch mov si, offset PrefBlock:PrecedeHours call PrefSetRange mov cx, es:[precedeDay] mov si, offset PrefBlock:PrecedeDays call PrefSetRange mov cl, ds:[di].DPI_startup mov si, offset PrefBlock:ViewModeChoices call PrefSetItemGroup mov cl, ds:[di].DPI_prefFlags and cl, PF_ALWAYS_TODAY or PF_DATE_CHANGE mov si, offset PrefBlock:DateChangeChoices call PrefSetBooleanGroup ; Now reset all of the time strings ; pop si ; restore DayPlan chunk handle call PreferenceResetTimes ; Finally, disable the OK button ; mov ax, MSG_GEN_MAKE_NOT_APPLYABLE GetResourceHandleNS PrefBlock, bx mov si, offset PrefBlock:EndDayTime call ObjMessage_pref_send .leave ret PreferencePrefResetOptions endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceResetTimes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SNOPSIS: Re-create the start & end time strings, based on internaal data CALLED BY: INTERNAL PASS: DS:*SI = DayPlanClass instance data ES = DGroup RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, BP PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/31/90 Initial version Don 12/26/90 Made into a method handler Don 1/19/99 Made back into a near procedure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceResetTimes proc near uses si .enter mov di, ds:[si] ; dereference the handle add di, ds:[di].DayPlan_offset ; access my instance data push {word} ds:[di].DPI_endMinute mov cx, {word} ds:[di].DPI_beginMinute ; begin time => CX mov si, offset PrefBlock:StartDayTime call PrefTimeToTextObject ; time string => text object pop cx ; end time => CX mov si, offset PrefBlock:EndDayTime call PrefTimeToTextObject ; time string => text object .leave ret PreferenceResetTimes endp PrefTimeToTextObject proc near GetResourceHandleNS PrefBlock, di ; PrefBlock handle => DI call TimeToTextObject ret PrefTimeToTextObject endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceVerifyOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check some things before the dialog box goes of screen CALLED BY: UI (MSG_PREF_VERIFY_OPTIONS) PASS: DS:DI = DayPlanClass specific instance data DS:*SI = DayPlanClass instance data ES = DGroup RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, SI PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/31/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceVerifyOptions method DayPlanClass, MSG_PREF_VERIFY_OPTIONS ; Mark the chunk as dirty. Pass method to superclass ; mov ax, si ; chunk => SI mov bx, mask OCF_DIRTY ; mark the chunk dirty call ObjSetFlags ; mark the chunk as dirty mov bx, si ; Preference handle => BX ; Now get the time fields ; mov si, offset PrefBlock:StartDayTime call PrefStringToTime ; time => CX jc quit ; if carry set, invalid time cmp {word} ds:[di].DPI_beginMinute, cx je endTime ; jump if time hasn't changed mov {word} ds:[di].DPI_beginMinute, cx or ds:[di].DPI_prefFlags, PF_SINGLE ; affects one day display endTime: mov si, offset PrefBlock:EndDayTime call PrefStringToTime ; time => CX jc quit ; if carry set, invalid time cmp {word} ds:[di].DPI_endMinute, cx je checkTimes ; if time hasn't changed, done mov {word} ds:[di].DPI_endMinute, cx or ds:[di].DPI_prefFlags, PF_SINGLE ; affects one day display ; Start time must be before end time checkTimes: cmp cx, {word} ds:[di].DPI_beginMinute jge done ; if begin <= end, OK call GeodeGetProcessHandle ; process handle => BX mov ax, MSG_CALENDAR_DISPLAY_ERROR mov bp, CAL_ERROR_START_GTR_END ; error to display clr di GOTO ObjMessage ; send the method ; Bring down the DB, & call myself to notify the other objects done: push bx ; save the DayPlan handle mov ax, MSG_GEN_APPLY mov si, offset PrefBlock:PreferencesBox call ObjMessage_pref_call mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_DISMISS call ObjMessage_pref_call pop si ; DayPlan handle => SI call PreferenceResetTimes ; re-stuff the time values mov bx, ds:[LMBH_handle] ; block handle => BX mov ax, MSG_DP_CHANGE_PREFERENCES mov di, mask MF_FORCE_QUEUE ; send method via the queue call ObjMessage ; send method back to myself ; Also need to tell the application that I have options to be saved ; GetResourceHandleNS Calendar, bx mov si, offset Calendar mov ax, MSG_GEN_APPLICATION_OPTIONS_CHANGED clr di call ObjMessage_pref_low quit: ret PreferenceVerifyOptions endp PrefStringToTime proc near GetResourceHandleNS PrefBlock, di ; OD => DI:SI mov cl, 1 ; must have a valid time call StringToTime ; time => CX jc done mov di, ds:[bx] ; dereference the Pref handle add di, ds:[di].DayPlan_offset ; access my instance data done: ret PrefStringToTime endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceReadWrite %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Read or write the values from/to the .INI file that cannot be handled by normal UI gadgetry. CALLED BY: INTERNAL PASS: ES = DGroup DS:DI = DayPlanInstance BP = Callback routine for reading or writing: - PrefReadInteger - PrefWriteInteger RETURN: Nothing DESTROYED: AX, BX, CX, DX PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ auiCategoryStr char 'calendar', 0 cuiCategoryStr char 'calendar0', 0 beginHourKey char 'beginHour', 0 beginMinuteKey char 'beginMinute', 0 endHourKey char 'endHour', 0 endMinuteKey char 'endMinute', 0 prefReadWrite PrefReadWriteStruct \ <beginHourKey, 0, 23, DPI_beginHour>, <beginMinuteKey, 0, 59, DPI_beginMinute>, <endHourKey, 0, 23, DPI_endHour>, <endMinuteKey, 0, 59, DPI_endMinute> NUM_READ_WRITE_ENTRIES equ 4 PreferenceReadWrite proc near uses es, ds, di, si .enter ; First, some set-up work ; segmov es, ds, cx ; instance data => ES:DI segmov ds, cs, cx ; category => DS:SI mov si, offset cuiCategoryStr ; CUI category => DS:SI call UserGetDefaultUILevel cmp ax, UIIL_INTRODUCTORY je goForIt mov si, offset auiCategoryStr ; AUI category => DS:SI goForIt: mov cx, NUM_READ_WRITE_ENTRIES mov bx, offset prefReadWrite ; Now loop through all of the entries readWriteLoop: push cx mov cx, cs mov dx, cs:[bx].PRWS_key ; key string => CX:DX call bp ; do reading or writing pop cx add bx, (size PrefReadWriteStruct) loop readWriteLoop .leave ret PreferenceReadWrite endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefReadInteger %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Read an integer from the .INI file confirming its validity CALLED BY: PreferenceReadWrite PASS: ES:DI = DayPlanInstance DS:SI = Category string CX:DX = Key string CS:BX = PreferenceReadWriteStruct RETURN: Nothing DESTROYED: AX PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefReadInteger proc near uses bp .enter ; Read the integer value, and then check its bounds ; call InitFileReadInteger jc done cmp ax, cs:[bx].PRWS_lower jl done cmp ax, cs:[bx].PRWS_upper jg done mov bp, cs:[bx].PRWS_offset mov es:[di][bp], al ; store the value away done: .leave ret PrefReadInteger endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefWriteInteger %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write an integer to the .INI file CALLED BY: PreferenceReadWrite PASS: ES:DI = DayPlanInstance DS:SI = Category string CX:DX = Key string CS:BX = PreferenceReadWriteStruct RETURN: Nothing DESTROYED: AX PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefWriteInteger proc near uses bp .enter ; Get the value, and write it out ; mov bp, cs:[bx].PRWS_offset mov al, es:[di][bp] clr ah mov_tr bp, ax call InitFileWriteInteger .leave ret PrefWriteInteger endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Handlers for options changes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceSetPrecede[Minute, Hour, Day] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Respond to user setting of the precede values CALLED BY: UI (MSG_PREF_SET_PRECEDE_[MINUTE, HOUR, DAY]) PASS: ES = DGroup DS:*SI = Preference instance data DS:DI = Preference specific instance data DX/DL = Value RETURN: Nothing DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 1/1/90 Initial version Don 5/31/90 Moved to the preference module %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceSetPrecedeMinute method DayPlanClass, MSG_PREF_SET_PRECEDE_MINUTE mov es:[precedeMinute], dl ret PreferenceSetPrecedeMinute endm PreferenceSetPrecedeHour method DayPlanClass, MSG_PREF_SET_PRECEDE_HOUR mov es:[precedeHour], dl ret PreferenceSetPrecedeHour endm PreferenceSetPrecedeDay method DayPlanClass, MSG_PREF_SET_PRECEDE_DAY mov es:[precedeDay], dx ret PreferenceSetPrecedeDay endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceSetInterval %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the interval between template events, and forces a reload if necessary. CALLED BY: UI (MSG_PREF_SET_INTERVAL) PASS: DS:DI = DayPlanClass specific instance data DL = Interval (in mimutes) RETURN: Nothing DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 4/20/90 Initial version Don 5/31/90 Moved to preferece module %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceSetInterval method DayPlanClass, MSG_PREF_SET_INTERVAL mov ds:[di].DPI_interval, dl ; store the new interval or ds:[di].DPI_prefFlags, PF_SINGLE ret PreferenceSetInterval endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceSetStartupChoices %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the startup mode for the Calendar CALLED BY: UI (MSG_PREF_SET_STARTUP_CHOICES) PASS: DS:DI = DayPlanClass specific instance data ES = DGroup CX = 0 (Calendar Only) = 1 (Events Only) = 2 (Both) RETURN: Nothing DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 6/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceSetStartupChoices method DayPlanClass, MSG_PREF_SET_STARTUP_CHOICES mov ds:[di].DPI_startup, cl ; store the startup value ret PreferenceSetStartupChoices endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceUpdateEventChoices %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update UI state based upon the event choice CALLED BY: GLOBAL (MSG_PREF_UPDATE_EVENT_CHOICES) PASS: *DS:SI = DayPlanClass object DS:DI = DayPlanClassInstance CL = PreferenceFlags set RETURN: Nothing DESTROYED: AX, CX, DX, BP PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 2/ 9/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceUpdateEventChoices method dynamic DayPlanClass, MSG_PREF_UPDATE_EVENT_CHOICES .enter ; Now disable/enable the interval amount ; mov ax, MSG_GEN_SET_NOT_ENABLED test cl, PF_TEMPLATE jz sendMessage mov ax, MSG_GEN_SET_ENABLED sendMessage: mov si, offset DayInterval ; DS:*SI is the OD mov dl, VUM_NOW ; update now call ObjMessage_pref_send ; send the message .leave ret PreferenceUpdateEventChoices endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceSetEventChoices %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Store the event choices away CALLED BY: GLOBAL (MSG_PREF_SET_EVENT_CHOICES) PASS: *DS:SI = DayPlanClass object DS:DI = DayPlanClassInstance CL = PreferenceFlags set BP = PreferenceFlags that changed RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, SI, BP PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceSetEventChoices method dynamic DayPlanClass, MSG_PREF_SET_EVENT_CHOICES .enter ; Set the correct state of the HEADER flag ; test bp, PF_TEMPLATE ; if this changed, then it jz 10$ or cl, PF_SINGLE ; ...affects one-day selection 10$: test bp, PF_HEADERS ; if this changed, then it jz 20$ or cl, PF_RANGE ; ...affect range selection 20$: mov ch, not (PF_HEADERS or PF_TEMPLATE) ; flags to clear call PrefUpdateBooleans ; do the real work .leave ret PreferenceSetEventChoices endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceSetDateChoices %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Store the date choices away CALLED BY: GLOBAL (MSG_PREF_SET_DATE_CHOICES) PASS: *DS:SI = DayPlanClass object DS:DI = DayPlanClassInstance CL = PreferenceFlags RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, SI, BP PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 5/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreferenceSetDateChoices method dynamic DayPlanClass, MSG_PREF_SET_DATE_CHOICES .enter ; Store the flags away, and then tell the DayPlan about it ; or cl, PF_GLOBAL ; we have a "global" change mov ch, not (PF_ALWAYS_TODAY or PF_DATE_CHANGE) call PrefUpdateBooleans ; do the real work .leave ret PreferenceSetDateChoices endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreferenceUpdateBooleans %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set or clear the boolean, depending on the state in BP CALLED BY: INTERNAL PASS: DS:DI = DayPlanClassInstance CL = Flag to set CH = Flag to clear first RETURN: Nothing DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Don 10/10/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefUpdateBooleans proc near class DayPlanClass .enter ; Clear or set the passed flag ; and ds:[di].DPI_prefFlags, ch or ds:[di].DPI_prefFlags, cl .leave ret PrefUpdateBooleans endp PrefSetBooleanGroup proc near mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE clr dx GOTO ObjMessage_pref_send PrefSetBooleanGroup endp PrefSetItemGroup proc near mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr dx GOTO ObjMessage_pref_send PrefSetItemGroup endp PrefSetRange proc near mov ax, MSG_GEN_VALUE_SET_INTEGER_VALUE clr bp FALL_THRU ObjMessage_pref_send PrefSetRange endp ObjMessage_pref_send proc near push di clr di call ObjMessage_pref pop di ret ObjMessage_pref_send endp ObjMessage_pref_call proc near mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_FIXUP_ES FALL_THRU ObjMessage_pref ObjMessage_pref_call endp ObjMessage_pref proc near GetResourceHandleNS PrefBlock, bx FALL_THRU ObjMessage_pref_low ObjMessage_pref endp ObjMessage_pref_low proc near call ObjMessage ret ObjMessage_pref_low endp PrefCode ends
arch/ARM/Nordic/svd/nrf51/nrf51_svd-lpcomp.ads
bosepchuk/Ada_Drivers_Library
6
25275
<filename>arch/ARM/Nordic/svd/nrf51/nrf51_svd-lpcomp.ads<gh_stars>1-10 -- Copyright (c) 2013, Nordic Semiconductor ASA -- 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 Nordic Semiconductor ASA 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. -- -- This spec has been automatically generated from nrf51.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF51_SVD.LPCOMP is pragma Preelaborate; --------------- -- Registers -- --------------- -- Shortcut between READY event and SAMPLE task. type SHORTS_READY_SAMPLE_Field is ( -- Shortcut disabled. Disabled, -- Shortcut enabled. Enabled) with Size => 1; for SHORTS_READY_SAMPLE_Field use (Disabled => 0, Enabled => 1); -- Shortcut between RADY event and STOP task. type SHORTS_READY_STOP_Field is ( -- Shortcut disabled. Disabled, -- Shortcut enabled. Enabled) with Size => 1; for SHORTS_READY_STOP_Field use (Disabled => 0, Enabled => 1); -- Shortcut between DOWN event and STOP task. type SHORTS_DOWN_STOP_Field is ( -- Shortcut disabled. Disabled, -- Shortcut enabled. Enabled) with Size => 1; for SHORTS_DOWN_STOP_Field use (Disabled => 0, Enabled => 1); -- Shortcut between UP event and STOP task. type SHORTS_UP_STOP_Field is ( -- Shortcut disabled. Disabled, -- Shortcut enabled. Enabled) with Size => 1; for SHORTS_UP_STOP_Field use (Disabled => 0, Enabled => 1); -- Shortcut between CROSS event and STOP task. type SHORTS_CROSS_STOP_Field is ( -- Shortcut disabled. Disabled, -- Shortcut enabled. Enabled) with Size => 1; for SHORTS_CROSS_STOP_Field use (Disabled => 0, Enabled => 1); -- Shortcuts for the LPCOMP. type SHORTS_Register is record -- Shortcut between READY event and SAMPLE task. READY_SAMPLE : SHORTS_READY_SAMPLE_Field := NRF51_SVD.LPCOMP.Disabled; -- Shortcut between RADY event and STOP task. READY_STOP : SHORTS_READY_STOP_Field := NRF51_SVD.LPCOMP.Disabled; -- Shortcut between DOWN event and STOP task. DOWN_STOP : SHORTS_DOWN_STOP_Field := NRF51_SVD.LPCOMP.Disabled; -- Shortcut between UP event and STOP task. UP_STOP : SHORTS_UP_STOP_Field := NRF51_SVD.LPCOMP.Disabled; -- Shortcut between CROSS event and STOP task. CROSS_STOP : SHORTS_CROSS_STOP_Field := NRF51_SVD.LPCOMP.Disabled; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SHORTS_Register use record READY_SAMPLE at 0 range 0 .. 0; READY_STOP at 0 range 1 .. 1; DOWN_STOP at 0 range 2 .. 2; UP_STOP at 0 range 3 .. 3; CROSS_STOP at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; -- Enable interrupt on READY event. type INTENSET_READY_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_READY_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on READY event. type INTENSET_READY_Field_1 is ( -- Reset value for the field Intenset_Ready_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_READY_Field_1 use (Intenset_Ready_Field_Reset => 0, Set => 1); -- Enable interrupt on DOWN event. type INTENSET_DOWN_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_DOWN_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on DOWN event. type INTENSET_DOWN_Field_1 is ( -- Reset value for the field Intenset_Down_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_DOWN_Field_1 use (Intenset_Down_Field_Reset => 0, Set => 1); -- Enable interrupt on UP event. type INTENSET_UP_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_UP_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on UP event. type INTENSET_UP_Field_1 is ( -- Reset value for the field Intenset_Up_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_UP_Field_1 use (Intenset_Up_Field_Reset => 0, Set => 1); -- Enable interrupt on CROSS event. type INTENSET_CROSS_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_CROSS_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on CROSS event. type INTENSET_CROSS_Field_1 is ( -- Reset value for the field Intenset_Cross_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_CROSS_Field_1 use (Intenset_Cross_Field_Reset => 0, Set => 1); -- Interrupt enable set register. type INTENSET_Register is record -- Enable interrupt on READY event. READY : INTENSET_READY_Field_1 := Intenset_Ready_Field_Reset; -- Enable interrupt on DOWN event. DOWN : INTENSET_DOWN_Field_1 := Intenset_Down_Field_Reset; -- Enable interrupt on UP event. UP : INTENSET_UP_Field_1 := Intenset_Up_Field_Reset; -- Enable interrupt on CROSS event. CROSS : INTENSET_CROSS_Field_1 := Intenset_Cross_Field_Reset; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTENSET_Register use record READY at 0 range 0 .. 0; DOWN at 0 range 1 .. 1; UP at 0 range 2 .. 2; CROSS at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- Disable interrupt on READY event. type INTENCLR_READY_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_READY_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on READY event. type INTENCLR_READY_Field_1 is ( -- Reset value for the field Intenclr_Ready_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_READY_Field_1 use (Intenclr_Ready_Field_Reset => 0, Clear => 1); -- Disable interrupt on DOWN event. type INTENCLR_DOWN_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_DOWN_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on DOWN event. type INTENCLR_DOWN_Field_1 is ( -- Reset value for the field Intenclr_Down_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_DOWN_Field_1 use (Intenclr_Down_Field_Reset => 0, Clear => 1); -- Disable interrupt on UP event. type INTENCLR_UP_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_UP_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on UP event. type INTENCLR_UP_Field_1 is ( -- Reset value for the field Intenclr_Up_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_UP_Field_1 use (Intenclr_Up_Field_Reset => 0, Clear => 1); -- Disable interrupt on CROSS event. type INTENCLR_CROSS_Field is ( -- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_CROSS_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on CROSS event. type INTENCLR_CROSS_Field_1 is ( -- Reset value for the field Intenclr_Cross_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_CROSS_Field_1 use (Intenclr_Cross_Field_Reset => 0, Clear => 1); -- Interrupt enable clear register. type INTENCLR_Register is record -- Disable interrupt on READY event. READY : INTENCLR_READY_Field_1 := Intenclr_Ready_Field_Reset; -- Disable interrupt on DOWN event. DOWN : INTENCLR_DOWN_Field_1 := Intenclr_Down_Field_Reset; -- Disable interrupt on UP event. UP : INTENCLR_UP_Field_1 := Intenclr_Up_Field_Reset; -- Disable interrupt on CROSS event. CROSS : INTENCLR_CROSS_Field_1 := Intenclr_Cross_Field_Reset; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTENCLR_Register use record READY at 0 range 0 .. 0; DOWN at 0 range 1 .. 1; UP at 0 range 2 .. 2; CROSS at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- Result of last compare. Decision point SAMPLE task. type RESULT_RESULT_Field is ( -- Input voltage is bellow the reference threshold. Bellow, -- Input voltage is above the reference threshold. Above) with Size => 1; for RESULT_RESULT_Field use (Bellow => 0, Above => 1); -- Result of last compare. type RESULT_Register is record -- Read-only. Result of last compare. Decision point SAMPLE task. RESULT : RESULT_RESULT_Field; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RESULT_Register use record RESULT at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Enable or disable LPCOMP. type ENABLE_ENABLE_Field is ( -- Disabled LPCOMP. Disabled, -- Enable LPCOMP. Enabled) with Size => 2; for ENABLE_ENABLE_Field use (Disabled => 0, Enabled => 1); -- Enable the LPCOMP. type ENABLE_Register is record -- Enable or disable LPCOMP. ENABLE : ENABLE_ENABLE_Field := NRF51_SVD.LPCOMP.Disabled; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ENABLE_Register use record ENABLE at 0 range 0 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- Analog input pin select. type PSEL_PSEL_Field is ( -- Use analog input 0 as analog input. Analoginput0, -- Use analog input 1 as analog input. Analoginput1, -- Use analog input 2 as analog input. Analoginput2, -- Use analog input 3 as analog input. Analoginput3, -- Use analog input 4 as analog input. Analoginput4, -- Use analog input 5 as analog input. Analoginput5, -- Use analog input 6 as analog input. Analoginput6, -- Use analog input 7 as analog input. Analoginput7) with Size => 3; for PSEL_PSEL_Field use (Analoginput0 => 0, Analoginput1 => 1, Analoginput2 => 2, Analoginput3 => 3, Analoginput4 => 4, Analoginput5 => 5, Analoginput6 => 6, Analoginput7 => 7); -- Input pin select. type PSEL_Register is record -- Analog input pin select. PSEL : PSEL_PSEL_Field := NRF51_SVD.LPCOMP.Analoginput0; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PSEL_Register use record PSEL at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Reference select. type REFSEL_REFSEL_Field is ( -- Use supply with a 1/8 prescaler as reference. Supplyoneeighthprescaling, -- Use supply with a 2/8 prescaler as reference. Supplytwoeighthsprescaling, -- Use supply with a 3/8 prescaler as reference. Supplythreeeighthsprescaling, -- Use supply with a 4/8 prescaler as reference. Supplyfoureighthsprescaling, -- Use supply with a 5/8 prescaler as reference. Supplyfiveeighthsprescaling, -- Use supply with a 6/8 prescaler as reference. Supplysixeighthsprescaling, -- Use supply with a 7/8 prescaler as reference. Supplyseveneighthsprescaling, -- Use external analog reference as reference. Aref) with Size => 3; for REFSEL_REFSEL_Field use (Supplyoneeighthprescaling => 0, Supplytwoeighthsprescaling => 1, Supplythreeeighthsprescaling => 2, Supplyfoureighthsprescaling => 3, Supplyfiveeighthsprescaling => 4, Supplysixeighthsprescaling => 5, Supplyseveneighthsprescaling => 6, Aref => 7); -- Reference select. type REFSEL_Register is record -- Reference select. REFSEL : REFSEL_REFSEL_Field := NRF51_SVD.LPCOMP.Supplyoneeighthprescaling; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for REFSEL_Register use record REFSEL at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- External analog reference pin selection. type EXTREFSEL_EXTREFSEL_Field is ( -- Use analog reference 0 as reference. Analogreference0, -- Use analog reference 1 as reference. Analogreference1) with Size => 1; for EXTREFSEL_EXTREFSEL_Field use (Analogreference0 => 0, Analogreference1 => 1); -- External reference select. type EXTREFSEL_Register is record -- External analog reference pin selection. EXTREFSEL : EXTREFSEL_EXTREFSEL_Field := NRF51_SVD.LPCOMP.Analogreference0; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EXTREFSEL_Register use record EXTREFSEL at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Analog detect configuration. type ANADETECT_ANADETECT_Field is ( -- Generate ANADETEC on crossing, both upwards and downwards crossing. Cross, -- Generate ANADETEC on upwards crossing only. Up, -- Generate ANADETEC on downwards crossing only. Down) with Size => 2; for ANADETECT_ANADETECT_Field use (Cross => 0, Up => 1, Down => 2); -- Analog detect configuration. type ANADETECT_Register is record -- Analog detect configuration. ANADETECT : ANADETECT_ANADETECT_Field := NRF51_SVD.LPCOMP.Cross; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ANADETECT_Register use record ANADETECT at 0 range 0 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- Peripheral power control. type POWER_POWER_Field is ( -- Module power disabled. Disabled, -- Module power enabled. Enabled) with Size => 1; for POWER_POWER_Field use (Disabled => 0, Enabled => 1); -- Peripheral power control. type POWER_Register is record -- Peripheral power control. POWER : POWER_POWER_Field := NRF51_SVD.LPCOMP.Disabled; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for POWER_Register use record POWER at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Low power comparator. type LPCOMP_Peripheral is record -- Start the comparator. TASKS_START : aliased HAL.UInt32; -- Stop the comparator. TASKS_STOP : aliased HAL.UInt32; -- Sample comparator value. TASKS_SAMPLE : aliased HAL.UInt32; -- LPCOMP is ready and output is valid. EVENTS_READY : aliased HAL.UInt32; -- Input voltage crossed the threshold going down. EVENTS_DOWN : aliased HAL.UInt32; -- Input voltage crossed the threshold going up. EVENTS_UP : aliased HAL.UInt32; -- Input voltage crossed the threshold in any direction. EVENTS_CROSS : aliased HAL.UInt32; -- Shortcuts for the LPCOMP. SHORTS : aliased SHORTS_Register; -- Interrupt enable set register. INTENSET : aliased INTENSET_Register; -- Interrupt enable clear register. INTENCLR : aliased INTENCLR_Register; -- Result of last compare. RESULT : aliased RESULT_Register; -- Enable the LPCOMP. ENABLE : aliased ENABLE_Register; -- Input pin select. PSEL : aliased PSEL_Register; -- Reference select. REFSEL : aliased REFSEL_Register; -- External reference select. EXTREFSEL : aliased EXTREFSEL_Register; -- Analog detect configuration. ANADETECT : aliased ANADETECT_Register; -- Peripheral power control. POWER : aliased POWER_Register; end record with Volatile; for LPCOMP_Peripheral use record TASKS_START at 16#0# range 0 .. 31; TASKS_STOP at 16#4# range 0 .. 31; TASKS_SAMPLE at 16#8# range 0 .. 31; EVENTS_READY at 16#100# range 0 .. 31; EVENTS_DOWN at 16#104# range 0 .. 31; EVENTS_UP at 16#108# range 0 .. 31; EVENTS_CROSS at 16#10C# range 0 .. 31; SHORTS at 16#200# range 0 .. 31; INTENSET at 16#304# range 0 .. 31; INTENCLR at 16#308# range 0 .. 31; RESULT at 16#400# range 0 .. 31; ENABLE at 16#500# range 0 .. 31; PSEL at 16#504# range 0 .. 31; REFSEL at 16#508# range 0 .. 31; EXTREFSEL at 16#50C# range 0 .. 31; ANADETECT at 16#520# range 0 .. 31; POWER at 16#FFC# range 0 .. 31; end record; -- Low power comparator. LPCOMP_Periph : aliased LPCOMP_Peripheral with Import, Address => System'To_Address (16#40013000#); end NRF51_SVD.LPCOMP;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_3044_531.asm
ljhsiun2/medusa
9
168621
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x2d05, %rdx nop nop nop nop cmp %rcx, %rcx mov (%rdx), %rbx nop nop and $34092, %r15 lea addresses_WC_ht+0x11bf1, %rsi lea addresses_UC_ht+0x15c05, %rdi nop dec %r15 mov $30, %rcx rep movsb nop xor %rsi, %rsi lea addresses_WT_ht+0x3f85, %rsi nop nop inc %rax movw $0x6162, (%rsi) nop nop nop nop nop inc %rdx lea addresses_D_ht+0x151b, %rsi lea addresses_UC_ht+0x1ac05, %rdi nop nop nop inc %r14 mov $53, %rcx rep movsq nop nop xor %rdi, %rdi lea addresses_WT_ht+0xcf45, %rdx and %rsi, %rsi and $0xffffffffffffffc0, %rdx movaps (%rdx), %xmm6 vpextrq $1, %xmm6, %r14 nop sub $22303, %rax lea addresses_A_ht+0x6a85, %rdx nop nop nop nop add %rsi, %rsi mov $0x6162636465666768, %rax movq %rax, (%rdx) nop nop nop nop nop add $4432, %rdi lea addresses_UC_ht+0x55e5, %r15 nop cmp $11622, %rdx vmovups (%r15), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rax nop nop nop nop nop add $28165, %rax lea addresses_WT_ht+0x1c885, %rdx nop add $59129, %rdi mov $0x6162636465666768, %rcx movq %rcx, %xmm4 vmovups %ymm4, (%rdx) nop and %rax, %rax lea addresses_D_ht+0x7685, %rcx nop nop nop nop nop add %r15, %r15 mov (%rcx), %edi nop nop cmp %rbx, %rbx lea addresses_normal_ht+0x19bc5, %r14 nop nop nop nop nop dec %rdx mov (%r14), %r15w nop xor $13859, %rax lea addresses_WC_ht+0xc885, %rax nop nop nop nop nop sub $45934, %r15 vmovups (%rax), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rdi nop add $55132, %rcx lea addresses_UC_ht+0x1dafd, %rsi lea addresses_UC_ht+0x6585, %rdi nop nop nop and %rax, %rax mov $125, %rcx rep movsw nop nop nop nop inc %rdi lea addresses_A_ht+0xf4a7, %rsi lea addresses_normal_ht+0x17c85, %rdi nop nop nop nop nop xor %r15, %r15 mov $34, %rcx rep movsl nop nop nop nop and $8655, %r15 lea addresses_WC_ht+0x13485, %rsi lea addresses_WT_ht+0xc305, %rdi clflush (%rsi) nop nop nop nop nop sub %r14, %r14 mov $3, %rcx rep movsb nop nop nop inc %rbx lea addresses_normal_ht+0x13ab5, %rcx nop nop nop nop nop xor %rdi, %rdi movb (%rcx), %bl nop nop add $33508, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r8 push %rbx push %rdi push %rsi // Store mov $0xad, %rdi nop nop nop sub $51379, %r8 mov $0x5152535455565758, %r12 movq %r12, %xmm5 movntdq %xmm5, (%rdi) cmp $42138, %r8 // Faulty Load lea addresses_normal+0x1bc85, %r8 xor $17307, %rdi movb (%r8), %r12b lea oracles, %rsi and $0xff, %r12 shlq $12, %r12 mov (%rsi,%r12,1), %r12 pop %rsi pop %rdi pop %rbx pop %r8 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 1}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 7, 'type': 'addresses_UC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3}} {'34': 3044} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
test/interaction/Issue3829-2.agda
cruhland/agda
1,989
16114
<gh_stars>1000+ open import Agda.Builtin.Nat -- split on m -- WAS: m = zero or m = suc m -- WANT: m = suc m because 2nd clause already covers m = zero f : Nat -> Nat -> Nat f m zero = {!!} f zero zero = zero f _ _ = zero -- However for g, we still get m = zero or m = suc m -- because the other splits are orthogonal / catchalls g : Nat -> Nat -> Nat g m zero = {!!} g zero n = zero g _ _ = zero
Cubical/Categories/Instances/Functors.agda
mzeuner/cubical
0
4400
{-# OPTIONS --safe #-} module Cubical.Categories.Instances.Functors where open import Cubical.Categories.Category open import Cubical.Categories.Functor.Base open import Cubical.Categories.NaturalTransformation.Base open import Cubical.Categories.NaturalTransformation.Properties open import Cubical.Categories.Morphism renaming (isIso to isIsoC) open import Cubical.Foundations.Prelude private variable ℓC ℓC' ℓD ℓD' : Level module _ (C : Category ℓC ℓC') (D : Category ℓD ℓD') where open Category open NatTrans open Functor FUNCTOR : Category (ℓ-max (ℓ-max ℓC ℓC') (ℓ-max ℓD ℓD')) (ℓ-max (ℓ-max ℓC ℓC') ℓD') ob FUNCTOR = Functor C D Hom[_,_] FUNCTOR = NatTrans id FUNCTOR {F} = idTrans F _⋆_ FUNCTOR = seqTrans ⋆IdL FUNCTOR α = makeNatTransPath λ i x → D .⋆IdL (α .N-ob x) i ⋆IdR FUNCTOR α = makeNatTransPath λ i x → D .⋆IdR (α .N-ob x) i ⋆Assoc FUNCTOR α β γ = makeNatTransPath λ i x → D .⋆Assoc (α .N-ob x) (β .N-ob x) (γ .N-ob x) i isSetHom FUNCTOR = isSetNat open isIsoC renaming (inv to invC) -- componentwise iso is an iso in Functor FUNCTORIso : ∀ {F G : Functor C D} (α : F ⇒ G) → (∀ (c : C .ob) → isIsoC D (α ⟦ c ⟧)) → isIsoC FUNCTOR α FUNCTORIso α is .invC .N-ob c = (is c) .invC FUNCTORIso {F} {G} α is .invC .N-hom {c} {d} f = invMoveL areInv-αc ( α ⟦ c ⟧ ⋆⟨ D ⟩ (G ⟪ f ⟫ ⋆⟨ D ⟩ is d .invC) ≡⟨ sym (D .⋆Assoc _ _ _) ⟩ (α ⟦ c ⟧ ⋆⟨ D ⟩ G ⟪ f ⟫) ⋆⟨ D ⟩ is d .invC ≡⟨ sym (invMoveR areInv-αd (α .N-hom f)) ⟩ F ⟪ f ⟫ ∎ ) where areInv-αc : areInv _ (α ⟦ c ⟧) ((is c) .invC) areInv-αc = isIso→areInv (is c) areInv-αd : areInv _ (α ⟦ d ⟧) ((is d) .invC) areInv-αd = isIso→areInv (is d) FUNCTORIso α is .sec = makeNatTransPath (funExt (λ c → (is c) .sec)) FUNCTORIso α is .ret = makeNatTransPath (funExt (λ c → (is c) .ret))
macsudo.scpt
dorukgezici/bash-scripts
1
1874
#!/usr/bin/osascript on run argv set |command| to "" repeat with parameter in argv set |command| to |command| & " " & parameter end repeat do shell script |command| with administrator privileges end run
extern/game_support/stm32f4/src/drawing.ads
AdaCore/training_material
15
22786
with Screen_interface; use Screen_Interface; package Drawing is procedure Line (Start, Stop : Point; Col : Color; Thickness : Natural := 1); procedure Rect (Start, Stop : Point; Col : Color; Thickness : Natural := 1); procedure Rect_Fill (Start, Stop : Point; Col : Color); procedure Cubic_Bezier (P1, P2, P3, P4 : Point; Col : Color; N : Positive := 20; Thickness : Natural := 1); procedure Circle (Center : Point; Radius : Natural; Col : Color; Fill : Boolean := False); end Drawing;
Task/Function-prototype/Ada/function-prototype-2.ada
LaudateCorpus1/RosettaCodeData
1
25639
<filename>Task/Function-prototype/Ada/function-prototype-2.ada type Box; -- tell Ada a box exists (undefined yet) type accBox is access Box; -- define a pointer to a box type Box is record -- later define what a box is next : accBox; -- including that a box holds access to other boxes end record;
test/succeed/Issue1184.agda
larrytheliquid/agda
1
903
<reponame>larrytheliquid/agda<filename>test/succeed/Issue1184.agda postulate T : Set → Set X : Set Class : Set → Set member : ∀ {A} {{C : Class A}} → A → A iX : Class X iT : ∀ {A} {{CA : Class A}} → Class (T A) -- Should get type Class (T X), -- not {{_ : Class X}} → Class (T X) iTX = iT {A = X} -- Fails if not expanding instance argument in iTX f : T X → T X f = member
src/arch/socs/stm32f439/soc-dma.ads
vdh-anssi/ewok-kernel
65
25223
<gh_stars>10-100 -- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- 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 soc.layout; with soc.interrupts; with system; package soc.dma with spark_mode => on is type t_dma_periph_index is (ID_DMA1, ID_DMA2); for t_dma_periph_index use (ID_DMA1 => 1, ID_DMA2 => 2); type t_stream_index is range 0 .. 7; type t_channel_index is range 0 .. 7 with size => 3; ------------------------------------------ -- DMA interrupt status registers (ISR) -- ------------------------------------------ type t_dma_stream_int_status is record -- Stream FIFO error interrupt flag (FEIF) FIFO_ERROR : boolean; -- Stream direct mode error interrupt flag (DMEIF) DIRECT_MODE_ERROR : boolean; -- Stream transfer error interrupt flag (TEIF) TRANSFER_ERROR : boolean; -- Stream half transfer interrupt flag (HTIF) HALF_COMPLETE : boolean; -- Stream transfer complete interrupt flag (TCIF) TRANSFER_COMPLETE : boolean; end record with size => 6; for t_dma_stream_int_status use record FIFO_ERROR at 0 range 0 .. 0; DIRECT_MODE_ERROR at 0 range 2 .. 2; TRANSFER_ERROR at 0 range 3 .. 3; HALF_COMPLETE at 0 range 4 .. 4; TRANSFER_COMPLETE at 0 range 5 .. 5; end record; -- -- DMA low interrupt status register (DMA_LISR) -- type t_DMA_LISR is record stream_0 : t_dma_stream_int_status; stream_1 : t_dma_stream_int_status; reserved_12_15 : bits_4; stream_2 : t_dma_stream_int_status; stream_3 : t_dma_stream_int_status; reserved_28_31 : bits_4; end record with pack, size => 32, volatile_full_access; -- -- DMA high interrupt status register (DMA_HISR) -- type t_DMA_HISR is record stream_4 : t_dma_stream_int_status; stream_5 : t_dma_stream_int_status; reserved_12_15 : bits_4; stream_6 : t_dma_stream_int_status; stream_7 : t_dma_stream_int_status; reserved_28_31 : bits_4; end record with pack, size => 32, volatile_full_access; ---------------------------------------- -- DMA interrupt flag clear registers -- ---------------------------------------- type t_dma_stream_clear_interrupts is record -- Stream clear FIFO error interrupt flag (CFEIF) CLEAR_FIFO_ERROR : boolean; -- Stream clear direct mode error interrupt flag (CDMEIF) CLEAR_DIRECT_MODE_ERROR : boolean; -- Stream clear transfer error interrupt flag (CTEIF) CLEAR_TRANSFER_ERROR : boolean; -- Stream clear half transfer interrupt flag (CHTIF) CLEAR_HALF_TRANSFER : boolean; -- Stream clear transfer complete interrupt flag (CTCIF) CLEAR_TRANSFER_COMPLETE : boolean; end record with size => 6; for t_dma_stream_clear_interrupts use record CLEAR_FIFO_ERROR at 0 range 0 .. 0; CLEAR_DIRECT_MODE_ERROR at 0 range 2 .. 2; CLEAR_TRANSFER_ERROR at 0 range 3 .. 3; CLEAR_HALF_TRANSFER at 0 range 4 .. 4; CLEAR_TRANSFER_COMPLETE at 0 range 5 .. 5; end record; -- -- DMA low interrupt flag clear register (DMA_LIFCR) -- type t_DMA_LIFCR is record stream_0 : t_dma_stream_clear_interrupts; stream_1 : t_dma_stream_clear_interrupts; reserved_12_15 : bits_4; stream_2 : t_dma_stream_clear_interrupts; stream_3 : t_dma_stream_clear_interrupts; reserved_28_31 : bits_4; end record with pack, size => 32, volatile_full_access; -- -- DMA high interrupt flag clear register (DMA_HIFCR) -- type t_DMA_HIFCR is record stream_4 : t_dma_stream_clear_interrupts; stream_5 : t_dma_stream_clear_interrupts; reserved_12_15 : bits_4; stream_6 : t_dma_stream_clear_interrupts; stream_7 : t_dma_stream_clear_interrupts; reserved_28_31 : bits_4; end record with pack, size => 32, volatile_full_access; ---------------------------------------------------- -- DMA stream x configuration register (DMA_SxCR) -- ---------------------------------------------------- type t_flow_controller is (DMA_FLOW_CONTROLLER, PERIPH_FLOW_CONTROLLER) with size => 1; for t_flow_controller use (DMA_FLOW_CONTROLLER => 0, PERIPH_FLOW_CONTROLLER => 1); type t_transfer_dir is (PERIPHERAL_TO_MEMORY, MEMORY_TO_PERIPHERAL, MEMORY_TO_MEMORY) with size => 2; for t_transfer_dir use (PERIPHERAL_TO_MEMORY => 2#00#, MEMORY_TO_PERIPHERAL => 2#01#, MEMORY_TO_MEMORY => 2#10#); type t_data_size is (TRANSFER_BYTE, TRANSFER_HALF_WORD, TRANSFER_WORD) with size => 2; for t_data_size use (TRANSFER_BYTE => 2#00#, TRANSFER_HALF_WORD => 2#01#, TRANSFER_WORD => 2#10#); type t_increment_offset_size is (INCREMENT_PSIZE, INCREMENT_WORD) with size => 1; for t_increment_offset_size use (INCREMENT_PSIZE => 0, INCREMENT_WORD => 1); type t_priority_level is (LOW, MEDIUM, HIGH, VERY_HIGH) with size => 2; for t_priority_level use (LOW => 2#00#, MEDIUM => 2#01#, HIGH => 2#10#, VERY_HIGH => 2#11#); type t_current_target is (MEMORY_0, MEMORY_1) with size => 1; for t_current_target use (MEMORY_0 => 0, MEMORY_1 => 1); type t_burst_size is (SINGLE_TRANSFER, INCR_4_BEATS, INCR_8_BEATS, INCR_16_BEATS) with size => 2; for t_burst_size use (SINGLE_TRANSFER => 2#00#, INCR_4_BEATS => 2#01#, INCR_8_BEATS => 2#10#, INCR_16_BEATS => 2#11#); type t_DMA_SxCR is record EN : boolean := false; -- Stream enable DIRECT_MODE_ERROR : boolean := false; -- DMEIE TRANSFER_ERROR : boolean := false; -- TEIE HALF_COMPLETE : boolean := false; -- HTIE TRANSFER_COMPLETE : boolean := false; -- TCIE PFCTRL : t_flow_controller := DMA_FLOW_CONTROLLER; DIR : t_transfer_dir := PERIPHERAL_TO_MEMORY; CIRC : boolean := false; -- Circular mode enable PINC : boolean := false; -- Peripheral incr. mode enable MINC : boolean := false; -- Memory incr. mode enable PSIZE : t_data_size := TRANSFER_BYTE; -- Peripheral data size MSIZE : t_data_size := TRANSFER_BYTE; -- Memory data size PINCOS : t_increment_offset_size := INCREMENT_PSIZE; PL : t_priority_level := LOW; DBM : boolean := false; -- Double buffer mode CT : t_current_target := MEMORY_0; reserved_20 : bit := 0; PBURST : t_burst_size := SINGLE_TRANSFER; -- Periph. burst transfer MBURST : t_burst_size := SINGLE_TRANSFER; -- Memory burst transfer CHSEL : t_channel_index := 0; -- Channel selection (0..7) reserved_28_31 : bits_4 := 0; end record with size => 32, volatile_full_access; for t_DMA_SxCR use record EN at 0 range 0 .. 0; DIRECT_MODE_ERROR at 0 range 1 .. 1; TRANSFER_ERROR at 0 range 2 .. 2; HALF_COMPLETE at 0 range 3 .. 3; TRANSFER_COMPLETE at 0 range 4 .. 4; PFCTRL at 0 range 5 .. 5; DIR at 0 range 6 .. 7; CIRC at 0 range 8 .. 8; PINC at 0 range 9 .. 9; MINC at 0 range 10 .. 10; PSIZE at 0 range 11 .. 12; MSIZE at 0 range 13 .. 14; PINCOS at 0 range 15 .. 15; PL at 0 range 16 .. 17; DBM at 0 range 18 .. 18; CT at 0 range 19 .. 19; reserved_20 at 0 range 20 .. 20; PBURST at 0 range 21 .. 22; MBURST at 0 range 23 .. 24; CHSEL at 0 range 25 .. 27; reserved_28_31 at 0 range 28 .. 31; end record; ------------------------------------------------------- -- DMA stream x number of data register (DMA_SxNDTR) -- ------------------------------------------------------- type t_DMA_SxNDTR is record NDT : short; -- Number of data items to be transferred (0 up to 65535) reserved_16_31 : short; end record with pack, size => 32, volatile_full_access; ---------------------------------------------------------- -- DMA stream x peripheral address register (DMA_SxPAR) -- ---------------------------------------------------------- subtype t_DMA_SxPAR is system_address; --------------------------------------------------------- -- DMA stream x memory 0 address register (DMA_SxM0AR) -- --------------------------------------------------------- subtype t_DMA_SxM0AR is system_address; --------------------------------------------------------- -- DMA stream x memory 1 address register (DMA_SxM1AR) -- --------------------------------------------------------- subtype t_DMA_SxM1AR is system_address; ---------------------------------------------------- -- DMA stream x FIFO control register (DMA_SxFCR) -- ---------------------------------------------------- type t_FIFO_threshold is (FIFO_1DIV4_FULL, FIFO_1DIV2_FULL, FIFO_3DIV4_FULL, FIFO_FULL) with size => 2; for t_FIFO_threshold use (FIFO_1DIV4_FULL => 2#00#, FIFO_1DIV2_FULL => 2#01#, FIFO_3DIV4_FULL => 2#10#, FIFO_FULL => 2#11#); type t_FIFO_status is (FIFO_LESS_1DIV4, FIFO_LESS_1DIV2, FIFO_LESS_3DIV4, FIFO_LESS_FULL, FIFO_IS_EMPTY, FIFO_IS_FULL) with size => 3; for t_FIFO_status use (FIFO_LESS_1DIV4 => 2#000#, FIFO_LESS_1DIV2 => 2#001#, FIFO_LESS_3DIV4 => 2#010#, FIFO_LESS_FULL => 2#011#, FIFO_IS_EMPTY => 2#100#, FIFO_IS_FULL => 2#101#); type t_DMA_SxFCR is record FTH : t_FIFO_threshold := FIFO_1DIV2_FULL; -- FIFO threshold DMDIS : boolean := false; -- Direct mode disable FS : t_FIFO_status := FIFO_IS_EMPTY; -- FIFO status reserved_6 : bit := 0; FIFO_ERROR : boolean := false; -- FIFO error intr. enable (FEIE) reserved_8_15 : byte := 0; reserved_16_31 : short := 0; end record with pack, size => 32, volatile_full_access; -------------------- -- DMA peripheral -- -------------------- type t_stream_registers is record CR : t_DMA_SxCR; -- Control register NDTR : t_DMA_SxNDTR; -- Number of data register PAR : t_DMA_SxPAR; -- Peripheral address register M0AR : t_DMA_SxM0AR; -- memory 0 address register M1AR : t_DMA_SxM1AR; -- memory 1 address register FCR : t_DMA_SxFCR; -- FIFO control register end record with volatile; for t_stream_registers use record CR at 16#00# range 0 .. 31; NDTR at 16#04# range 0 .. 31; PAR at 16#08# range 0 .. 31; M0AR at 16#0C# range 0 .. 31; M1AR at 16#10# range 0 .. 31; FCR at 16#14# range 0 .. 31; end record; type t_streams_registers is array (t_stream_index) of t_stream_registers with pack; type t_dma_periph is record LISR : t_DMA_LISR; -- Interrupt status register (0 .. 3) HISR : t_DMA_HISR; -- Interrupt status register (4 .. 7) LIFCR : t_DMA_LIFCR; -- Interrupt clear register (0 .. 3) HIFCR : t_DMA_HIFCR; -- Interrupt clear register (4 .. 7) streams : t_streams_registers; end record with volatile; for t_dma_periph use record LISR at 16#00# range 0 .. 31; HISR at 16#04# range 0 .. 31; LIFCR at 16#08# range 0 .. 31; HIFCR at 16#0C# range 0 .. 31; streams at 16#10# range 0 .. (32 * 6 * 8) - 1; end record; DMA1 : aliased t_dma_periph with import, volatile, address => system'to_address (soc.layout.DMA1_BASE); DMA2 : aliased t_dma_periph with import, volatile, address => system'to_address (soc.layout.DMA2_BASE); --------------- -- Utilities -- --------------- procedure enable_clocks; procedure enable (controller : in out t_dma_periph; stream : in t_stream_index) with inline_always; procedure disable (controller : in out t_dma_periph; stream : in t_stream_index); procedure get_dma_stream_from_interrupt (intr : in soc.interrupts.t_interrupt; dma_id : out t_dma_periph_index; stream : out t_stream_index; success : out boolean); function soc_is_dma_irq (intr : soc.interrupts.t_interrupt) return boolean; function get_interrupt_status (controller : t_dma_periph; stream : t_stream_index) return t_dma_stream_int_status with volatile_function; procedure set_IFCR (controller : in out t_dma_periph; stream : in t_stream_index; IFCR : in t_dma_stream_clear_interrupts); procedure clear_all_interrupts (controller : in out t_dma_periph; stream : in t_stream_index); procedure reset_stream (controller : in out t_dma_periph; stream : in t_stream_index); procedure reset_streams; end soc.dma;
src/sha-process_data.adb
mgrojo/AdaID
16
19235
<filename>src/sha-process_data.adb<gh_stars>10-100 -- (C) Copyright 1999 by <NAME>,All rights reserved. -- Basic Transformation functions of NSA's Secure Hash Algorithm -- This is part of a project at http://www.cc.utah.edu/~nahaj/ package body SHA.Process_Data is Default_Context : Context; -- Standard context for people that don't need -- -- to hash more than one stream at a time; --------------------------------------------------------------------------- -- Totally local functions. -- Raw transformation of the data. procedure Transform (Given : in out Context); -- This is the basic work horse of the standard. Everything else here -- is just frame around this. -- Align data and place in buffer. (Arbitrary chunks.) procedure Graft_On (Given : in out Context; Raw : Unsigned_32; Size : Bit_Index; Increment_Count : Boolean := True); --------------------------------------------------------------------------- -- On with the show ----------------------------------------- -- Quick and easy routine for the most common simple case. function Digest_A_String (Given : String) return Digest is Temp : Context; -- Let's make this totally independent of anything -- -- else the user may be doing. Result : Digest; begin Initialize (Temp); for I in Given'First .. Given'Last loop Add (Byte (Character'Pos (Given (I))), Temp); end loop; Finalize (Result, Temp); return Result; end Digest_A_String; -- Start out the buffer with a good starting state. -- Note that there are assumptions ALL over the code that the -- buffer starts out with zeros. procedure Initialize is begin if Default_Context.Initialized then raise SHA_Second_Initialize; end if; Default_Context := Initial_Value; Default_Context.Initialized := True; end Initialize; procedure Initialize (Given : in out Context) is begin if Given.Initialized then raise SHA_Second_Initialize; end if; Given := Initial_Value; Given.Initialized := True; end Initialize; -- Procedures to add to the data being hashed. procedure Add (Data : Bit) is begin if not Default_Context.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Default_Context, Unsigned_32 (Data), 1); end Add; procedure Add (Data : Bit; Given : in out Context) is begin if not Given.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Given, Unsigned_32 (Data), 1); end Add; procedure Add (Data : Byte) is begin if not Default_Context.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Default_Context, Unsigned_32 (Data), 8); end Add; procedure Add (Data : Byte; Given : in out Context) is begin if not Given.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Given, Unsigned_32 (Data), 8); end Add; procedure Add (Data : Word) is begin if not Default_Context.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Default_Context, Unsigned_32 (Data), 16); end Add; procedure Add (Data : Word; Given : in out Context) is begin if not Given.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Given, Unsigned_32 (Data), 16); end Add; procedure Add (Data : Long) is begin if not Default_Context.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Default_Context, Unsigned_32 (Data), 32); end Add; procedure Add (Data : Long; Given : in out Context) is begin if not Given.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Given, Unsigned_32 (Data), 32); end Add; procedure Add (Data : Long; Size : Bit_Index) is begin if not Default_Context.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Default_Context, Unsigned_32 (Data), Size); end Add; procedure Add (Data : Long; Size : Bit_Index; Given : in out Context) is begin if not Given.Initialized then raise SHA_Not_Initialized; end if; Graft_On (Given, Unsigned_32 (Data), Size); end Add; -- Get the final digest. function Finalize return Digest is Result : Digest; begin Finalize (Result, Default_Context); return Result; end Finalize; procedure Finalize (Result : out Digest) is begin Finalize (Result, Default_Context); end Finalize; procedure Finalize (Result : out Digest; Given : in out Context) is begin if not Given.Initialized then raise SHA_Not_Initialized; end if; -- The standard requires the Data be padded with a single 1 bit. Graft_On (Given, 1, 1, False); -- We may have to make room for the count to be put on the last block. if Given.Next_Word >= Given.Data'Last - 1 then -- Room for the count? if not (Given.Next_Word = Given.Data'Last - 1 and then Given.Remaining_Bits = 32) then Transform (Given); end if; end if; -- Ok, now we can just add the count on. Given.Data (Given.Data'Last - 1) := Given.Count_High; Given.Data (Given.Data'Last) := Given.Count_Low; -- And now we just transform that. Transform (Given); -- Ok, we are done. Given.Initialized := False; -- One aught not to reused this without -- appropriate re-initialization. Result := Given.Current; end Finalize; --------------------------------------------------------------------------- -- Actually put the bits we have into the buffer properly aligned. procedure Graft_On (Given : in out Context; Raw : Unsigned_32; Size : Bit_Index; Increment_Count : Boolean := True) is Offset : Integer range -31 .. 32; -- How far to move to align this? Overflow : Bit_Index := 0; -- How much is into the next word? Remainder : Unsigned_32 := 0; -- What data has to be done in cleanup? Value : Unsigned_32 := Raw; -- What value are we Really working with? begin pragma Inline (Graft_On); -- Huh? if Size = 0 then return; end if; -- How do we have to align the data to fit? Offset := Integer (Given.Remaining_Bits) -- Amount used - Integer (Size); -- Minus amount we have. if Offset > 0 then Value := Shift_Left (Value, Offset); elsif Offset < 0 then Remainder := Shift_Left (Value, 32 + Offset); -- -- Really "- -Offset" Value := Shift_Right (Value, -Offset); Overflow := Bit_Index (-Offset); end if; -- Insert the actual value into the table. Given.Data (Given.Next_Word) := Given.Data (Given.Next_Word) or Value; -- Update where we are in the table. if Offset > 0 then -- Not on a word boundry Given.Remaining_Bits := Given.Remaining_Bits - Size; elsif Given.Next_Word < Data_Buffer'Last then Given.Next_Word := Given.Next_Word + 1; Given.Remaining_Bits := 32; else Transform (Given); -- Also clears everything out of the buffer. end if; -- Handle anything that overflows into the next word. if Overflow /= 0 then Given.Data (Given.Next_Word) := Given.Data (Given.Next_Word) or Remainder; Given.Remaining_Bits := 32 - Overflow; end if; if Increment_Count then Given.Count_Low := Given.Count_Low + Unsigned_32 (Size); if Given.Count_Low < Unsigned_32 (Size) then Given.Count_High := Given.Count_High + 1; if Given.Count_High = 0 then raise SHA_Overflow; end if; -- The standard is only defined up to a total size of what -- you are hashing of 2**64 bits. end if; end if; end Graft_On; --------------------------------------------------------------------------- -- The actual SHA transformation of a block of data. -- Yes, it is cryptic... But it is a pretty much direct transliteration -- of the standard, variable names and all. procedure Transform (Given : in out Context) is Temp : Unsigned_32; -- Buffer to work in. type Work_Buffer is array (0 .. 79) of Unsigned_32; W : Work_Buffer; -- How much is filled from the data, how much is filled by expansion. Fill_Start : constant := Work_Buffer'First + Data_Buffer'Length; Data_End : constant := Fill_Start - 1; A : Unsigned_32 := Given.Current (0); B : Unsigned_32 := Given.Current (1); C : Unsigned_32 := Given.Current (2); D : Unsigned_32 := Given.Current (3); E : Unsigned_32 := Given.Current (4); begin for I in Work_Buffer'First .. Data_End loop W (I) := Given.Data (Word_Range (I)); end loop; for I in Fill_Start .. Work_Buffer'Last loop W (I) := Rotate_Left ( W (I - 3) xor W (I - 8) xor W (I - 14) xor W (I - 16), 1 ); end loop; for I in Work_Buffer'Range loop Temp := W (I) + Rotate_Left (A, 5) + E; case I is when 0 .. 19 => Temp := Temp + 16#5A827999# + ((B and C) or ((not B) and D)); when 20 .. 39 => Temp := Temp + 16#6ED9EBA1# + (B xor C xor D); when 40 .. 59 => Temp := Temp + 16#8F1BBCDC# + ((B and C) or (B and D) or (C and D)); when 60 .. 79 => Temp := Temp + 16#CA62C1D6# + (B xor C xor D); end case; E := D; D := C; C := Rotate_Right (B, 2); -- The standard really says rotate left 30. B := A; A := Temp; end loop; Given.Current := (Given.Current (0) + A, Given.Current (1) + B, Given.Current (2) + C, Given.Current (3) + D, Given.Current (4) + E ); Given.Remaining_Bits := 32; Given.Next_Word := 0; Given.Data := (others => 0); -- *THIS MUST BE DONE* end Transform; end SHA.Process_Data;
libsrc/_DEVELOPMENT/sound/bit/z80/asm_bit_beepfx/_bfx_31.asm
jpoikela/z88dk
640
240187
; BeepFX sound effect by shiru ; http://shiru.untergrund.net SECTION rodata_clib SECTION rodata_sound_bit PUBLIC _bfx_31 _bfx_31: ; Item_4 defb 1 ;tone defw 4,1000,1000,65136,128 defb 0
src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=pbuz2_derefidx_vbuyy.asm
jbrandwood/kickc
2
175406
lda ({z2}),y sta ({z1}),y
src/NTypes/Product.agda
vituscze/HoTT-lectures
0
2038
{-# OPTIONS --without-K #-} module NTypes.Product where open import NTypes open import PathOperations open import PathStructure.Product open import Types ×-isSet : ∀ {a b} {A : Set a} {B : Set b} → isSet A → isSet B → isSet (A × B) ×-isSet A-set B-set x y p q = split-eq p ⁻¹ · ap (λ y → ap₂ _,_ y (ap π₂ p)) (A-set _ _ (ap π₁ p) (ap π₁ q)) · ap (λ y → ap₂ _,_ (ap π₁ q) y) (B-set _ _ (ap π₂ p) (ap π₂ q)) · split-eq q where split-eq : (p : x ≡ y) → ap₂ _,_ (ap π₁ p) (ap π₂ p) ≡ p split-eq = π₂ (π₂ (π₂ split-merge-eq))
src/Data/PropFormula/Theorems/Implication.agda
jonaprieto/agda-prop
13
4777
<reponame>jonaprieto/agda-prop ------------------------------------------------------------------------------ -- Agda-Prop Library. -- Theorems of ⊃ connective. ------------------------------------------------------------------------------ open import Data.Nat using ( ℕ ) module Data.PropFormula.Theorems.Implication ( n : ℕ ) where ------------------------------------------------------------------------------ open import Data.PropFormula.Syntax n open import Data.PropFormula.Theorems.Classical n open import Function using ( _$_; _∘_; flip ) ------------------------------------------------------------------------------ -- Theorem. ⊃-equiv : ∀ {Γ} {φ ψ} → Γ ⊢ φ ⊃ ψ → Γ ⊢ ¬ φ ∨ ψ ⊃-to-¬∨ = ⊃-equiv -- Proof. ⊃-equiv {φ = φ}{ψ} Γ⊢φ⊃ψ = (⊃-elim (⊃-intro (∨-elim (∨-intro₂ (¬ φ) (⊃-elim (weaken φ Γ⊢φ⊃ψ) (assume φ))) (∨-intro₁ ψ (assume (¬ φ))))) PEM) -------------------------------------------------------------------------- ∎ -- Theorems from the book: -- <NAME> 4th Edition. Chapter 2. Section 2.4. -- Theorem. vanDalen244a : ∀ {Γ} {φ ψ} → Γ ⊢ φ ⊃ (ψ ⊃ φ) -- Proof. vanDalen244a {φ = φ}{ψ} = (⊃-intro (⊃-intro (weaken ψ (assume φ)))) -------------------------------------------------------------------------- ∎ -- Theorem. vanDalen244b : ∀ {Γ} {φ ψ} → Γ ⊢ φ ⊃ (¬ φ ⊃ ψ) -- Proof. vanDalen244b {Γ}{φ}{ψ} = ⊃-intro $ ⊃-intro $ ⊥-elim {Γ = (Γ , φ , ¬ φ)} ψ $ ¬-elim (assume {Γ = Γ , φ} (¬ φ)) (weaken (¬ φ) (assume φ)) -------------------------------------------------------------------------- ∎ -- Theorem. vanDalen244c : ∀ {Γ} {φ ψ γ} → Γ ⊢ (φ ⊃ ψ) ⊃ ((ψ ⊃ γ) ⊃ (φ ⊃ γ)) -- Proof. vanDalen244c {Γ}{φ}{ψ}{γ} = ⊃-intro $ ⊃-intro $ ⊃-intro $ ⊃-elim (weaken φ $ assume {Γ = Γ , φ ⊃ ψ} $ ψ ⊃ γ) (⊃-elim (weaken φ $ weaken (ψ ⊃ γ) $ assume $ φ ⊃ ψ) (assume {Γ = Γ , φ ⊃ ψ , ψ ⊃ γ} φ)) -------------------------------------------------------------------------- ∎ -- Theorem. vanDalen244d : ∀ {Γ} {φ ψ} → Γ ⊢ ¬ ψ ⊃ ¬ φ → Γ ⊢ φ ⊃ ψ ¬⊃¬-to-⊃ = vanDalen244d contraposition₁ = vanDalen244d -- Proof. vanDalen244d {Γ}{φ}{ψ} Γ⊢¬ψ⊃¬φ = (⊃-elim (⊃-intro $ (⊃-intro $ RAA $ ¬-elim (⊃-elim (weaken (¬ ψ) $ weaken φ $ assume $ ¬ ψ ⊃ ¬ φ) (assume {Γ = Γ , ¬ ψ ⊃ ¬ φ , φ} $ ¬ ψ)) (weaken (¬ ψ) $ assume {Γ = Γ , ¬ ψ ⊃ ¬ φ} φ))) Γ⊢¬ψ⊃¬φ) -------------------------------------------------------------------------- ∎ -- Theorem. contraposition₂ : ∀ {Γ} {φ ψ} → Γ ⊢ φ ⊃ ψ → Γ ⊢ ¬ ψ ⊃ ¬ φ ⊃-to-¬⊃¬ = contraposition₂ -- Proof. contraposition₂ {Γ}{φ}{ψ} Γ⊢φ⊃ψ = ⊃-intro (¬-intro (¬-elim (weaken φ (assume (¬ ψ))) (⊃-elim (weaken φ (weaken (¬ ψ) Γ⊢φ⊃ψ)) (assume {Γ = Γ , ¬ ψ} φ)))) -------------------------------------------------------------------------- ∎ -- Theorem. vanDalen244e : ∀ {Γ} {φ} → Γ ⊢ ¬ (¬ φ) ⊃ φ -- Proof. vanDalen244e {Γ}{φ} = ⊃-intro $ RAA (¬-elim (weaken (¬ φ) $ assume $ ¬ (¬ φ)) (assume {Γ = Γ , ¬ (¬ φ)} $ ¬ φ)) -------------------------------------------------------------------------- ∎ -- Theorem. ⊃⊃-to-∧⊃ : ∀ {Γ} {φ ψ γ} → Γ ⊢ φ ⊃ (ψ ⊃ γ) → Γ ⊢ (φ ∧ ψ) ⊃ γ -- Proof. ⊃⊃-to-∧⊃ {Γ}{φ}{ψ} Γ⊢φ⊃ψ⊃γ = ⊃-intro (⊃-elim (⊃-elim (weaken (φ ∧ ψ) Γ⊢φ⊃ψ⊃γ) (∧-proj₁ (assume (φ ∧ ψ)))) (∧-proj₂ (assume (φ ∧ ψ)))) -------------------------------------------------------------------------- ∎ -- Theorem. ∧⊃-to-⊃⊃ : ∀ {Γ} {φ ψ γ} → Γ ⊢ (φ ∧ ψ) ⊃ γ → Γ ⊢ φ ⊃ (ψ ⊃ γ) -- Proof. ∧⊃-to-⊃⊃ {Γ}{φ}{ψ} Γ⊢φ∧ψ⊃γ = ⊃-intro (⊃-intro (⊃-elim (weaken ψ (weaken φ Γ⊢φ∧ψ⊃γ)) (∧-intro (weaken ψ (assume φ)) (assume {Γ = Γ , φ} ψ)))) -------------------------------------------------------------------------- ∎ -- Theorem. ⊃∧⊃-to-⊃∧ : ∀ {Γ} {φ ψ γ} → Γ ⊢ (φ ⊃ ψ) ∧ (φ ⊃ γ) → Γ ⊢ φ ⊃ (ψ ∧ γ) -- Proof. ⊃∧⊃-to-⊃∧ {φ = φ} Γ⊢⟨φ⊃ψ⟩∧⟨φ⊃γ⟩ = ⊃-intro (∧-intro (⊃-elim (∧-proj₁ (weaken φ Γ⊢⟨φ⊃ψ⟩∧⟨φ⊃γ⟩)) (assume φ)) (⊃-elim (∧-proj₂ (weaken φ Γ⊢⟨φ⊃ψ⟩∧⟨φ⊃γ⟩)) (assume φ))) -------------------------------------------------------------------------- ∎ -- Theorem. subst⊢⊃₁ : ∀ {Γ} {φ ψ γ} → Γ ⊢ γ ⊃ φ → Γ ⊢ φ ⊃ ψ → Γ ⊢ γ ⊃ ψ -- Proof. subst⊢⊃₁ {γ = γ} Γ⊢ψ⊃γ Γ⊢φ⊃ψ = ⊃-intro (⊃-elim (weaken γ Γ⊢φ⊃ψ) (⊃-elim (weaken γ Γ⊢ψ⊃γ) (assume γ))) -------------------------------------------------------------------------- ∎ -- Theorem. subst⊢⊃₂ : ∀ {Γ} {φ ψ γ} → Γ ⊢ ψ ⊃ γ → Γ ⊢ φ ⊃ ψ → Γ ⊢ φ ⊃ γ -- Proof. subst⊢⊃₂ {φ = φ} Γ⊢γ⊃φ Γ⊢φ⊃ψ = ⊃-intro (⊃-elim (weaken φ Γ⊢γ⊃φ) (⊃-elim (weaken φ Γ⊢φ⊃ψ) (assume φ))) -------------------------------------------------------------------------- ∎ -- Theorem. ⊃-trans : ∀ {Γ} {φ ψ γ} → Γ ⊢ φ ⊃ ψ → Γ ⊢ ψ ⊃ γ → Γ ⊢ φ ⊃ γ -- Proof. ⊃-trans Γ⊢φ⊃ψ Γ⊢ψ⊃γ = subst⊢⊃₂ Γ⊢ψ⊃γ Γ⊢φ⊃ψ -------------------------------------------------------------------------- ∎
test/Fail/Issue481InstantiatedImportOnly.agda
redfish64/autonomic-agda
3
986
module Issue481InstantiatedImportOnly where import Common.Issue481ParametrizedModule Set -- pointless, should yield error
SquareWaveGenerator.asm
MuhammadZubairSC/Square-Wave-Generator
0
240763
<filename>SquareWaveGenerator.asm HERE: SETB P1.0 LCALL DELAY CLR P1.0 LCALL DELAY SJMP HERE DELAY: MOV R3, #250 LAST: NOP NOP NOP NOP DJNZ R3, HERE RET
formalization/agda/Spire/Examples/PropositionalLevDesc.agda
spire/spire
43
9577
{-# OPTIONS --type-in-type #-} open import Data.Unit open import Data.Product hiding ( curry ; uncurry ) open import Data.List hiding ( concat ) open import Data.String open import Relation.Binary.PropositionalEquality module Spire.Examples.PropositionalLevDesc where ---------------------------------------------------------------------- Label : Set Label = String Enum : Set Enum = List Label data Tag : Enum → Set where here : ∀{l E} → Tag (l ∷ E) there : ∀{l E} → Tag E → Tag (l ∷ E) Cases : (E : Enum) (P : Tag E → Set) → Set Cases [] P = ⊤ Cases (l ∷ E) P = P here × Cases E λ t → P (there t) case : (E : Enum) (P : Tag E → Set) (cs : Cases E P) (t : Tag E) → P t case (l ∷ E) P (c , cs) here = c case (l ∷ E) P (c , cs) (there t) = case E (λ t → P (there t)) cs t UncurriedCases : (E : Enum) (P : Tag E → Set) (X : Set) → Set UncurriedCases E P X = Cases E P → X CurriedCases : (E : Enum) (P : Tag E → Set) (X : Set) → Set CurriedCases [] P X = X CurriedCases (l ∷ E) P X = P here → CurriedCases E (λ t → P (there t)) X curryCases : (E : Enum) (P : Tag E → Set) (X : Set) (f : UncurriedCases E P X) → CurriedCases E P X curryCases [] P X f = f tt curryCases (l ∷ E) P X f = λ c → curryCases E (λ t → P (there t)) X (λ cs → f (c , cs)) uncurryCases : (E : Enum) (P : Tag E → Set) (X : Set) (f : CurriedCases E P X) → UncurriedCases E P X uncurryCases [] P X x tt = x uncurryCases (l ∷ E) P X f (c , cs) = uncurryCases E (λ t → P (there t)) X (f c) cs ---------------------------------------------------------------------- data Desc (I : Set) : Set₁ where `End : (i : I) → Desc I `Rec : (i : I) (D : Desc I) → Desc I `Arg : (A : Set) (B : A → Desc I) → Desc I `RecFun : (A : Set) (B : A → I) (D : Desc I) → Desc I ISet : Set → Set₁ ISet I = I → Set El : (I : Set) (D : Desc I) (X : ISet I) → ISet I El I (`End j) X i = j ≡ i El I (`Rec j D) X i = X j × El I D X i El I (`Arg A B) X i = Σ A (λ a → El I (B a) X i) El I (`RecFun A B D) X i = ((a : A) → X (B a)) × El I D X i Hyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (i : I) (xs : El I D X i) → Set Hyps I (`End j) X P i q = ⊤ Hyps I (`Rec j D) X P i (x , xs) = P j x × Hyps I D X P i xs Hyps I (`Arg A B) X P i (a , b) = Hyps I (B a) X P i b Hyps I (`RecFun A B D) X P i (f , xs) = ((a : A) → P (B a) (f a)) × Hyps I D X P i xs ---------------------------------------------------------------------- TagDesc : (I : Set) → Set TagDesc I = Σ Enum (λ E → Cases E (λ _ → Desc I)) toCase : (I : Set) (E,cs : TagDesc I) → Tag (proj₁ E,cs) → Desc I toCase I (E , cs) = case E (λ _ → Desc I) cs toDesc : (I : Set) → TagDesc I → Desc I toDesc I (E , cs) = `Arg (Tag E) (toCase I (E , cs)) ---------------------------------------------------------------------- UncurriedEl : (I : Set) (D : Desc I) (X : ISet I) → Set UncurriedEl I D X = {i : I} → El I D X i → X i CurriedEl : (I : Set) (D : Desc I) (X : ISet I) → Set CurriedEl I (`End i) X = X i CurriedEl I (`Rec j D) X = (x : X j) → CurriedEl I D X CurriedEl I (`Arg A B) X = (a : A) → CurriedEl I (B a) X CurriedEl I (`RecFun A B D) X = ((a : A) → X (B a)) → CurriedEl I D X curryEl : (I : Set) (D : Desc I) (X : ISet I) (cn : UncurriedEl I D X) → CurriedEl I D X curryEl I (`End i) X cn = cn refl curryEl I (`Rec i D) X cn = λ x → curryEl I D X (λ xs → cn (x , xs)) curryEl I (`Arg A B) X cn = λ a → curryEl I (B a) X (λ xs → cn (a , xs)) curryEl I (`RecFun A B D) X cn = λ f → curryEl I D X (λ xs → cn (f , xs)) uncurryEl : (I : Set) (D : Desc I) (X : ISet I) (cn : CurriedEl I D X) → UncurriedEl I D X uncurryEl I (`End i) X cn refl = cn uncurryEl I (`Rec i D) X cn (x , xs) = uncurryEl I D X (cn x) xs uncurryEl I (`Arg A B) X cn (a , xs) = uncurryEl I (B a) X (cn a) xs uncurryEl I (`RecFun A B D) X cn (f , xs) = uncurryEl I D X (cn f) xs ---------------------------------------------------------------------- CasesD : (I : Set) (E : Enum) → Set CasesD I E = Cases E (λ _ → Desc I) Args : (I : Set) (E : Enum) (t : Tag E) (cs : CasesD I E) → Desc I Args I E t cs = case E (λ _ → Desc I) cs t ---------------------------------------------------------------------- data μ (I : Set) (E : Enum) (cs : CasesD I E) : I → Set where con : (t : Tag E) → UncurriedEl I (Args I E t cs) (μ I E cs) con2 : (I : Set) (E : Enum) (cs : CasesD I E) (t : Tag E) → CurriedEl I (Args I E t cs) (μ I E cs) con2 I E cs t = curryEl I (Args I E t cs) (μ I E cs) (con t) ---------------------------------------------------------------------- UncurriedHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : {i : I} → El I D X i → X i) → Set UncurriedHyps I D X P cn = (i : I) (xs : El I D X i) → Hyps I D X P i xs → P i (cn xs) CurriedHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) → Set CurriedHyps I (`End i) X P cn = P i (cn refl) CurriedHyps I (`Rec i D) X P cn = (x : X i) → P i x → CurriedHyps I D X P (λ xs → cn (x , xs)) CurriedHyps I (`Arg A B) X P cn = (a : A) → CurriedHyps I (B a) X P (λ xs → cn (a , xs)) CurriedHyps I (`RecFun A B D) X P cn = (f : (a : A) → X (B a)) (ihf : (a : A) → P (B a) (f a)) → CurriedHyps I D X P (λ xs → cn (f , xs)) curryHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) (pf : UncurriedHyps I D X P cn) → CurriedHyps I D X P cn curryHyps I (`End i) X P cn pf = pf i refl tt curryHyps I (`Rec i D) X P cn pf = λ x ih → curryHyps I D X P (λ xs → cn (x , xs)) (λ i xs ihs → pf i (x , xs) (ih , ihs)) curryHyps I (`Arg A B) X P cn pf = λ a → curryHyps I (B a) X P (λ xs → cn (a , xs)) (λ i xs ihs → pf i (a , xs) ihs) curryHyps I (`RecFun A B D) X P cn pf = λ f ihf → curryHyps I D X P (λ xs → cn (f , xs)) (λ i xs ihs → pf i (f , xs) (ihf , ihs)) uncurryHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) (pf : CurriedHyps I D X P cn) → UncurriedHyps I D X P cn uncurryHyps I (`End .i) X P cn pf i refl tt = pf uncurryHyps I (`Rec j D) X P cn pf i (x , xs) (ih , ihs) = uncurryHyps I D X P (λ ys → cn (x , ys)) (pf x ih) i xs ihs uncurryHyps I (`Arg A B) X P cn pf i (a , xs) ihs = uncurryHyps I (B a) X P (λ ys → cn (a , ys)) (pf a) i xs ihs uncurryHyps I (`RecFun A B D) X P cn pf i (f , xs) (ihf , ihs) = uncurryHyps I D X P (λ ys → cn (f , ys)) (pf f ihf) i xs ihs ---------------------------------------------------------------------- ind : (I : Set) (E : Enum) (cs : CasesD I E) (P : (i : I) → μ I E cs i → Set) (pcon : (t : Tag E) → UncurriedHyps I (Args I E t cs) (μ I E cs) P (con t)) (i : I) (x : μ I E cs i) → P i x hyps : (I : Set) (E : Enum) (cs : CasesD I E) (P : (i : I) → μ I E cs i → Set) (pcon : (t : Tag E) → UncurriedHyps I (Args I E t cs) (μ I E cs) P (con t)) (D : Desc I) (i : I) (xs : El I D (μ I E cs) i) → Hyps I D (μ I E cs) P i xs ind I E cs P pcon i (con t as) = pcon t i as (hyps I E cs P pcon (Args I E t cs) i as) hyps I E cs P pcon (`End j) i q = tt hyps I E cs P pcon (`Rec j A) i (x , xs) = ind I E cs P pcon j x , hyps I E cs P pcon A i xs hyps I E cs P pcon (`Arg A B) i (a , b) = hyps I E cs P pcon (B a) i b hyps I E cs P pcon (`RecFun A B D) i (f , xs) = (λ a → ind I E cs P pcon (B a) (f a)) , hyps I E cs P pcon D i xs ---------------------------------------------------------------------- ind2 : (I : Set) (E : Enum) (cs : CasesD I E) (P : (i : I) → μ I E cs i → Set) (pcon : (t : Tag E) → CurriedHyps I (Args I E t cs) (μ I E cs) P (con t)) (i : I) (x : μ I E cs i) → P i x ind2 I E cs P pcon i x = ind I E cs P (λ t → uncurryHyps I (Args I E t cs) (μ I E cs) P (con t) (pcon t)) i x elim : (I : Set) (E : Enum) (cs : CasesD I E) (P : (i : I) → μ I E cs i → Set) → let Q = λ t → CurriedHyps I (Args I E t cs) (μ I E cs) P (con t) X = (i : I) (x : μ I E cs i) → P i x in UncurriedCases E Q X elim I E cs P ds i x = let Q = λ t → CurriedHyps I (Args I E t cs) (μ I E cs) P (con t) in ind2 I E cs P (case E Q ds) i x elim2 : (I : Set) (E : Enum) (cs : CasesD I E) (P : (i : I) → μ I E cs i → Set) → let Q = λ t → CurriedHyps I (Args I E t cs) (μ I E cs) P (con t) X = (i : I) (x : μ I E cs i) → P i x in CurriedCases E Q X elim2 I E cs P = let Q = λ t → CurriedHyps I (Args I E t cs) (μ I E cs) P (con t) X = (i : I) (x : μ I E cs i) → P i x in curryCases E Q X (elim I E cs P) ---------------------------------------------------------------------- ℕT : Enum ℕT = "zero" ∷ "suc" ∷ [] VecT : Enum VecT = "nil" ∷ "cons" ∷ [] ℕD : CasesD ⊤ ℕT ℕD = `End tt , `Rec tt (`End tt) , tt ℕ : ⊤ → Set ℕ = μ ⊤ ℕT ℕD zero : ℕ tt zero = con here refl suc : ℕ tt → ℕ tt suc n = con (there here) (n , refl) zero2 : ℕ tt zero2 = con2 ⊤ ℕT ℕD here suc2 : ℕ tt → ℕ tt suc2 = con2 ⊤ ℕT ℕD (there here) VecD : (A : Set) → CasesD (ℕ tt) VecT VecD A = `End zero , `Arg (ℕ tt) (λ n → `Arg A λ _ → `Rec n (`End (suc n))) , tt Vec : (A : Set) (n : ℕ tt) → Set Vec A n = μ (ℕ tt) VecT (VecD A) n nil : (A : Set) → Vec A zero nil A = con here refl cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n) cons A n x xs = con (there here) (n , x , xs , refl) nil2 : (A : Set) → Vec A zero nil2 A = con2 (ℕ tt) VecT (VecD A) here cons2 : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n) cons2 A = con2 (ℕ tt) VecT (VecD A) (there here) ---------------------------------------------------------------------- module GenericEliminator where add : ℕ tt → ℕ tt → ℕ tt add = elim2 ⊤ ℕT ℕD _ (λ n → n) (λ m ih n → suc (ih n)) tt mult : ℕ tt → ℕ tt → ℕ tt mult = elim2 ⊤ ℕT ℕD _ (λ n → zero) (λ m ih n → add n (ih n)) tt append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n) append A = elim2 (ℕ tt) VecT (VecD A) _ (λ n ys → ys) (λ m x xs ih n ys → cons A (add m n) x (ih n ys)) concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m) concat A m = elim2 (ℕ tt) VecT (VecD (Vec A m)) _ (nil A) (λ n xs xss ih → append A m xs (mult n m) ih) ----------------------------------------------------------------------
test/epic/tests/Nat.agda
redfish64/autonomic-agda
0
14760
-- Moved from the successfull test-suite. See Issue 1481. module tests.Nat where data Nat : Set where Z : Nat S : Nat → Nat {-# BUILTIN NATURAL Nat #-} _+_ : Nat → Nat → Nat Z + m = m S n + m = S (n + m) {-# BUILTIN NATPLUS _+_ #-} _*_ : Nat → Nat → Nat Z * m = Z S n * m = m + (n * m) {-# BUILTIN NATTIMES _*_ #-} data Unit : Set where unit : Unit postulate IO : Set → Set String : Set natToString : Nat → String putStr : String → IO Unit printNat : Nat → IO Unit printNat n = putStr (natToString n) {-# COMPILED_TYPE IO IO #-} {-# COMPILED_EPIC natToString (n : Any) -> String = bigToStr(n) #-} {-# COMPILED_EPIC putStr (a : String, u : Unit) -> Unit = foreign Int "wputStr" (a : String); primUnit #-} main : IO Unit main = printNat (7 * 191) -- should print 1337
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_1190.asm
ljhsiun2/medusa
9
97411
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xa419, %r13 nop nop nop cmp %r9, %r9 movl $0x61626364, (%r13) nop nop nop sub $31057, %r8 lea addresses_WC_ht+0x1bf79, %r12 nop nop nop nop nop sub $48677, %rbp mov (%r12), %edx nop nop nop nop sub $36361, %r12 lea addresses_WC_ht+0x1d79, %r13 nop nop nop nop nop and %r8, %r8 mov (%r13), %ebp xor %r12, %r12 lea addresses_UC_ht+0x16541, %rdx nop nop add $31849, %rdi vmovups (%rdx), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %r12 nop nop nop nop add $63637, %rdi lea addresses_A_ht+0x14519, %r8 nop cmp %r12, %r12 movups (%r8), %xmm3 vpextrq $0, %xmm3, %r9 nop nop add %r12, %r12 lea addresses_D_ht+0xfaf9, %rsi lea addresses_UC_ht+0x16979, %rdi nop nop xor %r12, %r12 mov $92, %rcx rep movsw and $29538, %rbp lea addresses_A_ht+0xaaaf, %rbp nop nop nop nop nop sub %r13, %r13 mov (%rbp), %rcx nop nop cmp $23547, %rdx lea addresses_WT_ht+0x3379, %r9 nop dec %rbp mov $0x6162636465666768, %rcx movq %rcx, (%r9) nop nop nop nop nop and %r13, %r13 lea addresses_WC_ht+0x1dae, %rsi lea addresses_UC_ht+0x16739, %rdi nop nop nop xor $9345, %rdx mov $92, %rcx rep movsq nop nop nop nop nop sub %r8, %r8 lea addresses_WC_ht+0x1a979, %r13 nop nop nop cmp $43725, %r12 mov (%r13), %rcx nop xor %r8, %r8 lea addresses_D_ht+0xf079, %rsi lea addresses_A_ht+0x149a9, %rdi sub %rbp, %rbp mov $106, %rcx rep movsb nop nop nop nop nop and %rbp, %rbp lea addresses_WT_ht+0x13269, %r9 clflush (%r9) nop nop nop nop nop dec %rdx mov (%r9), %r8 nop nop sub $60752, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r9 push %rax push %rbx push %rcx push %rdi push %rsi // Load lea addresses_RW+0x1b979, %r12 nop nop nop nop nop sub %rbx, %rbx vmovups (%r12), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rcx nop nop nop nop and %rcx, %rcx // Store lea addresses_normal+0x17f19, %rax and %r13, %r13 movw $0x5152, (%rax) nop nop nop nop nop xor $12151, %rsi // REPMOV lea addresses_RW+0x1bb79, %rsi lea addresses_A+0x169d7, %rdi nop add $18840, %r12 mov $38, %rcx rep movsl nop nop sub $46237, %r9 // Store lea addresses_A+0x1b179, %rbx nop nop nop nop cmp %r13, %r13 mov $0x5152535455565758, %rcx movq %rcx, (%rbx) nop nop nop nop nop xor %rdi, %rdi // Store lea addresses_WT+0xd1b9, %r9 nop sub %rdi, %rdi mov $0x5152535455565758, %r12 movq %r12, (%r9) // Exception!!! nop nop nop mov (0), %rbx nop nop nop nop and %rbx, %rbx // Store lea addresses_WT+0x1a179, %rdi nop nop nop nop add %rax, %rax movw $0x5152, (%rdi) nop cmp $54215, %rbx // Store lea addresses_US+0xc09, %r13 nop nop nop nop nop add %r9, %r9 movb $0x51, (%r13) and $49295, %r9 // Faulty Load lea addresses_A+0x1b179, %rdi nop nop nop nop nop and $43144, %r9 mov (%rdi), %r13 lea oracles, %rbx and $0xff, %r13 shlq $12, %r13 mov (%rbx,%r13,1), %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_normal', 'size': 2, 'AVXalign': False}} {'src': {'type': 'addresses_RW', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WT', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_US', 'size': 1, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}} {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 9, 'NT': True, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'src': {'same': False, 'congruent': 5, 'NT': True, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'58': 21829} 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 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 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 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 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 */
pwnlib/shellcraft/templates/amd64/pushstr_array.asm
DrKeineLust/pwntools
7
8753
<% from pwnlib.shellcraft import amd64 %> <%docstring> Pushes an array/envp-style array of pointers onto the stack. Arguments: reg(str): Destination register to hold the pointer. array(str,list): Single argument or list of arguments to push. NULL termination is normalized so that each argument ends with exactly one NULL byte. </%docstring> <%page args="reg, array"/> <% if isinstance(array, (str)): array = [array] array_str = '' # Normalize all of the arguments' endings array = [arg.rstrip('\x00') + '\x00' for arg in array] array_str = ''.join(array) word_size = 8 offset = len(array_str) + word_size %>\ /* push argument array ${repr(array)} */ ${amd64.pushstr(array_str)} ${amd64.mov(reg, 0)} push ${reg} /* null terminate */ % for i,arg in enumerate(reversed(array)): ${amd64.mov(reg, offset + word_size*i - len(arg))} add ${reg}, rsp push ${reg} /* ${repr(arg)} */ <% offset -= len(arg) %>\ % endfor ${amd64.mov(reg,'rsp')}
kernel/temp/__words.asm
paulscottrobson/m7
0
82163
<gh_stars>0 ; ********************************************************************************* ; ********************************************************************************* ; ; File: con.raw.asm ; Purpose: con.raw words. ; Date : 5th January 2019 ; Author: <EMAIL> ; ; ********************************************************************************* ; ********************************************************************************* ; ========= con.raw.setmode word ========= def_63_6f_6e_2e_72_61_77_2e_73_65_74_6d_6f_64_65: call compileCallToSelf jp GFXMode ; ========= con.raw.char! word ========= def_63_6f_6e_2e_72_61_77_2e_63_68_61_72_21: call compileCallToSelf jp GFXWriteCharacter ; ========= con.raw.hex! word ========= def_63_6f_6e_2e_72_61_77_2e_68_65_78_21: call compileCallToSelf jp GFXWriteHexWord ; ========= con.raw.inkey word ========= def_63_6f_6e_2e_72_61_77_2e_69_6e_6b_65_79: call compileCallToSelf ex de,hl call IOScanKeyboard ; read keyboard ld l,a ld h,$00 ret ; *************************************************************************************** ; *************************************************************************************** ; ; Name : binary.asm ; Author : <NAME> (<EMAIL>) ; Date : 5th January 2019 ; Purpose : Binary operators (A ? B -> A) ; ; *************************************************************************************** ; *************************************************************************************** ; *************************************************************************************** ; ========= < word ========= def_3c: call compileCallToSelf ld a,h ; check if signs different. xor d add a,a ; CS if different jr nc,__less_samesign ld a,d ; different. set CS to sign of B add a,a ; if set (negative) B must be < A as A is +ve jr __less_returnc __less_samesign: push de ; save DE ex de,hl ; -1 if B < A sbc hl,de ; calculate B - A , hencs CS if < (Carry clear by add a,a) pop de ; restore DE __less_returnc: ld a,0 ; A 0 sbc a,0 ; A $FF if CS. ld l,a ; put in HL ld h,a ret ; *************************************************************************************** ; ========= = word ========= def_3d: call compileCallToSelf ld a,h ; H = H ^ D xor d ld h,a ld a,l ; A = (L ^ E) | (H ^ D) xor e or h ; if A == 0 they are the same. ld hl,$0000 ; return 0 if different ret nz dec hl ; return -1 ret ; *************************************************************************************** ; ========= - word ========= def_2d: call compileCallToSelf push de ; save DE ex de,hl ; HL = B, DE = A xor a ; clear carry sbc hl,de ; calculate B-A pop de ; restore DE ret ; *************************************************************************************** ; ========= * word ========= def_2a: call compileCallToSelf jp MULTMultiply16 ; *************************************************************************************** ; ========= / word ========= def_2f: call compileCallToSelf push de call DIVDivideMod16 ex de,hl pop de ret ; *************************************************************************************** ; ========= + xmacro ========= def_2b: call compileExecutableCopySelf start_2b: db end_2b-start_2b-1 add hl,de end_2b: ret ; *************************************************************************************** ; ========= and word ========= def_61_6e_64: call compileCallToSelf ld a,h and d ld h,a ld a,l and e ld l,a ret ; *************************************************************************************** ; ========= mod word ========= def_6d_6f_64: call compileCallToSelf push de call DIVDivideMod16 pop de ret ; *************************************************************************************** ; ========= or word ========= def_6f_72: call compileCallToSelf ld a,h or d ld h,a ld a,l or e ld l,a ret ; *************************************************************************************** ; ========= xor word ========= def_78_6f_72: call compileCallToSelf ld a,h xor d ld h,a ld a,l xor e ld l,a ret ; *************************************************************************************** ; *************************************************************************************** ; ; Name : memory.asm ; Author : <NAME> (<EMAIL>) ; Date : 5th January 2019 ; Purpose : Memory operators ; ; *************************************************************************************** ; *************************************************************************************** ; ========= ! xmacro ========= def_21: call compileExecutableCopySelf start_21: db end_21-start_21-1 ld (hl),e inc hl ld (hl),d dec hl end_21: ret ; *************************************************************************************** ; ========= @ xmacro ========= def_40: call compileExecutableCopySelf start_40: db end_40-start_40-1 ld a,(hl) inc hl ld h,(hl) ld l,a end_40: ret ; *************************************************************************************** ; ========= +! word ========= def_2b_21: call compileCallToSelf ld a,(hl) add a,e ld (hl),a inc hl ld a,(hl) adc a,d ld (hl),a dec hl ret ; *************************************************************************************** ; ========= c! xmacro ========= def_63_21: call compileExecutableCopySelf start_63_21: db end_63_21-start_63_21-1 ld (hl),e end_63_21: ret ; *************************************************************************************** ; ========= c@ xmacro ========= def_63_40: call compileExecutableCopySelf start_63_40: db end_63_40-start_63_40-1 ld l,(hl) ld h,0 end_63_40: ret ; *************************************************************************************** ; ========= p@ xmacro ========= def_70_40: call compileExecutableCopySelf start_70_40: db end_70_40-start_70_40-1 in l,(c) ld h,0 end_70_40: ret ; *************************************************************************************** ; ========= p! macro ========= def_70_21: call compileCopySelf start_70_21: db end_70_21-start_70_21-1 out (c),l end_70_21: ret ; *************************************************************************************** ; *************************************************************************************** ; ; Name : miscellany.asm ; Author : <NAME> (<EMAIL>) ; Date : 5th January 2019 ; Purpose : Miscellaneous words ; ; *************************************************************************************** ; *************************************************************************************** ; ========= , word ========= def_2c: call compileCallToSelf jp FARCompileWord ; *************************************************************************************** ; ========= ; macro ========= def_3b: call compileCopySelf start_3b: db end_3b-start_3b-1 ret end_3b: ret ; *************************************************************************************** ; ========= c, word ========= def_63_2c: call compileCallToSelf ld a,l jp FARCompileWord ; *************************************************************************************** ; ========= copy word ========= def_63_6f_70_79: call compileCallToSelf ld a,b ; exit if C = 0 or c ret z push bc ; BC count push de ; DE target push hl ; HL source xor a ; Clear C sbc hl,de ; check overlap ? jr nc,__copy_gt_count ; if source after target add hl,de ; undo subtract add hl,bc ; add count to HL + DE ex de,hl add hl,bc ex de,hl dec de ; dec them, so now at the last byte to copy dec hl lddr ; do it backwards jr __copy_exit __copy_gt_count: add hl,de ; undo subtract ldir ; do the copy __copy_exit: pop hl ; restore registers pop de pop bc ret ; *************************************************************************************** ; ========= fill word ========= def_66_69_6c_6c: call compileCallToSelf ld a,b ; exit if C = 0 or c ret z push bc ; BC count push de ; DE target, L byte __fill_loop: ld a,l ; copy a byte ld (de),a inc de ; bump pointer dec bc ; dec counter and loop ld a,b or c jr nz,__fill_loop pop de ; restore pop bc ret ; *************************************************************************************** ; ========= halt word ========= def_68_61_6c_74: call compileCallToSelf __halt_loop: di halt jr __halt_loop ; *************************************************************************************** ; ========= sys.stdheaderroutine word ========= def_73_79_73_2e_73_74_64_68_65_61_64_65_72_72_6f_75_74_69_6e_65: call compileCallToSelf compileCallToSelf: jp __compileCallToSelf ; ; The header routine for normal code - compiles a call to the address immediately ; following the 'call' to this routine. ; __compileCallToSelf: ex (sp),hl ; get the routine addr into HL, old HL on TOS. ld a,$CD ; Z80 Call call FARCompileByte call FARCompileWord pop hl ; restore HL and exit ret ; *************************************************************************************** ; ========= sys.stdmacroroutine word ========= def_73_79_73_2e_73_74_64_6d_61_63_72_6f_72_6f_75_74_69_6e_65: call compileCallToSelf compileCopySelf: jp __compileCopySelf ; ========= sys.stdexecmacroroutine word ========= def_73_79_73_2e_73_74_64_65_78_65_63_6d_61_63_72_6f_72_6f_75_74_69_6e_65: call compileCallToSelf compileExecutableCopySelf: jp __compileExecutableCopySelf ; ; Macro code - compiles the code immediately following the call to this routine. ; First byte is the length, subsequent is data. ; __compileCopySelf: ; different addresses to tell executable ones. nop __compileExecutableCopySelf: ex (sp),hl ; routine start into HL, old HL on TOS push bc ; save BC ld b,(hl) ; get count inc hl __copyMacroCode: ld a,(hl) ; do next byte call FARCompileByte inc hl djnz __copyMacroCode pop bc ; restore and exit. pop hl ret ; *************************************************************************************** ; ========= sys.variableroutine word ========= def_73_79_73_2e_76_61_72_69_61_62_6c_65_72_6f_75_74_69_6e_65: call compileCallToSelf variableAddressCompiler: ld a,$EB ; ex de,hl call FARCompileByte ld a,$21 ; ld hl,xxxxx call FARCompileByte pop hl ; var address call FARCompileWord ret ; *************************************************************************************** ; ========= break macro ========= def_62_72_65_61_6b: call compileCopySelf start_62_72_65_61_6b: db end_62_72_65_61_6b-start_62_72_65_61_6b-1 db $DD,$01 end_62_72_65_61_6b: ret ; *************************************************************************************** ; *************************************************************************************** ; ; Name : register.asm ; Author : <NAME> (<EMAIL>) ; Date : 5th January 2019 ; Purpose : Register manipulation ; ; *************************************************************************************** ; *************************************************************************************** ; ========= swap xmacro ========= def_73_77_61_70: call compileExecutableCopySelf start_73_77_61_70: db end_73_77_61_70-start_73_77_61_70-1 ex de,hl end_73_77_61_70: ret ; *************************************************************************************** ; ========= a>b xmacro ========= def_61_3e_62: call compileExecutableCopySelf start_61_3e_62: db end_61_3e_62-start_61_3e_62-1 ld d,h ld e,l end_61_3e_62: ret ; ========= a>c xmacro ========= def_61_3e_63: call compileExecutableCopySelf start_61_3e_63: db end_61_3e_63-start_61_3e_63-1 ld b,h ld c,l end_61_3e_63: ret ; *************************************************************************************** ; ========= b>a xmacro ========= def_62_3e_61: call compileExecutableCopySelf start_62_3e_61: db end_62_3e_61-start_62_3e_61-1 ld h,d ld l,e end_62_3e_61: ret ; ========= b>c xmacro ========= def_62_3e_63: call compileExecutableCopySelf start_62_3e_63: db end_62_3e_63-start_62_3e_63-1 ld b,d ld c,e end_62_3e_63: ret ; *************************************************************************************** ; ========= c>a xmacro ========= def_63_3e_61: call compileExecutableCopySelf start_63_3e_61: db end_63_3e_61-start_63_3e_61-1 ld h,b ld l,c end_63_3e_61: ret ; ========= c>b xmacro ========= def_63_3e_62: call compileExecutableCopySelf start_63_3e_62: db end_63_3e_62-start_63_3e_62-1 ld d,b ld e,c end_63_3e_62: ret ; *************************************************************************************** ; *************************************************************************************** ; ; Name : stack.asm ; Author : <NAME> (<EMAIL>) ; Date : 5th January 2019 ; Purpose : Stack words ; ; *************************************************************************************** ; *************************************************************************************** ; ========= push macro ========= def_70_75_73_68: call compileCopySelf start_70_75_73_68: db end_70_75_73_68-start_70_75_73_68-1 push hl end_70_75_73_68: ret ; ========= pop macro ========= def_70_6f_70: call compileCopySelf start_70_6f_70: db end_70_6f_70-start_70_6f_70-1 ex de,hl pop hl end_70_6f_70: ret ; *************************************************************************************** ; ========= a>r macro ========= def_61_3e_72: call compileCopySelf start_61_3e_72: db end_61_3e_72-start_61_3e_72-1 push hl end_61_3e_72: ret ; ========= r>a macro ========= def_72_3e_61: call compileCopySelf start_72_3e_61: db end_72_3e_61-start_72_3e_61-1 pop hl end_72_3e_61: ret ; *************************************************************************************** ; ========= b>r macro ========= def_62_3e_72: call compileCopySelf start_62_3e_72: db end_62_3e_72-start_62_3e_72-1 push de end_62_3e_72: ret ; ========= r>b macro ========= def_72_3e_62: call compileCopySelf start_72_3e_62: db end_72_3e_62-start_72_3e_62-1 pop de end_72_3e_62: ret ; *************************************************************************************** ; ========= c>r macro ========= def_63_3e_72: call compileCopySelf start_63_3e_72: db end_63_3e_72-start_63_3e_72-1 push bc end_63_3e_72: ret ; ========= r>c macro ========= def_72_3e_63: call compileCopySelf start_72_3e_63: db end_72_3e_63-start_72_3e_63-1 pop bc end_72_3e_63: ret ; *************************************************************************************** ; ========= ab>r macro ========= def_61_62_3e_72: call compileCopySelf start_61_62_3e_72: db end_61_62_3e_72-start_61_62_3e_72-1 push de push hl end_61_62_3e_72: ret ; ========= r>ab macro ========= def_72_3e_61_62: call compileCopySelf start_72_3e_61_62: db end_72_3e_61_62-start_72_3e_61_62-1 pop hl pop de end_72_3e_61_62: ret ; *************************************************************************************** ; ========= abc>r macro ========= def_61_62_63_3e_72: call compileCopySelf start_61_62_63_3e_72: db end_61_62_63_3e_72-start_61_62_63_3e_72-1 push bc push de push hl end_61_62_63_3e_72: ret ; ========= r>abc macro ========= def_72_3e_61_62_63: call compileCopySelf start_72_3e_61_62_63: db end_72_3e_61_62_63-start_72_3e_61_62_63-1 pop hl pop de pop bc end_72_3e_61_62_63: ret ; *************************************************************************************** ; *************************************************************************************** ; ; Name : unary.asm ; Author : <NAME> (<EMAIL>) ; Date : 5th January 2019 ; Purpose : Unary operators (A ? B -> A) ; ; *************************************************************************************** ; *************************************************************************************** ; ========= -- xmacro ========= def_2d_2d: call compileExecutableCopySelf start_2d_2d: db end_2d_2d-start_2d_2d-1 dec hl end_2d_2d: ret ; *************************************************************************************** ; ========= --- xmacro ========= def_2d_2d_2d: call compileExecutableCopySelf start_2d_2d_2d: db end_2d_2d_2d-start_2d_2d_2d-1 dec hl dec hl end_2d_2d_2d: ret ; *************************************************************************************** ; ========= ++ xmacro ========= def_2b_2b: call compileExecutableCopySelf start_2b_2b: db end_2b_2b-start_2b_2b-1 inc hl end_2b_2b: ret ; *************************************************************************************** ; ========= +++ xmacro ========= def_2b_2b_2b: call compileExecutableCopySelf start_2b_2b_2b: db end_2b_2b_2b-start_2b_2b_2b-1 inc hl inc hl end_2b_2b_2b: ret ; *************************************************************************************** ; ========= 0- word ========= def_30_2d: call compileCallToSelf __negate: ld a,h cpl ld h,a ld a,l cpl ld l,a inc hl ret ; *************************************************************************************** ; ========= 0< word ========= def_30_3c: call compileCallToSelf bit 7,h ld hl,$0000 ret z dec hl ret ; *************************************************************************************** ; ========= 0= word ========= def_30_3d: call compileCallToSelf ld a,h or l ld hl,$0000 ret nz dec hl ret ; *************************************************************************************** ; ========= 2* xmacro ========= def_32_2a: call compileExecutableCopySelf start_32_2a: db end_32_2a-start_32_2a-1 add hl,hl end_32_2a: ret ; ========= 4* xmacro ========= def_34_2a: call compileExecutableCopySelf start_34_2a: db end_34_2a-start_34_2a-1 add hl,hl add hl,hl end_34_2a: ret ; ========= 8* xmacro ========= def_38_2a: call compileExecutableCopySelf start_38_2a: db end_38_2a-start_38_2a-1 add hl,hl add hl,hl add hl,hl end_38_2a: ret ; ========= 16* xmacro ========= def_31_36_2a: call compileExecutableCopySelf start_31_36_2a: db end_31_36_2a-start_31_36_2a-1 add hl,hl add hl,hl add hl,hl add hl,hl end_31_36_2a: ret ; *************************************************************************************** ; ========= 2/ xmacro ========= def_32_2f: call compileExecutableCopySelf start_32_2f: db end_32_2f-start_32_2f-1 sra h rr l end_32_2f: ret ; ========= 4/ xmacro ========= def_34_2f: call compileExecutableCopySelf start_34_2f: db end_34_2f-start_34_2f-1 sra h rr l sra h rr l end_34_2f: ret ; *************************************************************************************** ; ========= abs word ========= def_61_62_73: call compileCallToSelf bit 7,h ret z jp __negate ; *************************************************************************************** ; ========= bswap xmacro ========= def_62_73_77_61_70: call compileExecutableCopySelf start_62_73_77_61_70: db end_62_73_77_61_70-start_62_73_77_61_70-1 ld a,l ld l,h ld h,a end_62_73_77_61_70: ret ; *************************************************************************************** ; ========= not word ========= def_6e_6f_74: call compileCallToSelf ld a,h cpl ld h,a ld a,l cpl ld l,a ret
linear_algebra/golub_svd_tst_2.adb
jscparker/math_packages
30
5075
with Golub_SVD; with Rectangular_Test_Matrices; with Ada.Text_IO; use Ada.Text_IO; -- Demonstrates use of SVD when No_of_Rows > No_of_Cols. -- So you have more equations than unknowns in equation solving. -- (Can't have No_of_Rows < No_of_Cols.) procedure golub_svd_tst_2 is type Real is digits 15; Start : constant := 1; Limit_r : constant := 222; Limit_c : constant := 100; -- You can make them different types if you want: type Row_Index is new Integer range Start .. Limit_r; type Col_Index is new Integer range Start .. Limit_c; --subtype Row_Index is Integer range Start .. Limit_r; --subtype Col_Index is Integer range Start .. Limit_c; type A_Matrix is array (Row_Index, Col_Index) of Real; pragma Convention (Fortran, A_Matrix); package lin_svd is new golub_svd (Real, Row_Index, Col_Index, A_Matrix); use lin_svd; package Rect_Matrix is new Rectangular_Test_Matrices(Real, Row_Index, Col_Index, A_Matrix); use Rect_Matrix; package rio is new Ada.Text_IO.Float_IO(Real); use rio; Final_Row : constant Row_Index := Row_Index'Last - 3; Final_Col : constant Col_Index := Col_Index'Last - 3; Starting_Col : constant Col_Index := Col_Index'First + 2; Starting_Row : constant Row_Index := Row_Index (Starting_Col);-- requirement of SVD A0, A, SVD_Product : A_Matrix := (others => (others => 0.0)); V : V_Matrix; VV_Product : V_Matrix; U : U_Matrix; UU_Product : U_matrix; Singular_Vals : Singular_Vector := (others => 0.0); Col_id_of_1st_Good_S_Val : Col_Index; Max_Singular_Val, Sum, Error_Off_Diag, Error_Diag, Del : Real; begin new_line(1); new_line; put ("Error in the singular value decomposition is estimated by finding"); new_line; put ("The max element of A - U*W*V', and dividing it by the largest"); new_line; put ("singular value of A. Should be somewhere around Real'Epsilon"); new_line; put ("in magnitude if all goes well."); new_line(1); new_line; put ("Error in the calculation of V is estimated by finding the max element"); new_line; put ("of I - V'*V = I - Transpose(V)*V"); new_line; put ("I - V'*V should be near Real'Epsilon."); new_line(1); new_line; put ("Error in the calculation of U is estimated by finding the max element"); new_line; put ("of I - U'*U = I - Transpose(U)*U"); new_line; put ("I - U'*U should be near Real'Epsilon."); new_line(1); new_line; put ("Notice that U'U = I implies A'A = VW'U'UWV' = VEV' where E is a"); new_line; put ("diagonal matrix (E = W'W) containing the squares of the singular"); new_line; put ("values. So U'U = I and V'V = I imply that the cols of V are the "); new_line; put ("eigvectors of A'A. (Multiply the above equality by V to get A'AV = VE.)"); new_line(1); for Chosen_Matrix in Matrix_id loop Init_Matrix (A, Chosen_Matrix); -- Get A = U * W * V' where W is diagonal containing the singular vals for i in 1..1 loop A0 := A; SVD_Decompose (A => A0, U => U, V => V, S => Singular_Vals, Id_of_1st_S_Val => Col_id_of_1st_Good_S_Val, Starting_Col => Starting_Col, Final_Col => Final_Col, Final_Row => Final_Row, Matrix_U_Desired => True, Matrix_V_Desired => True); end loop; new_line(2); put ("Testing SVD on matrix A of type: "); put (Matrix_id'Image(Chosen_Matrix)); if Col_id_of_1st_good_S_Val /= Starting_Col then new_line; put ("QR failed to fully converge at column = "); put(Col_Index'Image(Col_id_of_1st_good_S_Val)); new_line; else new_line; put ("Max Singular Val = "); put(Real'Image(Singular_Vals(Col_id_of_1st_good_S_Val))); end if; Max_Singular_Val := Singular_Vals(Col_id_of_1st_good_S_Val); Max_Singular_Val := Abs Max_Singular_Val + 2.0**(Real'Machine_Emin + 4*Real'Digits); --new_line; --for i in Singular_Vals'Range loop --put (Singular_Vals(i)); --end loop; --new_line(1); --new_line; put ("Singular_Vals printed above."); -- Get Product = V' * V = transpose(V) * V for i in Col_Index range Starting_Col .. Final_Col loop for j in Col_Index range Starting_Col .. Final_Col loop Sum := 0.0; for k in Col_Index range Starting_Col .. Final_Col loop Sum := Sum + V(k, i) * V(k, j); end loop; VV_Product(i,j) := Sum; end loop; end loop; -- Product - I = 0? Error_Diag := 0.0; Error_Off_Diag := 0.0; for i in Col_Index range Starting_Col .. Final_Col loop for j in Col_Index range Starting_Col .. Final_Col loop if i = j then Del := Abs (1.0 - VV_Product(i,j)); if Del > Error_Diag then Error_Diag := Del; end if; else Del := Abs (0.0 - VV_Product(i,j)); if Del > Error_Off_Diag then Error_Off_Diag := Del; end if; end if; end loop; end loop; new_line; put ("Max err in I - V'*V, On_Diagonal ="); put (Error_Diag); new_line; put ("Max err in I - V'*V, Off_Diagonal ="); put (Error_Off_Diag); -- Get Product = U * W * V' = U * W * transpose(V) -- U is usually Row_Index x Row_Index but can probably use Col_Index for its 2nd -- V is Col_Index x Col_Index -- -- S is conceptually Row_Index x Col_Index, with the Sing_Vals on its diagonal, -- but its really in a vector on Col_Index. -- -- So the No_of_Singular vals is MIN of No_of_Rows, No_Of_Cols -- Singular vals are sorted so that largest are at beginning of Singular_Vals(k). -- -- Get matrix product S * V'; place in matrix V': for k in Col_Index range Starting_Col .. Final_Col loop for c in Col_Index range Starting_Col .. Final_Col loop V(c, k) := V(c, k) * Singular_Vals(k); end loop; end loop; -- V' = S*V' is now conceptually Row_Index x Col_Index, but really it -- is all zeros for Rows > Final_Col: for r in Starting_Row .. Final_Row loop -- U is Row_Index x Row_Index for c in Starting_Col .. Final_Col loop -- V' is Row_Index x Col_Index Sum := 0.0; for k in Col_Index range Starting_Col .. Final_Col loop Sum := Sum + U(r, Row_Index (k)) * V(c, k); end loop; SVD_Product(r, c) := Sum; end loop; end loop; Error_Diag := 0.0; Error_Off_Diag := 0.0; for i in Starting_Row .. Final_Row loop for j in Starting_Col .. Final_Col loop if i = Row_Index'Base (j) then Del := Abs (A(i,j) - SVD_Product(i,j)); if Del > Error_Diag then Error_Diag := Del; end if; else Del := Abs (A(i,j) - SVD_Product(i,j)); if Del > Error_Off_Diag then Error_Off_Diag := Del; end if; end if; end loop; end loop; new_line(1); put ("Max err in A - U*W*V', On_Diagonal ="); put (Error_Diag / Max_Singular_Val); new_line; put ("Max err in A - U*W*V', Off_Diagonal ="); put (Error_Off_Diag / Max_Singular_Val); -- Get Product = U' * U = transpose(U) * U for i in Row_Index range Starting_Row .. Final_Row loop for j in Row_Index range Starting_Row .. Final_Row loop Sum := 0.0; for k in Starting_Row .. Final_Row loop Sum := Sum + U(k, i) * U(k, j); end loop; UU_Product(i,j) := Sum; end loop; end loop; -- Product - I = 0? Error_Diag := 0.0; Error_Off_Diag := 0.0; for i in Row_Index range Starting_Row .. Final_Row loop for j in Row_Index range Starting_Row .. Final_Row loop if i = j then Del := Abs (1.0 - UU_Product(i,j)); if Del > Error_Diag then Error_Diag := Del; end if; else Del := Abs (0.0 - UU_Product(i,j)); if Del > Error_Off_Diag then Error_Off_Diag := Del; end if; end if; end loop; end loop; new_line; put ("Max err in I - U'*U, On_Diagonal ="); put (Error_Diag); new_line; put ("Max err in I - U'*U, Off_Diagonal ="); put (Error_Off_Diag); end loop; -- over Chosen_Matrix end golub_svd_tst_2;
src/Native/Runtime/arm/GetThread.asm
ZZHGit/corert
0
90186
<filename>src/Native/Runtime/arm/GetThread.asm<gh_stars>0 ;; ;; Copyright (c) Microsoft. All rights reserved. ;; Licensed under the MIT license. See LICENSE file in the project root for full license information. ;; #include "AsmMacros.h" TEXTAREA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpGetThread ;; ;; ;; INPUT: none ;; ;; OUTPUT: r0: Thread pointer ;; ;; MUST PRESERVE ARGUMENT REGISTERS ;; @todo check the actual requirements here, r0 is both return and argument register ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LEAF_ENTRY RhpGetThread ;; r0 = GetThread(), TRASHES r12 INLINE_GETTHREAD r0, r12 bx lr LEAF_END FASTCALL_ENDFUNC end
oeis/304/A304168.asm
neoneye/loda-programs
11
161602
; A304168: a(n) = 2*3^n - 2^(n-1) (n>=1). ; Submitted by <NAME> ; 5,16,50,154,470,1426,4310,12994,39110,117586,353270,1060834,3184550,9557746,28681430,86060674,258214790,774709906,2324260790,6973044514,20919657830,62760022066,188282163350,564850684354,1694560441670,5083698102226,15251127861110,45753450692194,137260486294310,411781727318386,1235345718826070,3706038230220034,11118116838143750,33354354809398546,100063073018130230,300189236234259874,900567743062517990,2701703297907030706,8105110031160045590,24315330368358043714,72945991654829945030 mov $1,3 pow $1,$0 mul $1,6 mov $2,2 pow $2,$0 sub $1,$2 mov $0,$1
tests/006_MOV_to_and_from_memory__32_and_64_bit.asm
tpisto/pasm
103
173753
<filename>tests/006_MOV_to_and_from_memory__32_and_64_bit.asm ; name: MOV to and from memory. 32 and 64 bit ; code: "8B0D99887766890D99887766668B4877668B8888770000668B4889668B887888FFFF6689487766898888770000668948896689887888FFFF8B1189118B51778B91887700008B51898B917888FFFF89527789928877000089528989927888FFFF8B1289128B5B778B9B887700008B5B898B9B7888FFFF895B77899B88770000895B89899B7888FFFF8B1689168B5E778B9E887700008B5E898B9E7888FFFF895E77899E88770000895E89899E7888FFFF8B1789178B5F778B9F887700008B5F898B9F7888FFFF895F77899F88770000895F89899F7888FFFF8B0C2599887766890C259988776666678B487766678B888877000066678B488966678B887888FFFF666789487766678988887700006667894889666789887888FFFF678B11678911678B5177678B9188770000678B5189678B917888FFFF6789527767899288770000678952896789927888FFFF678B12678912678B5B77678B9B88770000678B5B89678B9B7888FFFF67895B7767899B8877000067895B8967899B7888FFFF678B16678916678B5E77678B9E88770000678B5E89678B9E7888FFFF67895E7767899E8877000067895E8967899E7888FFFF678B17678917678B5F77678B9F88770000678B5F89678B9F7888FFFF67895F7767899F8877000067895F8967899F7888FFFF668B4877668B8888770000668B4889668B887888FFFF6689487766898888770000668948896689887888FFFF488B11488911488B5177488B9188770000488B5189488B917888FFFF4889527748899288770000488952894889927888FFFF488B12488912488B5B77488B9B88770000488B5B89488B9B7888FFFF48895B7748899B8877000048895B8948899B7888FFFF488B16488916488B5E77488B9E88770000488B5E89488B9E7888FFFF48895E7748899E8877000048895E8948899E7888FFFF488B17488917488B5F77488B9F88770000488B5F89488B9F7888FFFF48895F7748899F8877000048895F8948899F7888FFFF" [bits 32] mov ecx,[0x66778899] mov [0x66778899],ecx mov cx,[eax+0x77] mov cx,[eax+0x7788] mov cx,[eax-0x77] mov cx,[eax-0x7788] mov [eax+0x77], cx mov [eax+0x7788], cx mov [eax-0x77], cx mov [eax-0x7788], cx mov edx, [ecx] mov [ecx], edx mov edx,[ecx+0x77] mov edx,[ecx+0x7788] mov edx,[ecx-0x77] mov edx,[ecx-0x7788] mov [edx+0x77], edx mov [edx+0x7788], edx mov [edx-0x77], edx mov [edx-0x7788], edx mov edx, [edx] mov [edx], edx mov ebx,[ebx+0x77] mov ebx,[ebx+0x7788] mov ebx,[ebx-0x77] mov ebx,[ebx-0x7788] mov [ebx+0x77], ebx mov [ebx+0x7788], ebx mov [ebx-0x77], ebx mov [ebx-0x7788], ebx mov edx, [esi] mov [esi], edx mov ebx,[esi+0x77] mov ebx,[esi+0x7788] mov ebx,[esi-0x77] mov ebx,[esi-0x7788] mov [esi+0x77], ebx mov [esi+0x7788], ebx mov [esi-0x77], ebx mov [esi-0x7788], ebx mov edx, [edi] mov [edi], edx mov ebx,[edi+0x77] mov ebx,[edi+0x7788] mov ebx,[edi-0x77] mov ebx,[edi-0x7788] mov [edi+0x77], ebx mov [edi+0x7788], ebx mov [edi-0x77], ebx mov [edi-0x7788], ebx [bits 64] mov ecx,[0x66778899] mov [0x66778899],ecx mov cx,[eax+0x77] mov cx,[eax+0x7788] mov cx,[eax-0x77] mov cx,[eax-0x7788] mov [eax+0x77], cx mov [eax+0x7788], cx mov [eax-0x77], cx mov [eax-0x7788], cx mov edx, [ecx] mov [ecx], edx mov edx,[ecx+0x77] mov edx,[ecx+0x7788] mov edx,[ecx-0x77] mov edx,[ecx-0x7788] mov [edx+0x77], edx mov [edx+0x7788], edx mov [edx-0x77], edx mov [edx-0x7788], edx mov edx, [edx] mov [edx], edx mov ebx,[ebx+0x77] mov ebx,[ebx+0x7788] mov ebx,[ebx-0x77] mov ebx,[ebx-0x7788] mov [ebx+0x77], ebx mov [ebx+0x7788], ebx mov [ebx-0x77], ebx mov [ebx-0x7788], ebx mov edx, [esi] mov [esi], edx mov ebx,[esi+0x77] mov ebx,[esi+0x7788] mov ebx,[esi-0x77] mov ebx,[esi-0x7788] mov [esi+0x77], ebx mov [esi+0x7788], ebx mov [esi-0x77], ebx mov [esi-0x7788], ebx mov edx, [edi] mov [edi], edx mov ebx,[edi+0x77] mov ebx,[edi+0x7788] mov ebx,[edi-0x77] mov ebx,[edi-0x7788] mov [edi+0x77], ebx mov [edi+0x7788], ebx mov [edi-0x77], ebx mov [edi-0x7788], ebx [bits 64] mov cx,[rax+0x77] mov cx,[rax+0x7788] mov cx,[rax-0x77] mov cx,[rax-0x7788] mov [rax+0x77], cx mov [rax+0x7788], cx mov [rax-0x77], cx mov [rax-0x7788], cx mov rdx, [rcx] mov [rcx], rdx mov rdx,[rcx+0x77] mov rdx,[rcx+0x7788] mov rdx,[rcx-0x77] mov rdx,[rcx-0x7788] mov [rdx+0x77], rdx mov [rdx+0x7788], rdx mov [rdx-0x77], rdx mov [rdx-0x7788], rdx mov rdx, [rdx] mov [rdx], rdx mov rbx,[rbx+0x77] mov rbx,[rbx+0x7788] mov rbx,[rbx-0x77] mov rbx,[rbx-0x7788] mov [rbx+0x77], rbx mov [rbx+0x7788], rbx mov [rbx-0x77], rbx mov [rbx-0x7788], rbx mov rdx, [rsi] mov [rsi], rdx mov rbx,[rsi+0x77] mov rbx,[rsi+0x7788] mov rbx,[rsi-0x77] mov rbx,[rsi-0x7788] mov [rsi+0x77], rbx mov [rsi+0x7788], rbx mov [rsi-0x77], rbx mov [rsi-0x7788], rbx mov rdx, [rdi] mov [rdi], rdx mov rbx,[rdi+0x77] mov rbx,[rdi+0x7788] mov rbx,[rdi-0x77] mov rbx,[rdi-0x7788] mov [rdi+0x77], rbx mov [rdi+0x7788], rbx mov [rdi-0x77], rbx mov [rdi-0x7788], rbx
courses/spark_for_ada_programmers/labs/source/030_spark_language_and_tools/side_effects.adb
AdaCore/training_material
15
13394
with Simple_IO; package body Side_Effects with SPARK_Mode => On is X, Y, Z, R : Integer; function F (X : Integer) return Integer is begin Z := 0; -- Side effect return X + 1; end F; procedure Test is begin X := 10; Y := 20; Z := 10; R := Y / Z + F (X); -- possible order dependency here. -- R = 13 if L->R evaluation, -- constraint error if R->L evaluation Simple_IO.Put_Line (R); end Test; end Side_Effects;
programs/oeis/014/A014143.asm
jmorken/loda
1
161504
; A014143: Partial sums of A014138. ; 1,4,12,34,98,294,919,2974,9891,33604,116103,406614,1440025,5147876,18550572,67310938,245716094,901759950,3325066996,12312494462,45766188948,170702447074,638698318850,2396598337950,9016444758502,34003644251206,128524394659914,486793096818982,1847304015629418,7022801436532158 mov $12,$0 mov $14,$0 add $14,1 lpb $14 clr $0,12 mov $0,$12 trn $14,1 sub $0,$14 mov $9,$0 mov $11,$0 add $11,1 lpb $11 mov $0,$9 trn $11,1 sub $0,$11 mov $7,$0 add $0,1 mov $4,$6 add $4,$0 mov $8,$0 add $8,2 mov $2,$8 add $2,$7 mov $0,$2 bin $2,$4 div $2,$0 add $10,$2 lpe add $13,$10 lpe mov $1,$13
src/grammarEPN.g4
NorbiRm/EPN_XML
0
391
<filename>src/grammarEPN.g4 grammar grammarEPN; expr: | statement ; statement: | if_statement ('and' if_statement)* | if_statement ; if_statement: | 'if' condition | 'if' condition (( 'and' | 'or') condition)* | 'if' condition (( 'and' | 'or') if_statement)* ; condition: | ('any of' | 'any') any | 'having' having | 'within' within (LETRA)+ ; any: | (LETRA)+ ; having: ('different' | 'same' | 'equals') value ; campo: | LETRA+ ; within: | time operador value | time value | time ; operador: | 'greater than' | 'greater' | 'less than' | 'for' | 'than' | 'as' | 'earlier than' ; value: | DIGIT+ | LETRA+ ; time: | (DIGIT)+ tipo ; tipo: |('minutes' | 'hours') ; DIGIT: [0-9]; LETRA: ('-'|[A-Za-z])+; WS: (' ' | '\t' | '\n' | '\r')+ ->skip;
kernel/arch/i386/ports.asm
lochnessdragon/exokernel
1
7873
<filename>kernel/arch/i386/ports.asm<gh_stars>1-10 bits 32 ; asm subroutinues with a C ABI global outportb global inportb ; sends a byte (second argument) to the port (first argument) ; stack: [esp + 8] the data byte ; [esp + 4] the I/O port ; [esp ] return address outportb: mov dx, word [esp+4] ; move the address of the I/O port into the dx register mov al, byte [esp+8] ; move the data to be sent into the al register out dx, al ; send the data to the I/O port ret ; returns a byte read from the port (first argument) ; stack: [esp + 4] the I/O port ; [esp ] return address inportb: ;push dx ; save registers mov dx, [esp + 4] ; move the address of the I/O port into the dx register. xor eax, eax ; clear the eax registers for use as a return in al, dx ; read the byte from the I/O port ;pop dx ; load registers ret
antlr4cs/Arithmetic.g4
kaby76/so71536562
0
3154
// Template generated code from trgen 0.15.0 grammar Arithmetic; file_ : expression (SEMI expression)* EOF; expression : expression POW expression | expression (TIMES | DIV) expression | expression (PLUS | MINUS) expression | LPAREN expression RPAREN | (PLUS | MINUS)* atom ; atom : scientific | variable ; scientific : SCIENTIFIC_NUMBER ; variable : VARIABLE ; VARIABLE : VALID_ID_START VALID_ID_CHAR* ; SCIENTIFIC_NUMBER : NUMBER (E SIGN? UNSIGNED_INTEGER)? ; LPAREN : '(' ; RPAREN : ')' ; PLUS : '+' ; MINUS : '-' ; TIMES : '*' ; DIV : '/' ; GT : '>' ; LT : '<' ; EQ : '=' ; POINT : '.' ; POW : '^' ; SEMI : ';' ; WS : [ \r\n\t] + -> channel(HIDDEN) ; fragment VALID_ID_START : ('a' .. 'z') | ('A' .. 'Z') | '_' ; fragment VALID_ID_CHAR : VALID_ID_START | ('0' .. '9') ; fragment NUMBER : ('0' .. '9') + ('.' ('0' .. '9') +)? ; fragment UNSIGNED_INTEGER : ('0' .. '9')+ ; fragment E : 'E' | 'e' ; fragment SIGN : ('+' | '-') ;
alfred-wunderlist-workflow-master/source/wunderlist.applescript
bleen/alfred-workflows
1
3943
<reponame>bleen/alfred-workflows<filename>alfred-wunderlist-workflow-master/source/wunderlist.applescript (*! @framework Wunderlist for Alfred @abstract Control Wunderlist 2 from Alfred @discussion This AppleScript provides a means to control the Wunderlist 2 Mac app from Alfred. As Wunderlist 2 does not yet provide AppleScript support, the features are limited to those that are keyboard-accessible. Regardless, it saves a lot of keystrokes! @author <NAME> @version 0.2 *) #include "../lib/qWorkflow/uncompiled source/q_workflow" #include "wunderlist/config" #include "wunderlist/utilities" #include "wunderlist/ui" #include "wunderlist/results" #include "wunderlist/handlers"